|
|
|
|
|
|
|
|
const cliargs = require('../elxr/cliargs'); // Use minimist... |
|
|
const cliargs = require('../elxr/cliargs'); // Use minimist... |
|
|
const processedArgs = cliargs(process.argv.slice(2)); |
|
|
const processedArgs = cliargs(process.argv.slice(2)); |
|
|
console.dir(processedArgs) |
|
|
console.dir(processedArgs) |
|
|
|
|
|
var globSync = require('glob').sync; |
|
|
|
|
|
|
|
|
var path = require('path') |
|
|
var path = require('path') |
|
|
// Serialize a set of functions that will execute to return a promises one after the other. |
|
|
// Serialize a set of functions that will execute to return a promises one after the other. |
|
|
|
|
|
|
|
|
return p; |
|
|
return p; |
|
|
} |
|
|
} |
|
|
else return Promise.resolve(true); |
|
|
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'; |
|
|
runconfig.NODE_ENV = process.env.NODE_ENV = process.env.NODE_ENV || runconfig.NODE_ENV || 'development'; |