From 6f43f59d329b2262b9c89780f0a8c2236820e694 Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 20 May 2016 13:55:29 -0700 Subject: [PATCH] update generate script to accept alternat es repo location --- scripts/generate/index.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/generate/index.js b/scripts/generate/index.js index c2f2f9f03..8c908d87a 100644 --- a/scripts/generate/index.js +++ b/scripts/generate/index.js @@ -31,7 +31,10 @@ var path = require('path'); var fromRoot = path.join.bind(path, require('find-root')(__dirname)); var utils = require(fromRoot('grunt/utils')); var _ = require(fromRoot('src/lib/utils')); -var esUrl = 'https://github.com/elastic/elasticsearch.git'; +var esUrl = process.env.ES_REPO + ? path.resolve(process.cwd(), process.env.ES_REPO) + : 'https://github.com/elastic/elasticsearch.git'; + var branches; if (process.env.npm_config_argv) { @@ -111,13 +114,17 @@ function spawnStep(cmd, args, cwd) { } function initStep() { - if (isDirectory(paths.esSrc)) return; - return function (done) { - async.series([ - spawnStep('git', ['init', '--bare', paths.esSrc], paths.root), - spawnStep('git', ['remote', 'add', 'origin', esUrl], paths.esSrc) - ], done); + if (isDirectory(paths.esSrc)) { + async.series([ + spawnStep('git', ['remote', 'set-url', 'origin', esUrl], paths.esSrc) + ], done); + } else { + async.series([ + spawnStep('git', ['init', '--bare', paths.esSrc], paths.root), + spawnStep('git', ['remote', 'add', 'origin', esUrl], paths.esSrc) + ], done); + } }; }