|
|
@@ -570,55 +570,6 @@ var __runcmd = function(label){ |
|
|
|
} |
|
|
|
else return Promise.resolve(true); |
|
|
|
}, |
|
|
|
, () => { |
|
|
|
// Move test config from dev. |
|
|
|
if(process.env.NODE_ENV === 'test'){ |
|
|
|
var devcfgreponame = runconfig.use + '-config' + '-development'; |
|
|
|
var testcfgreponame = runconfig.use + '-config' + '-test'; |
|
|
|
|
|
|
|
var testcfgdir = path.dirname(__dirname) + '/' + testcfgreponame + '/' |
|
|
|
var devcfgdir = path.dirname(__dirname) + '/' + devcfgreponame + '/' //eg (elxr/../elixir-config.development) |
|
|
|
|
|
|
|
var promises = []; |
|
|
|
|
|
|
|
promises.push( |
|
|
|
nodeShellExec('git', ['checkout', 'test'], { |
|
|
|
inherit : true, shell: true, |
|
|
|
cwd : testcfgdir |
|
|
|
// , env: process.env |
|
|
|
, runas : processedArgs.runas |
|
|
|
, title : `git checkout ${testcfgreponame}` |
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
) |
|
|
|
promises.push( |
|
|
|
nodeShellExec('git', ['checkout', 'master'], { |
|
|
|
inherit : true, shell: true, |
|
|
|
cwd : devcfgdir |
|
|
|
// , env: process.env |
|
|
|
, runas : processedArgs.runas |
|
|
|
, title : `git checkout ${devcfgreponame}` |
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
) |
|
|
|
|
|
|
|
Promise.all(promises).then(()=> { |
|
|
|
globSync( '**/*.test.js', {cwd : devcfgdir}).map((filename) => { |
|
|
|
|
|
|
|
console.log('File found : ' + devcfgdir + filename) |
|
|
|
fs.copyFileSync(devcfgdir + filename, testcfgdir+ filename); |
|
|
|
|
|
|
|
nodeShellExec('git', ['checkout', 'test'], { |
|
|
|
inherit : true, shell: true, |
|
|
|
cwd : devcfgdir |
|
|
|
// , env: process.env |
|
|
|
, runas : processedArgs.runas |
|
|
|
, title : `git checkout ${devcfgreponame}` |
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
]; |
|
|
|
runconfig.NODE_ENV = process.env.NODE_ENV = process.env.NODE_ENV || runconfig.NODE_ENV || 'development'; |
|
|
|
if(processedArgs._[1] && runconfig.use !== processedArgs._[1]) runconfig.use = processedArgs._[1]; |
|
|
@@ -630,7 +581,7 @@ var __runcmd = function(label){ |
|
|
|
'development' : 'master', |
|
|
|
} |
|
|
|
|
|
|
|
// -b fails... |
|
|
|
// cant use git checkout -b it fails with branch already exists. |
|
|
|
var performCheckout = (repo)=>{ |
|
|
|
return nodeShellExec('git', ['checkout', checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV], { |
|
|
|
inherit : true, shell: true, |
|
|
@@ -638,6 +589,25 @@ var __runcmd = function(label){ |
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
} |
|
|
|
|
|
|
|
var mergeSources = { |
|
|
|
'development' : null, |
|
|
|
'test' : 'master', |
|
|
|
'production' : 'test' |
|
|
|
} |
|
|
|
var exludeMergeRepos = { |
|
|
|
'elixir-config-development' : true, 'elixir-config-test': true, 'elixir-config-production' : true |
|
|
|
} |
|
|
|
|
|
|
|
var mergeSource = mergeSources[checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV] |
|
|
|
var performMerge = (repo)=>{ |
|
|
|
if(exludeMergeRepos[repo]) return Promise.resolve({ 'skipped' : true }) |
|
|
|
return nodeShellExec('git', ['merge', mergeSource], { |
|
|
|
inherit : true, shell: true, |
|
|
|
cwd : repo |
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
} |
|
|
|
if(runconfig.NODE_ENV === 'development') performMerge = ()=>{} |
|
|
|
|
|
|
|
any(tasks).then(()=>{ |
|
|
|
if(!processedArgs.runas) return op['runas']() |
|
|
|
|
|
|
@@ -667,7 +637,58 @@ var __runcmd = function(label){ |
|
|
|
|
|
|
|
return any(tasks.concat([ |
|
|
|
any(gitRepos.map((repo)=>performCheckout(repo))), |
|
|
|
any(elevatedRunasRepos.map((repo)=>performCheckout(repo))) |
|
|
|
any(elevatedRunasRepos.map((repo)=>performCheckout(repo))), |
|
|
|
any(gitRepos.map((repo)=>performMerge(repo))), |
|
|
|
any(elevatedRunasRepos.map((repo)=>performMerge(repo))), |
|
|
|
, () => { |
|
|
|
// Move test config from dev. |
|
|
|
if(process.env.NODE_ENV === 'test'){ |
|
|
|
var devcfgreponame = runconfig.use + '-config' + '-development'; |
|
|
|
var testcfgreponame = runconfig.use + '-config' + '-test'; |
|
|
|
|
|
|
|
var testcfgdir = path.dirname(__dirname) + '/' + testcfgreponame + '/' |
|
|
|
var devcfgdir = path.dirname(__dirname) + '/' + devcfgreponame + '/' //eg (elxr/../elixir-config.development) |
|
|
|
|
|
|
|
var promises = []; |
|
|
|
|
|
|
|
promises.push( |
|
|
|
nodeShellExec('git', ['checkout', 'test'], { |
|
|
|
inherit : true, shell: true, |
|
|
|
cwd : testcfgdir |
|
|
|
// , env: process.env |
|
|
|
, runas : processedArgs.runas |
|
|
|
, title : `git checkout ${testcfgreponame}` |
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
) |
|
|
|
promises.push( |
|
|
|
nodeShellExec('git', ['checkout', 'master'], { |
|
|
|
inherit : true, shell: true, |
|
|
|
cwd : devcfgdir |
|
|
|
// , env: process.env |
|
|
|
, runas : processedArgs.runas |
|
|
|
, title : `git checkout ${devcfgreponame}` |
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
) |
|
|
|
|
|
|
|
Promise.all(promises).then(()=> { |
|
|
|
globSync( '**/*.test.js', {cwd : devcfgdir}).map((filename) => { |
|
|
|
|
|
|
|
console.log('File found : ' + devcfgdir + filename) |
|
|
|
fs.copyFileSync(devcfgdir + filename, testcfgdir+ filename); |
|
|
|
|
|
|
|
nodeShellExec('git', ['checkout', 'test'], { |
|
|
|
inherit : true, shell: true, |
|
|
|
cwd : devcfgdir |
|
|
|
// , env: process.env |
|
|
|
, runas : processedArgs.runas |
|
|
|
, title : `git checkout ${devcfgreponame}` |
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
]) |
|
|
|
).then(()=>{ |
|
|
|
fs.writeFileSync('run.done', 'success') |