switched bower-elasticsearch-js submodule to http, prevented the generate script from attempting to update it

This commit is contained in:
Spencer Alger
2014-01-30 13:49:15 -07:00
parent d4cee5d863
commit 56c0160bc3
4 changed files with 37 additions and 38 deletions

2
.gitmodules vendored
View File

@ -3,4 +3,4 @@
url = https://github.com/elasticsearch/elasticsearch.git
[submodule "src/bower-elasticsearch-js"]
path = src/bower-elasticsearch-js
url = git@github.com:elasticsearch/bower-elasticsearch-js.git
url = https://github.com/elasticsearch/bower-elasticsearch-js.git

View File

@ -3,16 +3,24 @@ module.exports = spawn;
var estream = require('event-stream');
var chalk = require('chalk');
var cp = require('child_process');
var path = require('path');
var root = path.resolve(__dirname, '../');
function spawn(cmd, args, opts, cb) {
opts = opts || {};
var conf = {
stdio: 'pipe'
};
console.log(chalk.white.bold('$ ' + cmd + ' ' + args.join(' ')));
var subdir;
var proc = cp.spawn(cmd, args, {
stdio: 'pipe',
cwd: opts.cwd
});
if (opts.cwd) {
conf.cwd = opts.cwd;
subdir = path.relative(root, opts.cwd) + ' ';
}
console.log(chalk.white.bold((subdir || '') + '$ ') + cmd + ' ' + args.join(' '));
var proc = cp.spawn(cmd, args, opts);
var out = estream.split();
if (opts.verbose) {

View File

@ -1,5 +1,4 @@
var async = require('async');
var _ = require('lodash');
var spawn = require('../_spawn');
var argv = require('optimist')
.options({
@ -27,6 +26,9 @@ var argv = require('optimist')
}
});
var root = require('path').join(__dirname, '../..');
var esSubModule = root + '/src/elasticsearch';
if (process.env.npm_config_argv) {
// when called by NPM
argv = argv.parse(JSON.parse(process.env.npm_config_argv).original);
@ -39,33 +41,22 @@ if (!argv.force && process.env.FORCE || process.env.FORCE_GEN) {
argv.force = argv.f = process.env.FORCE || process.env.FORCE_GEN;
}
function initSubmodule(done) {
spawn('git', ['submodule', 'update', '--init'], argv, function (status) {
done(status ? new Error('Unable to init submodules.') : void 0);
});
return;
}
function fetch(done) {
spawn('git', ['submodule', 'foreach', 'git fetch origin'], argv, function (status) {
done(status ? new Error('Unable fetch lastest changes.') : void 0);
});
return;
function makeSpawn(cmd, args, cwd) {
return function (done) {
spawn(cmd, args, {
verbose: argv.versbose,
cwd: cwd || esSubModule
}, function (status) {
done(status ? new Error('Non-zero exit code: %d', status) : void 0);
});
};
}
function generateBranch(branch, done) {
async.series([
function (done) {
var cmd = [
'git reset --hard',
'git clean -fdx',
'git checkout origin/' + branch
].join(' && ');
spawn('git', ['submodule', 'foreach', cmd], function (status) {
done(status ? new Error('Unable to checkout ' + branch) : void 0);
});
},
makeSpawn('git', ['reset', '--hard']),
makeSpawn('git', ['clean', '-fdx']),
makeSpawn('git', ['checkout', 'origin/' + branch]),
function (done) {
var tasks = [];
@ -86,15 +77,15 @@ function generateBranch(branch, done) {
}
var steps = [
initSubmodule,
fetch,
makeSpawn('git', ['submodule', 'update', '--', esSubModule], root)
];
if (argv.update) {
steps.push(makeSpawn('git', ['fetch', 'origin'], esSubModule));
}
steps.push(
async.apply(generateBranch, '0.90'),
async.apply(generateBranch, 'master')
];
if (!argv.update) {
steps = _.without(steps, fetch);
}
);
async.series(steps, function (err) {
if (err) {