| } | } | ||||
| var handleNext = function(){ | var handleNext = function(){ | ||||
| console.log('Task finished with result : ') | |||||
| console.dir(pVal) | |||||
| // console.log('Task finished with result : ') | |||||
| // console.dir(pVal) | |||||
| if(i>0 && a[i-1].info) console.dir(a[i-1].info) | if(i>0 && a[i-1].info) console.dir(a[i-1].info) | ||||
| if(!tasq && !continueOnFailure) { console.log('Error : No task specified.'); throw false;} | if(!tasq && !continueOnFailure) { console.log('Error : No task specified.'); throw false;} | ||||
| else if(!tasq) { console.log('Error : No task specified.'); return false;} | else if(!tasq) { console.log('Error : No task specified.'); return false;} | ||||
| var existsSync = function(filepath){ return fso.FileExists(filepath) } | var existsSync = function(filepath){ return fso.FileExists(filepath) } | ||||
| var fs = { | var fs = { | ||||
| writeFileSync : function(filepath, text) { | writeFileSync : function(filepath, text) { | ||||
| console.log(filepath) | |||||
| // console.log(filepath) | |||||
| var fh = fso.CreateTextFile(filepath, true); | var fh = fso.CreateTextFile(filepath, true); | ||||
| fh.WriteLine(text); | fh.WriteLine(text); | ||||
| fh.Close(); | fh.Close(); | ||||
| var objShell = WScript.createobject("wscript.shell") | var objShell = WScript.createobject("wscript.shell") | ||||
| var oExec = objShell.Exec(cmd + ' ' + argstr.join(' ')) | var oExec = objShell.Exec(cmd + ' ' + argstr.join(' ')) | ||||
| var result = {} | |||||
| var shellresult = { shell : objShell, result : result } | |||||
| var WshRunning = 0 | |||||
| var WshFinished = 1 | |||||
| var WshFailed = 2 | |||||
| while(oExec.Status === WshRunning){ | |||||
| WScript.StdOut.write('.') | |||||
| WScript.Sleep(500) | |||||
| } | |||||
| var strOutput = '' | |||||
| switch(oExec.Status) { | |||||
| case WshFinished : | |||||
| strOutput = oExec.StdOut.ReadAll() | |||||
| result.success = true; | |||||
| result.code = 0 | |||||
| break; | |||||
| case WshFailed : | |||||
| strOutput = oExec.StdErr.ReadAll() | |||||
| result.success = false; | |||||
| result.code = WshFailed | |||||
| break; | |||||
| default : strOutput = 'failed' | |||||
| break; | |||||
| } | |||||
| result.result = command + ' ' + cargs + ' exited with code ' + result.code | |||||
| result.messages = [strOutput] | |||||
| // WScript.Echo(oExec.Status) | // WScript.Echo(oExec.Status) | ||||
| // WScript.Echo(oExec.ProcessID) | // WScript.Echo(oExec.ProcessID) | ||||
| // WScript.Echo(oExec.ExitCode) | // WScript.Echo(oExec.ExitCode) | ||||
| // console.log(objShell.StdOut.ReadAll) | // console.log(objShell.StdOut.ReadAll) | ||||
| // console.log(objShell.StdErr.ReadAll) | // console.log(objShell.StdErr.ReadAll) | ||||
| return objShell; | |||||
| return shellresult; | |||||
| } | } | ||||
| var p = null; | var p = null; | ||||
| var pworker = function(resolve, reject){ | var pworker = function(resolve, reject){ | ||||
| // console.dir(p) | // console.dir(p) | ||||
| var pfx = selectedinstance.root + '/.elxr/run-' + runtimestamp + '/' + stampedFilePfx(new Date()) | var pfx = selectedinstance.root + '/.elxr/run-' + runtimestamp + '/' + stampedFilePfx(new Date()) | ||||
| console.log('p.chain.length ================ ' + p.chain.length) | |||||
| // console.log('p.chain.length ================ ' + p.chain.length) | |||||
| options = options || { | options = options || { | ||||
| runFile : path.normalize( pfx + "out.txt") | runFile : path.normalize( pfx + "out.txt") | ||||
| // runFile : null | // runFile : null | ||||
| } | } | ||||
| runFile = options.runFile | |||||
| var runFile = null; | |||||
| // var runFile = options.runFile | |||||
| // var runFile = selectedinstance.root + '\\' + stampedFilePfx(new Date()) + command + cargs + "out.txt"; | // var runFile = selectedinstance.root + '\\' + stampedFilePfx(new Date()) + command + cargs + "out.txt"; | ||||
| console.log(runFile) | |||||
| // console.log(runFile) | |||||
| var args = cargs.concat() | var args = cargs.concat() | ||||
| // runFile ? (args.push(">"), args.push(runFile)) : cargs | // runFile ? (args.push(">"), args.push(runFile)) : cargs | ||||
| console.log(command + ' ' + args.join(' ')) | |||||
| // console.log(command + ' ' + args.join(' ')) | |||||
| // command = 'cmd' | // command = 'cmd' | ||||
| // args = ['/c', 'start', | // args = ['/c', 'start', | ||||
| var runbat = path.normalize(pfx + "run.bat") | var runbat = path.normalize(pfx + "run.bat") | ||||
| console.log('runbat : ' + runbat) | |||||
| // console.log('runbat : ' + runbat) | |||||
| fs.writeFileSync(runbat, command + ' ' + args.join(' ') + ' \r\n' + 'echo done > ' + runFile ) | fs.writeFileSync(runbat, command + ' ' + args.join(' ') + ' \r\n' + 'echo done > ' + runFile ) | ||||
| // fs.writeFileSync(runFile, 'started') | // fs.writeFileSync(runFile, 'started') | ||||
| // WScript.Quit() | // WScript.Quit() | ||||
| // shellExec( command, args) | // shellExec( command, args) | ||||
| // // cmd /b /c | // // cmd /b /c | ||||
| // }, 500) } | // }, 500) } | ||||
| shellExec( 'cmd', ['/c', runbat]) | |||||
| // shellExec( command, args) | |||||
| console.log(options.waitmsg || ('awaiting ' + command + ' ' + args.join(' '))) | |||||
| // var shellresult = shellExec( 'cmd', ['/c', runbat]) | |||||
| var shellresult = shellExec( command, args) | |||||
| var wrapup = function() { | |||||
| console.log('Wrapping up') | |||||
| var wrapup = function(result) { | |||||
| // console.log('Wrapping up') | |||||
| try { | try { | ||||
| var strFileText = fs.readFileSync(runFile) | |||||
| var messages = []; | |||||
| messages.push(strFileText) | |||||
| var result = { result : command + ' ' + cargs + ' exited with code ???', messages : messages, code : 0, success : true } | |||||
| console.log('resolving'); console.dir(result) | |||||
| resolve(result) | resolve(result) | ||||
| // fs.unlinkSync(runFile) | |||||
| } | } | ||||
| catch(e){ | catch(e){ | ||||
| // console.dir(e) | // console.dir(e) | ||||
| if(e.message === 'Input past end of file') { | if(e.message === 'Input past end of file') { | ||||
| var result = { result : 'cmd /c ' + command + ' ' + cargs + " > " + runFile + ' exited with code ???', messages : [] , code : 0, success : false } | |||||
| // console.log('resolving'); console.dir(result) | // console.log('resolving'); console.dir(result) | ||||
| resolve(result) | resolve(result) | ||||
| // fs.unlinkSync(runFile) | |||||
| } | } | ||||
| else { | else { | ||||
| // fs.unlinkSync(runFile) | |||||
| reject(e) | reject(e) | ||||
| } | } | ||||
| } | } | ||||
| if(runFile){ | if(runFile){ | ||||
| var waitr = function(){ | var waitr = function(){ | ||||
| console.log('awiting output : ' + runFile) | |||||
| if(existsSync(runFile)) return wrapup() | |||||
| WScript.StdOut.write('.') | |||||
| if(existsSync(runFile)) { | |||||
| var strOutput = fs.readFileSync(runFile) | |||||
| shellresult.result.messages = [strOutput] | |||||
| wrapup(shellresult.result) | |||||
| sfs.unlinkSync(runFile) | |||||
| } | |||||
| wait( waitr, 500) | wait( waitr, 500) | ||||
| } | } | ||||
| console.log(wait) | |||||
| // console.log(wait) | |||||
| wait( waitr, 500) | wait( waitr, 500) | ||||
| } | } | ||||
| else wrapup() | |||||
| else { | |||||
| // console.log('There is no runfile.') | |||||
| // console.log(shellresult.strOutput) | |||||
| wrapup(shellresult.result) | |||||
| } | |||||
| } | } | ||||
| p = new Promise(pworker) | p = new Promise(pworker) | ||||
| // promises.push(p) | // promises.push(p) | ||||
| } | } | ||||
| else { | else { | ||||
| // console.log( 'result is value waiting for promisechain' ) | // console.log( 'result is value waiting for promisechain' ) | ||||
| console.dir(result) | |||||
| // console.dir(result) | |||||
| return p.processchain(result) | return p.processchain(result) | ||||
| } | } | ||||
| }; | }; | ||||
| var i = __i; | var i = __i; | ||||
| var __e = null; | var __e = null; | ||||
| p = this; | p = this; | ||||
| console.log('processchain chain.length : ' + p.chain.length) | |||||
| // console.log('processchain chain.length : ' + p.chain.length) | |||||
| function __processchain(r){ | function __processchain(r){ | ||||
| p.result.start() | p.result.start() | ||||
| // console.log(p.result.fn + ' ------------------ ') | // console.log(p.result.fn + ' ------------------ ') | ||||
| waitForResult(p.result, function(r){ | waitForResult(p.result, function(r){ | ||||
| console.log('we waited') | |||||
| // console.log('we waited') | |||||
| // WScript.write('.') | |||||
| p.result = r; i++; __i = i; | p.result = r; i++; __i = i; | ||||
| waitForThen(p) | waitForThen(p) | ||||
| }) | }) | ||||
| then : function(thenfn){ | then : function(thenfn){ | ||||
| // console.log('Adding then') | // console.log('Adding then') | ||||
| thenfn.isThen = true | thenfn.isThen = true | ||||
| if(Object.prototype.toString.call(p.chain) !== '[object Array]') console.dir(p.chain) | |||||
| // if(Object.prototype.toString.call(p.chain) !== '[object Array]') console.dir(p.chain) | |||||
| p.chain.push(thenfn) | p.chain.push(thenfn) | ||||
| return p; | return p; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if(allResolved) { | if(allResolved) { | ||||
| console.log('All Reseloved') | |||||
| console.dir(results) | |||||
| // console.log('All Reseloved') | |||||
| // console.dir(results) | |||||
| resolve(results) | resolve(results) | ||||
| } | } | ||||
| else wait(allwaitr, 500) | else wait(allwaitr, 500) | ||||
| var installtasks = []; | var installtasks = []; | ||||
| prerequisites.forEach(function(preq) { | prerequisites.forEach(function(preq) { | ||||
| var p = preq.exists().then(function(exists) { | var p = preq.exists().then(function(exists) { | ||||
| if (exists && false) console.log( preq.shellcmd + ' exists'); | |||||
| if (exists) console.log( preq.shellcmd + ' exists'); | |||||
| else { | else { | ||||
| console.log(exists) | |||||
| console.log(preq.shellcmd + ' is not installed'); | console.log(preq.shellcmd + ' is not installed'); | ||||
| return preq.preinstallsteps().then(function(){ | return preq.preinstallsteps().then(function(){ | ||||
| console.log(' task.install : ' + preq.install) | |||||
| // console.log(' task.install : ' + preq.install) | |||||
| installtasks.push( function(){ return preq.install() } ); | installtasks.push( function(){ return preq.install() } ); | ||||
| }) | }) | ||||
| } | } | ||||
| // console.log('downloadtasks') | // console.log('downloadtasks') | ||||
| // console.dir(downloadtasks[0]) | // console.dir(downloadtasks[0]) | ||||
| var p = Promise.all(downloadtasks).then(function(){ | var p = Promise.all(downloadtasks).then(function(){ | ||||
| console.log('calling install tasks : ' + installtasks.length) | |||||
| // console.log('calling install tasks : ' + installtasks.length) | |||||
| return any(installtasks) }) | return any(installtasks) }) | ||||
| // console.log('Promise.all.chain : ' + p.chain) | // console.log('Promise.all.chain : ' + p.chain) | ||||
| // } | // } | ||||
| var prerequisites = [ | var prerequisites = [ | ||||
| // { | |||||
| // shellcmd: 'git', | |||||
| // url: 'https://github.com/git-for-windows/git/releases/download/v2.33.0.windows.2/Git-2.33.0.2-64-bit.exe' | |||||
| // , installer: 'Git-2.33.0.2-64-bit.exe' | |||||
| // , installcmd: ['cmd', ['/c', 'start', | |||||
| // '/WAIT', downloadsdir + '/' + 'Git-2.33.0.2-64-bit.exe' | |||||
| // , '/VERYSILENT' | |||||
| // // , '/MERGETASKS=!runcode' // This is required only for vscode... | |||||
| // ]] | |||||
| // , preinstallsteps: function() { | |||||
| // var self = this; | |||||
| // console.log('Git preinstall steps') | |||||
| // var steps = []; | |||||
| // steps.push( | |||||
| // function(){ | |||||
| // // console.log('cli prompt steps') | |||||
| // var choices = { 0 : 'guest', 1 : 'chessdemo' } | |||||
| // return cli.prompt(choices, 'git user name', gitUser).then(function(choice){ gitUser = choice } ) | |||||
| // } | |||||
| // ) | |||||
| // steps.push( | |||||
| // function(){ | |||||
| // var choices = { 0 : 'guest@bbh.org.in', 1 : 'chessdemo@bbh.org.in' } | |||||
| // return cli.prompt(choices, 'git user email', gitEmail).then(function(choice){ gitEmail = choice }) | |||||
| // } | |||||
| // ) | |||||
| // steps.push( | |||||
| // function(){ | |||||
| // if (!existsSync(downloadsdir + '/' + self.installer)) { | |||||
| // return nodeShellExec(selectedinstance.root + '/.elxr/run-' + runtimestamp + '/download.bat', [self.url, downloadsdir + '/' + self.installer]) | |||||
| // } | |||||
| // else { | |||||
| // console.log(self.installer + ' Already exits Download skipped.') | |||||
| // return Promise.resolve(true) | |||||
| // } | |||||
| // } | |||||
| // ) | |||||
| // return any(steps) | |||||
| // // return any([any(steps), any(prompts)]) | |||||
| // } | |||||
| // , installsteps: function () { | |||||
| // var self = this; | |||||
| // console.log('Git Installsteps called') | |||||
| // var ifns = [self.installcmd] | |||||
| // ifns.map = map; | |||||
| // return any(ifns.map(callsheltask))['catch'](function(e){ | |||||
| // if(e.code === 1602) { | |||||
| // console.warn("Installation was probably cancelled.") | |||||
| // } | |||||
| // else throw e | |||||
| // }) | |||||
| // } | |||||
| // , postinstallsteps: function(){ | |||||
| // // PB : TODO -- Detect failure or cancellation before attenpting postinstall steps... | |||||
| // var steps = []; | |||||
| // steps.push( | |||||
| // function(){ | |||||
| // var choices = { 0 : 'guest', 1 : 'chessdemo' } | |||||
| // return cli.prompt(choices, 'git user name', gitUser).then(function(choice){ gitUser = choice } ) | |||||
| // } | |||||
| // ) | |||||
| // steps.push( | |||||
| // function(){ | |||||
| // var choices = { 0 : 'guest@bbh.org.in', 1 : 'chessdemo@bbh.org.in' } | |||||
| // return cli.prompt(choices, 'git user email', gitEmail).then(function(choice){ gitEmail = choice }) | |||||
| // } | |||||
| // ) | |||||
| // return any(steps).then(function(){ | |||||
| // var steps = [ | |||||
| // ['git', ['config', '--global', '--add', 'user.name', gitUser]] | |||||
| // , ['git', ['config', '--global', '--add', 'user.email', gitEmail]] | |||||
| // ] | |||||
| { | |||||
| shellcmd: 'git', | |||||
| url: 'https://github.com/git-for-windows/git/releases/download/v2.33.0.windows.2/Git-2.33.0.2-64-bit.exe' | |||||
| , installer: 'Git-2.33.0.2-64-bit.exe' | |||||
| , installcmd: ['cmd', ['/c', 'start', | |||||
| '/WAIT', downloadsdir + '/' + 'Git-2.33.0.2-64-bit.exe' | |||||
| , '/VERYSILENT' | |||||
| // , '/MERGETASKS=!runcode' // This is required only for vscode... | |||||
| ]] | |||||
| , preinstallsteps: function() { | |||||
| var self = this; | |||||
| console.log('Git preinstall steps') | |||||
| var steps = []; | |||||
| steps.push( | |||||
| function(){ | |||||
| // console.log('cli prompt steps') | |||||
| var choices = { 0 : 'guest', 1 : 'chessdemo' } | |||||
| return cli.prompt(choices, 'git user name', gitUser).then(function(choice){ gitUser = choice } ) | |||||
| } | |||||
| ) | |||||
| steps.push( | |||||
| function(){ | |||||
| var choices = { 0 : 'guest@bbh.org.in', 1 : 'chessdemo@bbh.org.in' } | |||||
| return cli.prompt(choices, 'git user email', gitEmail).then(function(choice){ gitEmail = choice }) | |||||
| } | |||||
| ) | |||||
| steps.push( | |||||
| function(){ | |||||
| if (!existsSync(downloadsdir + '/' + self.installer)) { | |||||
| return nodeShellExec(selectedinstance.root + '/.elxr/run-' + runtimestamp + '/download.bat', [self.url, downloadsdir + '/' + self.installer]) | |||||
| } | |||||
| else { | |||||
| console.log(self.installer + ' Already exits Download skipped.') | |||||
| return Promise.resolve(true) | |||||
| } | |||||
| } | |||||
| ) | |||||
| return any(steps) | |||||
| // return any([any(steps), any(prompts)]) | |||||
| } | |||||
| , installsteps: function () { | |||||
| var self = this; | |||||
| console.log('Git Installsteps called') | |||||
| var ifns = [self.installcmd] | |||||
| ifns.map = map; | |||||
| return any(ifns.map(callsheltask))['catch'](function(e){ | |||||
| if(e.code === 1602) { | |||||
| console.warn("Installation was probably cancelled.") | |||||
| } | |||||
| else throw e | |||||
| }) | |||||
| } | |||||
| , postinstallsteps: function(){ | |||||
| // PB : TODO -- Detect failure or cancellation before attenpting postinstall steps... | |||||
| var steps = []; | |||||
| steps.push( | |||||
| function(){ | |||||
| var choices = { 0 : 'guest', 1 : 'chessdemo' } | |||||
| return cli.prompt(choices, 'git user name', gitUser).then(function(choice){ gitUser = choice } ) | |||||
| } | |||||
| ) | |||||
| steps.push( | |||||
| function(){ | |||||
| var choices = { 0 : 'guest@bbh.org.in', 1 : 'chessdemo@bbh.org.in' } | |||||
| return cli.prompt(choices, 'git user email', gitEmail).then(function(choice){ gitEmail = choice }) | |||||
| } | |||||
| ) | |||||
| return any(steps).then(function(){ | |||||
| var steps = [ | |||||
| ['git', ['config', '--global', '--add', 'user.name', gitUser]] | |||||
| , ['git', ['config', '--global', '--add', 'user.email', gitEmail]] | |||||
| ] | |||||
| // steps.map = map; | |||||
| // return any(steps.map(callsheltask)).then(function(){ | |||||
| // }) | |||||
| // }); | |||||
| // } | |||||
| // , install: function () { | |||||
| // var self = this; | |||||
| // console.log('Git Install called') | |||||
| // return any([ /*self.preinstallsteps,*/ function(){ return self.installsteps() }, function(){ return self.postinstallsteps() } ]) | |||||
| // } | |||||
| // , verifyAndInstall : function(){ | |||||
| // var self = this; | |||||
| // return self.exists().then( function(exits) { | |||||
| // if(exists) return self.getUser(null, function(){ return self.postinstallsteps() } ) | |||||
| // else return self.install(); | |||||
| // }) | |||||
| // } | |||||
| // , exists : function(next){ | |||||
| // var self = this; | |||||
| // return getTaskCheckExists(self.shellcmd, { ignorefailures: true })().then(function(exists) { | |||||
| // console.dir(exists) | |||||
| // console.log(exists + ' git exists') | |||||
| // if(exists && exists.messages.join(' ').indexOf(self.shellcmd) > -1 ) { | |||||
| // return true; | |||||
| // } | |||||
| // else return false | |||||
| // }) | |||||
| // } | |||||
| // , getUser : function(repo, onNoResult){ | |||||
| steps.map = map; | |||||
| return any(steps.map(callsheltask)).then(function(){ | |||||
| }) | |||||
| }); | |||||
| } | |||||
| , install: function () { | |||||
| var self = this; | |||||
| console.log('Git Install called') | |||||
| return any([ /*self.preinstallsteps,*/ function(){ return self.installsteps() }, function(){ return self.postinstallsteps() } ]) | |||||
| } | |||||
| , verifyAndInstall : function(){ | |||||
| var self = this; | |||||
| return self.exists().then( function(exits) { | |||||
| if(exists) return self.getUser(null, function(){ return self.postinstallsteps() } ) | |||||
| else return self.install(); | |||||
| }) | |||||
| } | |||||
| , exists : function(next){ | |||||
| var self = this; | |||||
| return getTaskCheckExists(self.shellcmd, { ignorefailures: true })().then(function(exists) { | |||||
| // console.dir(exists) | |||||
| // console.log(exists + ' git exists') | |||||
| if(exists && exists.messages.join(' ').indexOf(self.shellcmd) > -1 ) { | |||||
| return true; | |||||
| } | |||||
| else return false | |||||
| }) | |||||
| } | |||||
| , getUser : function(repo, onNoResult){ | |||||
| // onNoResult = onNoResult || function(){return false} | |||||
| // var globalOrLocal = '--global'; | |||||
| // if(!repo) globalOrLocal = '--global'; | |||||
| // else globalOrLocal = '--local' | |||||
| // var fns = [['git', ['config', globalOrLocal, '--get-all', 'user.name']]] | |||||
| // fns.map = map; | |||||
| // return any(fns.map(callsheltask)).then(function(result){ | |||||
| // // not yet configured. | |||||
| // if(!result.success) return onNoResult() | |||||
| // else { | |||||
| // var users = result.messages[0].trim().split('\n'); | |||||
| // if(users.length === 0 || | |||||
| // users.length === 1 && users[0] === 'guest') { | |||||
| onNoResult = onNoResult || function(){return false} | |||||
| var globalOrLocal = '--global'; | |||||
| if(!repo) globalOrLocal = '--global'; | |||||
| else globalOrLocal = '--local' | |||||
| var fns = [['git', ['config', globalOrLocal, '--get-all', 'user.name']]] | |||||
| fns.map = map; | |||||
| return any(fns.map(callsheltask)).then(function(result){ | |||||
| // not yet configured. | |||||
| if(!result.success) return onNoResult() | |||||
| else { | |||||
| var users = result.messages[0].trim().split('\n'); | |||||
| if(users.length === 0 || | |||||
| users.length === 1 && users[0] === 'guest') { | |||||
| // return onNoResult() | |||||
| // } | |||||
| // else return users[0]; // PB : TODO == We should probably prompt with all the users available for selection ! | |||||
| // } | |||||
| // }) | |||||
| // .pcatch(function(e){ | |||||
| // console.log(e) | |||||
| // return onNoResult() | |||||
| // }) | |||||
| // } | |||||
| // } | |||||
| // , | |||||
| return onNoResult() | |||||
| } | |||||
| else return users[0]; // PB : TODO == We should probably prompt with all the users available for selection ! | |||||
| } | |||||
| }) | |||||
| .pcatch(function(e){ | |||||
| console.log(e) | |||||
| return onNoResult() | |||||
| }) | |||||
| } | |||||
| } | |||||
| , | |||||
| { | { | ||||
| shellcmd: 'node', | shellcmd: 'node', | ||||
| url: 'https://nodejs.org/dist/v14.17.6/node-v14.17.6-x64.msi' | url: 'https://nodejs.org/dist/v14.17.6/node-v14.17.6-x64.msi' | ||||
| , exists : function(next){ | , exists : function(next){ | ||||
| var self = this; | var self = this; | ||||
| return getTaskCheckExists(self.shellcmd, { ignorefailures: true })().then(function(exists) { | return getTaskCheckExists(self.shellcmd, { ignorefailures: true })().then(function(exists) { | ||||
| console.log(self.shellcmd + ' ' + exists + ' node exists') | |||||
| // console.log(self.shellcmd + ' ' + exists + ' node exists') | |||||
| if(exists && exists.messages.join(' ').indexOf(self.shellcmd) > -1 ) { | if(exists && exists.messages.join(' ').indexOf(self.shellcmd) > -1 ) { | ||||
| return true | return true | ||||
| } | } | ||||
| steps.push( | steps.push( | ||||
| function(){ | function(){ | ||||
| if (!existsSync(downloadsdir + '/' + self.installer)) { | if (!existsSync(downloadsdir + '/' + self.installer)) { | ||||
| return nodeShellExec(selectedinstance.root + '/.elxr/run-' + runtimestamp + '/download.bat', [self.url, downloadsdir + '/' + self.installer]) | |||||
| return nodeShellExec(selectedinstance.root + '/.elxr/run-' + runtimestamp + '/download.bat', [self.url, downloadsdir + '/' + self.installer] | |||||
| , { waitmsg : 'downloading node please wait' }) | |||||
| } | } | ||||
| else { | else { | ||||
| console.log(self.installer + ' Already exits Download skipped.') | console.log(self.installer + ' Already exits Download skipped.') |