2015-02-23 20:56:47 -05:00
|
|
|
var util = require('./util');
|
|
|
|
var spawn = require('child_process').spawn;
|
|
|
|
var path = require('path');
|
2015-09-26 18:36:11 -04:00
|
|
|
var travisFoldStart = require('../travis/travis-fold');
|
|
|
|
|
2015-02-23 20:56:47 -05:00
|
|
|
|
2015-03-19 14:36:27 -04:00
|
|
|
module.exports = {
|
|
|
|
dir: pubGetDir,
|
|
|
|
subDir: pubGetSubDir
|
|
|
|
};
|
|
|
|
|
|
|
|
function pubGetDir(gulp, plugins, config) {
|
|
|
|
return function() {
|
2015-09-26 18:36:11 -04:00
|
|
|
var travisFoldEnd = travisFoldStart(`pubget-${config.dir}`);
|
|
|
|
|
2015-08-11 11:59:28 -04:00
|
|
|
return util.processToPromise(spawn(config.command, ['upgrade'], {
|
2015-03-19 14:36:27 -04:00
|
|
|
stdio: 'inherit',
|
|
|
|
cwd: config.dir
|
2015-09-26 18:36:11 -04:00
|
|
|
})).then(travisFoldEnd);
|
2015-03-19 14:36:27 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
function pubGetSubDir(gulp, plugins, config) {
|
2015-02-23 20:56:47 -05:00
|
|
|
return function() {
|
2015-09-26 18:36:11 -04:00
|
|
|
var travisFoldEnd = travisFoldStart(`pubget-${config.command}-${config.dir}`);
|
|
|
|
|
2015-02-23 20:56:47 -05:00
|
|
|
// We need to execute pubspec serially as otherwise we can get into trouble
|
|
|
|
// with the pub cache...
|
|
|
|
return util.forEachSubDirSequential(config.dir, function(subDir) {
|
2015-08-11 11:59:28 -04:00
|
|
|
return util.processToPromise(spawn(config.command, ['upgrade'], {
|
2015-02-23 20:56:47 -05:00
|
|
|
stdio: 'inherit',
|
|
|
|
cwd: subDir
|
|
|
|
}));
|
2015-09-26 18:36:11 -04:00
|
|
|
}).then(travisFoldEnd);
|
2015-02-23 20:56:47 -05:00
|
|
|
};
|
|
|
|
};
|