diff --git a/.gitmodules b/.gitmodules index 585da3b55..ab1c31f18 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/scripts/_spawn.js b/scripts/_spawn.js index 9b743a95b..ff0d05199 100644 --- a/scripts/_spawn.js +++ b/scripts/_spawn.js @@ -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) { diff --git a/scripts/generate/index.js b/scripts/generate/index.js index 1c1d19af2..d48fe4a33 100644 --- a/scripts/generate/index.js +++ b/scripts/generate/index.js @@ -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) { diff --git a/src/elasticsearch b/src/elasticsearch index aadcfa7b5..ae3e8beca 160000 --- a/src/elasticsearch +++ b/src/elasticsearch @@ -1 +1 @@ -Subproject commit aadcfa7b515a9890ea136569db8c15b645ff8cd7 +Subproject commit ae3e8beca4c61388d9f1798d1063fde7cf9ad1b0