Ver código fonte

Fixed defaults and overrides

master
pb 3 anos atrás
pai
commit
d1639d21ba
1 arquivos alterados com 23 adições e 11 exclusões
  1. 23
    11
      index.js

+ 23
- 11
index.js Ver arquivo

@@ -1238,9 +1238,9 @@ function elxrworker(hasconfig) {
// --runas
if (processedArgs.runas) {
// Weve been asked to run in priviledged mode. Check if we already are privileged.
__runcmd('runas')
return __runcmd('runas')
}
else __runcmd(processedArgs.label || processedArgs._[0] || 'h');
else return __runcmd(processedArgs.label || processedArgs._[0] || 'h');
}

var getManifest = function () {
@@ -1431,10 +1431,11 @@ var detectInstance = function () {

, elevated: []
, exludeMergeRepos: {}
, instanceName: processedArgs._[1] || 'chess'
, instanceName: 'chess'
// Runas windowshta clobbers and removes the NODE_ENV !!! We therefore pass it in.
, node_env: (process.env.NODE_ENV && process.env.NODE_ENV.trim()) || processedArgs.node_env || 'development'
, node_env: 'development'
}
return Object.assign({ root }, __default);
}

@@ -1532,19 +1533,26 @@ function verifyAndInstallPrerequisites() {
return Promise.all(downloadtasks).then(() => { return any(installtasks) })
}

function acquirelocalinstances(selected){
var chessinstances = utils.assign(require(path.normalize(selected.root + '/chessinstances.js')));
chessinstances.current_run.instanceName = processedArgs._[1] = selected.instanceName || processedArgs._[1] || chessinstances.current_run.instanceName;
chessinstances.current_run.node_env = processedArgs.node_env = selected.node_env || processedArgs.node_env || chessinstances.current_run.node_env;
selectedinstance = Object.assign(chessinstances[chessinstances.current_run.instanceName][chessinstances.current_run.node_env], selected);
function initinstances(chessinstances, selected) {
chessinstances.current_run.instanceName = processedArgs._[1] = processedArgs._[1] || chessinstances.current_run.instanceName || selected.instanceName;
chessinstances.current_run.node_env = processedArgs.node_env = processedArgs.node_env || chessinstances.current_run.node_env || selected.node_env;
chessinstances[chessinstances.current_run.instanceName] = chessinstances[chessinstances.current_run.instanceName] || {}
selectedinstance = Object.assign(selected, chessinstances[chessinstances.current_run.instanceName][chessinstances.current_run.node_env], clioverrides);
repomanifest = selectedinstance
return chessinstances
}
function acquirelocalinstances(selected){
var chessinstances = utils.assign(require(path.normalize(selected.root + '/chessinstances.js')));
return initinstances(chessinstances, selected)
}

function updateselection(selected) { selectedinstance = utils.assign(selectedinstance, selected) }
var detectedInstance = detectInstance(); // From launch location etc.
var selectedinstance = detectedInstance

var clioverrides = { }
processedArgs._[1] ? clioverrides.instanceName = processedArgs._[1]: null;
processedArgs.node_env ? clioverrides.node_env = (process.env.NODE_ENV && process.env.NODE_ENV.trim()) || processedArgs.node_env
: (process.env.NODE_ENV && process.env.NODE_ENV.trim()) ? clioverrides.node_env = (process.env.NODE_ENV && process.env.NODE_ENV.trim()): null;

var maintask = () => {
try {
@@ -1560,6 +1568,9 @@ var maintask = () => {
catch (e) {
console.error(e)
// No local instances config found. We acquire user choices and proceed to reattempt.
chessinstances = {}
chessinstances.current_run = {}
initinstances(chessinstances, selectedinstance)
return acquireChoices(selectedinstance).then(() => {
try {
var chessinstances = acquirelocalinstances(selectedinstance)
@@ -1570,6 +1581,7 @@ var maintask = () => {
console.log('We will create a new one with the instance and environment chosen...')
}
finally {
return acquireConfig(selectedinstance, chessinstances).catch((e) => {
console.error('Chosen cofiguraton failed or not found')
console.error(e)
@@ -1577,7 +1589,7 @@ var maintask = () => {
.finally(()=>{
fs.writeFileSync('run.log', ', ' + JSON.stringify({ error: e.message }), { 'flag': 'a+' })
fs.writeFileSync('run.done', 'error');
return process.exit()
// return process.exit()
})
}
})

Carregando…
Cancelar
Salvar