only generate the necessary branch in CI environments

This commit is contained in:
Spencer Alger
2014-02-05 09:06:52 -07:00
parent 6c5838fbfa
commit 4680930487
3 changed files with 16 additions and 11 deletions

View File

@ -19,6 +19,10 @@ var argv = require('optimist')
update: {
default: true,
boolean: true
},
branch: {
default: null,
string: true
}
});
@ -29,12 +33,6 @@ var utils = require(fromRoot('grunt/utils'));
var esUrl = 'https://github.com/elasticsearch/elasticsearch.git';
var branches;
if (process.env.ES_GIT_BRANCH) {
branches = [process.env.ES_GIT_BRANCH.split('/').slice(1).join('/')];
} else {
branches = utils.branches;
}
if (process.env.npm_config_argv) {
// when called by NPM
argv = argv.parse(JSON.parse(process.env.npm_config_argv).original);
@ -43,6 +41,13 @@ if (process.env.npm_config_argv) {
argv = argv.argv;
}
if (argv.branch) {
branches = [argv.branch];
} else {
branches = utils.branches;
}
function isDirectory(dir) {
var stat;
try { stat = fs.statSync(dir); } catch (e) {}