|
|
|
|
|
|
|
|
const fs = require('fs') |
|
|
const fs = require('fs') |
|
|
|
|
|
|
|
|
const cliargs = utils.cliargs; |
|
|
const cliargs = utils.cliargs; |
|
|
const processedArgs = cliargs(process.argv); |
|
|
|
|
|
|
|
|
const processedArgs = cliargs(process.argv.slice(2)); |
|
|
if(!processedArgs.wd){ |
|
|
if(!processedArgs.wd){ |
|
|
if(process.env.wd){ |
|
|
if(process.env.wd){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function __createO(o){ |
|
|
function __createO(o){ |
|
|
if(o.finalized) return o; |
|
|
if(o.finalized) return o; |
|
|
var subs = Object.keys(cmds[o.cmd].subcommands || {}) |
|
|
var subs = Object.keys(cmds[o.cmd].subcommands || {}) |
|
|
console.log(subs) |
|
|
|
|
|
console.log(o) |
|
|
|
|
|
|
|
|
// console.log(subs) |
|
|
|
|
|
// console.log(o) |
|
|
subs.forEach(sub=>elxrcmd.create( cmds[subcommandlabelFor(o.cmd, sub)] )) |
|
|
subs.forEach(sub=>elxrcmd.create( cmds[subcommandlabelFor(o.cmd, sub)] )) |
|
|
|
|
|
|
|
|
var created = utils.assign_strict({}, __cmd, cmds[o.cmd], o) |
|
|
var created = utils.assign_strict({}, __cmd, cmds[o.cmd], o) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var instanceroot = null |
|
|
var instanceroot = null |
|
|
var detectInstanceRoot = any(instancediscoverytasks, true, true).then( ir => instanceroot = ir.pVal ).catch(()=>{ |
|
|
|
|
|
|
|
|
var detectInstanceRoot = any(instancediscoverytasks, true, true).then( ir => { |
|
|
|
|
|
if(ir.error) { instanceroot = path.normalize(thisscriptdir) === path.normalize(launchpath) ? path.normalize(thisscriptdir + '/..') : launchpath ; } |
|
|
|
|
|
else instanceroot = ir.pVal |
|
|
|
|
|
return instanceroot |
|
|
|
|
|
}).catch(()=>{ |
|
|
instanceroot = path.normalize(thisscriptdir) === path.normalize(launchpath) ? path.normalize(thisscriptdir + '/..') : launchpath ; |
|
|
instanceroot = path.normalize(thisscriptdir) === path.normalize(launchpath) ? path.normalize(thisscriptdir + '/..') : launchpath ; |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// alert(objENV('wd')) |
|
|
// alert(objENV('wd')) |
|
|
// PB : TODO -- Convert all the cli args back to string. |
|
|
// PB : TODO -- Convert all the cli args back to string. |
|
|
// __filename will sure we are launhed using the same entry point. |
|
|
// __filename will sure we are launhed using the same entry point. |
|
|
var cargs = (processedArgs.debug ? '--inspect-brk=9228' : '') + ' ${path.basename(__filename)} ' + processedArgs._.join(' ') + ' ' + namedArgs.join(' '); |
|
|
|
|
|
|
|
|
var cargs = (processedArgs.debug ? '--inspect-brk=9228' : '') + ' ${__filename.replace(/\\/g, '\\\\')} ' + processedArgs._.join(' ') + ' ' + namedArgs.join(' '); |
|
|
// alert(cargs) |
|
|
// alert(cargs) |
|
|
var shell = new ActiveXObject('shell.application'); |
|
|
var shell = new ActiveXObject('shell.application'); |
|
|
// alert('launching node privilged. ' + processedArgs['nodepath']) |
|
|
// alert('launching node privilged. ' + processedArgs['nodepath']) |
|
|
|
|
|
|
|
|
else collect.push(matches[1]) |
|
|
else collect.push(matches[1]) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}, `${selectedinstance.root}/.elxr` ).then(()=>{ |
|
|
|
|
|
|
|
|
}, `${selectedinstance.root}/.elxr` ) |
|
|
|
|
|
.then(()=>{ |
|
|
// delete garbage |
|
|
// delete garbage |
|
|
if(collect.length > retaincount) { |
|
|
if(collect.length > retaincount) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else return true |
|
|
else return true |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.then(()=>{ |
|
|
|
|
|
if (!skipprerequisites && !__isElevated || processedArgs.forceprereqs && !__isElevated ) mainTasks.push(verifyAndInstallPrerequisites); |
|
|
|
|
|
mainTasks.push(maintask) |
|
|
|
|
|
return any(mainTasks); |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
if (!skipprerequisites && !__isElevated || processedArgs.forceprereqs && !__isElevated ) mainTasks.push(verifyAndInstallPrerequisites); |
|
|
if (!skipprerequisites && !__isElevated || processedArgs.forceprereqs && !__isElevated ) mainTasks.push(verifyAndInstallPrerequisites); |
|
|
mainTasks.push(maintask) |
|
|
mainTasks.push(maintask) |
|
|
return any(mainTasks); |
|
|
return any(mainTasks); |
|
|
} |
|
|
} |
|
|
else return true; |
|
|
|
|
|
}) |
|
|
|
|
|
.then(()=>{ |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|