|  |  | @@ -66,12 +66,19 @@ var getTaskCheckExists = (command, options) => { | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | var getPullCmd = (repo) => { | 
		
	
		
			
			|  |  |  | var getPullCmd = (repo, branch) => { | 
		
	
		
			
			|  |  |  | // console.log(useGitPull) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | var pullCmd = [gitInstallDir | 
		
	
		
			
			|  |  |  | , ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;'] | 
		
	
		
			
			|  |  |  | , { cwd: repo, title: 'pull all origins for ' + repo }] | 
		
	
		
			
			|  |  |  | if(branch) { | 
		
	
		
			
			|  |  |  | var pullCmd = [ gitInstallDir | 
		
	
		
			
			|  |  |  | , ['-c', 'for i in `git remote`; do git pull $i ' + branch + '; done;'] | 
		
	
		
			
			|  |  |  | , { cwd : repo, title : 'pull all origins for ' + repo }] | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | else { | 
		
	
		
			
			|  |  |  | var pullCmd = [gitInstallDir | 
		
	
		
			
			|  |  |  | , ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;'] | 
		
	
		
			
			|  |  |  | , { cwd: repo, title: 'pull all origins for ' + repo }] | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | // var pullCmd = ['pullall', [], { cwd : repo }] | 
		
	
		
			
			|  |  |  | if (useGitPull) pullCmd = ['git', ['pull'], { | 
		
	
		
			
			|  |  |  | inherit: true, shell: true, | 
		
	
	
		
			
			|  |  | @@ -83,10 +90,10 @@ var getPullCmd = (repo) => { | 
		
	
		
			
			|  |  |  | return pullCmd | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | var performPull = (repo) => { | 
		
	
		
			
			|  |  |  | var performPull = (repo, branch) => { | 
		
	
		
			
			|  |  |  | if (existsSync(instanceroot + '/' + repo)) { | 
		
	
		
			
			|  |  |  | console.log('pulling ' + instanceroot + '/' + repo) | 
		
	
		
			
			|  |  |  | return nodeShellExec.apply(null, getPullCmd(repo)).then(() => { | 
		
	
		
			
			|  |  |  | console.log('pulling ' + instanceroot + '/' + repo + 'branch ' + branch) | 
		
	
		
			
			|  |  |  | return nodeShellExec.apply(null, getPullCmd(repo, branch)).then(() => { | 
		
	
		
			
			|  |  |  | if (__isElevated) { | 
		
	
		
			
			|  |  |  | fs.writeFileSync('run.log', ', ' + JSON.stringify({ repo, success: true }), { 'flag': 'a+' }) | 
		
	
		
			
			|  |  |  | } | 
		
	
	
		
			
			|  |  | @@ -636,9 +643,10 @@ var op = { | 
		
	
		
			
			|  |  |  | // console.dir(env) | 
		
	
		
			
			|  |  |  | console.log('Running exlr pull : ' + path.dirname(__dirname)) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | if (!processedArgs.runas) gitRepos.forEach(performPull) | 
		
	
		
			
			|  |  |  | // SAM : TODO Exclude data repo | 
		
	
		
			
			|  |  |  | if (!processedArgs.runas) gitRepos.map((repo) => performPull(repo, 'master')) | 
		
	
		
			
			|  |  |  | if (__isElevated) { | 
		
	
		
			
			|  |  |  | return any(elevatedRunasRepos.map((repo) => performPull(repo))).then(() => { | 
		
	
		
			
			|  |  |  | return any(elevatedRunasRepos.map((repo) => performPull(repo, 'master'))).then(() => { | 
		
	
		
			
			|  |  |  | fs.writeFileSync('run.done', 'success') | 
		
	
		
			
			|  |  |  | }).catch(() => { | 
		
	
		
			
			|  |  |  | fs.writeFileSync('run.done', 'error') | 
		
	
	
		
			
			|  |  | @@ -1238,9 +1246,9 @@ function elxrworker(hasconfig) { | 
		
	
		
			
			|  |  |  | // --runas | 
		
	
		
			
			|  |  |  | if (processedArgs.runas) { | 
		
	
		
			
			|  |  |  | // Weve been asked to run in priviledged mode. Check if we already are privileged. | 
		
	
		
			
			|  |  |  | __runcmd('runas') | 
		
	
		
			
			|  |  |  | return __runcmd('runas') | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | else __runcmd(processedArgs.label || processedArgs._[0] || 'h'); | 
		
	
		
			
			|  |  |  | else return __runcmd(processedArgs.label || processedArgs._[0] || 'h'); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | var getManifest = function () { | 
		
	
	
		
			
			|  |  | @@ -1431,10 +1439,11 @@ var detectInstance = function () { | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | , elevated: [] | 
		
	
		
			
			|  |  |  | , exludeMergeRepos: {} | 
		
	
		
			
			|  |  |  | , instanceName: processedArgs._[1] || 'chess' | 
		
	
		
			
			|  |  |  | , instanceName: 'chess' | 
		
	
		
			
			|  |  |  | // Runas windowshta clobbers and removes the NODE_ENV !!! We therefore pass it in. | 
		
	
		
			
			|  |  |  | , node_env: (process.env.NODE_ENV && process.env.NODE_ENV.trim()) || processedArgs.node_env || 'development' | 
		
	
		
			
			|  |  |  | , node_env: 'development' | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | return Object.assign({ root }, __default); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
	
		
			
			|  |  | @@ -1532,19 +1541,26 @@ function verifyAndInstallPrerequisites() { | 
		
	
		
			
			|  |  |  | return Promise.all(downloadtasks).then(() => { return any(installtasks) }) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | function acquirelocalinstances(selected){ | 
		
	
		
			
			|  |  |  | var chessinstances = utils.assign(require(path.normalize(selected.root + '/chessinstances.js'))); | 
		
	
		
			
			|  |  |  | chessinstances.current_run.instanceName = processedArgs._[1] = selected.instanceName || processedArgs._[1] || chessinstances.current_run.instanceName; | 
		
	
		
			
			|  |  |  | chessinstances.current_run.node_env = processedArgs.node_env = selected.node_env || processedArgs.node_env || chessinstances.current_run.node_env; | 
		
	
		
			
			|  |  |  | selectedinstance = Object.assign(chessinstances[chessinstances.current_run.instanceName][chessinstances.current_run.node_env], selected); | 
		
	
		
			
			|  |  |  | function initinstances(chessinstances, selected) { | 
		
	
		
			
			|  |  |  | chessinstances.current_run.instanceName = processedArgs._[1] = processedArgs._[1] || chessinstances.current_run.instanceName || selected.instanceName; | 
		
	
		
			
			|  |  |  | chessinstances.current_run.node_env = processedArgs.node_env = processedArgs.node_env || chessinstances.current_run.node_env || selected.node_env; | 
		
	
		
			
			|  |  |  | chessinstances[chessinstances.current_run.instanceName] = chessinstances[chessinstances.current_run.instanceName] || {} | 
		
	
		
			
			|  |  |  | selectedinstance = Object.assign(selected, chessinstances[chessinstances.current_run.instanceName][chessinstances.current_run.node_env], clioverrides); | 
		
	
		
			
			|  |  |  | repomanifest = selectedinstance | 
		
	
		
			
			|  |  |  | return chessinstances | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | function acquirelocalinstances(selected){ | 
		
	
		
			
			|  |  |  | var chessinstances = utils.assign(require(path.normalize(selected.root + '/chessinstances.js'))); | 
		
	
		
			
			|  |  |  | return initinstances(chessinstances, selected) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | function updateselection(selected) { selectedinstance = utils.assign(selectedinstance, selected) } | 
		
	
		
			
			|  |  |  | var detectedInstance = detectInstance(); // From launch location etc. | 
		
	
		
			
			|  |  |  | var selectedinstance = detectedInstance | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | var clioverrides = { } | 
		
	
		
			
			|  |  |  | processedArgs._[1] ? clioverrides.instanceName = processedArgs._[1]: null; | 
		
	
		
			
			|  |  |  | processedArgs.node_env ? clioverrides.node_env = (process.env.NODE_ENV && process.env.NODE_ENV.trim()) || processedArgs.node_env | 
		
	
		
			
			|  |  |  | : (process.env.NODE_ENV && process.env.NODE_ENV.trim()) ? clioverrides.node_env = (process.env.NODE_ENV && process.env.NODE_ENV.trim()): null; | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | var maintask = () => { | 
		
	
		
			
			|  |  |  | try { | 
		
	
	
		
			
			|  |  | @@ -1560,6 +1576,9 @@ var maintask = () => { | 
		
	
		
			
			|  |  |  | catch (e) { | 
		
	
		
			
			|  |  |  | console.error(e) | 
		
	
		
			
			|  |  |  | // No local instances config found. We acquire user choices and proceed to reattempt. | 
		
	
		
			
			|  |  |  | chessinstances = {} | 
		
	
		
			
			|  |  |  | chessinstances.current_run = {} | 
		
	
		
			
			|  |  |  | initinstances(chessinstances, selectedinstance) | 
		
	
		
			
			|  |  |  | return acquireChoices(selectedinstance).then(() => { | 
		
	
		
			
			|  |  |  | try { | 
		
	
		
			
			|  |  |  | var chessinstances = acquirelocalinstances(selectedinstance) | 
		
	
	
		
			
			|  |  | @@ -1570,6 +1589,7 @@ var maintask = () => { | 
		
	
		
			
			|  |  |  | console.log('We will create a new one with the instance and environment chosen...') | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | finally { | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | return acquireConfig(selectedinstance, chessinstances).catch((e) => { | 
		
	
		
			
			|  |  |  | console.error('Chosen cofiguraton failed or not found') | 
		
	
		
			
			|  |  |  | console.error(e) | 
		
	
	
		
			
			|  |  | @@ -1577,7 +1597,7 @@ var maintask = () => { | 
		
	
		
			
			|  |  |  | .finally(()=>{ | 
		
	
		
			
			|  |  |  | fs.writeFileSync('run.log', ', ' + JSON.stringify({ error: e.message }), { 'flag': 'a+' }) | 
		
	
		
			
			|  |  |  | fs.writeFileSync('run.done', 'error'); | 
		
	
		
			
			|  |  |  | return process.exit() | 
		
	
		
			
			|  |  |  | // return process.exit() | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }) |