ソースを参照

Added merge

production
Pradeep Bhaskaran 4年前
コミット
2d3c4ff78d
2個のファイルの変更28行の追加32行の削除
  1. 27
    31
      index.js
  2. 1
    1
      windowselevate.hta

+ 27
- 31
index.js ファイルの表示

@@ -22,7 +22,10 @@ var globSync = require('glob').sync;
var path = require('path');
const { isMaster } = require('cluster');
// Serialize a set of functions that will execute to return a promises one after the other.
// Will stop when any one fails.
// Will stop when any one fails unless continueOnFailure is true.
// All tasks in iterables can be functions or promises.
// promises as usual can return other promises or resolve to either truthy or falsy values.
// functions must return a promise
function any(iterable, continueOnFailure) {
return iterable.reduce(
(p, fn, i ,a) => {
@@ -37,53 +40,41 @@ function any(iterable, continueOnFailure) {

// console.log('Then --pVal = ' + pVal + ' bContinue = ' + continueOnFailure ); console.log(p);
if(!pVal && !continueOnFailure) {
console.error("E : pVal :" + pVal);
// i==0 ? null : console.error("E :1 a[i-1] " + a[i-1]);
// a.map((i)=>console.error(i.toString()));
console.error('debugData 3 -------------------');
// console.error(debugData);
console.error('debugData 3 -------------------');
console.error(`E1 : i = ${i} : pVal :` + pVal);
console.error('debugData 2 -------------------');
console.log("Cancelling remaining...");
throw 'Failed in reduce 1 '
return false;
}
// console.log('calling fn : '+ fn);
if(!fn && !continueOnFailure) { console.error('Error : No task specified.'); throw false;}
else if(!fn) return false;
return (Promise.resolve(fn) === fn ) ? fn : fn() ;
})
}
else {

// We will stop on null resolved values on any one task unless continueOnFailure is true.
// console.log('Then --pVal = ' + pVal + ' bContinue = ' + continueOnFailure ); console.log(p);
if(!pVal && !continueOnFailure) {
console.error("E : pVal :" + pVal);
// i==0 ? null : console.error("E :1 a[i-1] " + a[i-1]);
// a.map((i)=>console.error(i.toString()));
console.error('debugData 3 -------------------');
// console.error(debugData);
console.error('debugData 3 -------------------');
console.error(`E2 : i = ${i} : pVal :` + pVal);
console.error('debugData 2 -------------------');
console.log("Cancelling remaining...");
throw 'Failed in reduce 1 '
return false;
throw 'Failed in reduce 2 '
}
// console.log('calling fn : '+ fn);
if(!fn && !continueOnFailure) { console.error('Error : No task specified.'); throw false;}
else if(!fn) return false;
return (Promise.resolve(fn) === fn ) ? fn : fn() ;
}

}).catch((error) => {
console.error("E : " + error);
console.error(`E3 : i = ${i} `);
fn ? console.error("Fn : " + fn.toString()) : null;
// i==0 ? null : console.error("E :2 a[i-1] " + a[i-1]);
// a.map((i)=>console.error(i.toString()));
console.error('debugData 4-------------------------');
// console.error(debugData);
console.error('debugData 4-------------------------');

throw 'Failed in reduce 2 '
return false;
console.error('debugData 3-------------------------');

throw 'Failed in reduce 3 '
})
}
else if(!p) {
@@ -376,6 +367,9 @@ var __runcmd = function(label){

}
, 'pull' : (label) => {
// Usage :
// elxr pull -- Defaults to run config
var env = Object.assign({}, process.env); // Shallow clone it.
// console.dir(env)
console.log('Running exlr pull : ' + path.dirname(__dirname))
@@ -586,6 +580,7 @@ var __runcmd = function(label){
return nodeShellExec('git', ['checkout', checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV], {
inherit : true, shell: true,
cwd : repo
, runas : processedArgs.runas
}).catch((e)=>{ console.error(e) })
}

@@ -604,9 +599,10 @@ var __runcmd = function(label){
return nodeShellExec('git', ['merge', mergeSource], {
inherit : true, shell: true,
cwd : repo
, runas : processedArgs.runas
}).catch((e)=>{ console.error(e) })
}
if(runconfig.NODE_ENV === 'development') performMerge = ()=>{}
if(runconfig.NODE_ENV === 'development') performMerge = ()=>{ return Promise.resolve(true) }

any(tasks).then(()=>{
if(!processedArgs.runas) return op['runas']()
@@ -638,8 +634,8 @@ var __runcmd = function(label){
return any(tasks.concat([
any(gitRepos.map((repo)=>performCheckout(repo))),
any(elevatedRunasRepos.map((repo)=>performCheckout(repo))),
any(gitRepos.map((repo)=>performMerge(repo))),
any(elevatedRunasRepos.map((repo)=>performMerge(repo))),
any(gitRepos.map((repo)=>performMerge(repo))).catch(err=>{ console.error('error in performMerge ' + err)}) ,
any(elevatedRunasRepos.map((repo)=>performMerge(repo))).catch(err=>{ console.error('error in performMerge ' + err)})
, () => {
// Move test config from dev.
if(process.env.NODE_ENV === 'test'){
@@ -670,7 +666,7 @@ var __runcmd = function(label){
}).catch((e)=>{ console.error(e) })
)
Promise.all(promises).then(()=> {
return Promise.all(promises).then(()=> {
globSync( '**/*.test.js', {cwd : devcfgdir}).map((filename) => {
console.log('File found : ' + devcfgdir + filename)

+ 1
- 1
windowselevate.hta ファイルの表示

@@ -15,8 +15,8 @@
</script>

<script language="javascript">
// alert(NODE_ENV);
//WINDOWSTATE="minimize" SHOWINTASKBAR="no" SYSMENU="no" CAPTION="no"
// https://devblogs.microsoft.com/scripting/how-can-i-pass-command-line-variables-to-an-hta-when-it-starts/
// alert(windowselevate.commandLine)
var args = windowselevate.commandLine.split('"').slice(3);
// alert(args)

読み込み中…
キャンセル
保存