|
|
@@ -2185,7 +2185,7 @@ var detectinstances = function () { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var __interactve_promts = function( selectedinstance ){ |
|
|
|
var __interactve_promts = function( target ){ |
|
|
|
|
|
|
|
return { |
|
|
|
runchoice : { |
|
|
@@ -2205,58 +2205,43 @@ var __interactve_promts = function( selectedinstance ){ |
|
|
|
, choices : [] |
|
|
|
, defaultchoice : 'c' |
|
|
|
, interpret : function(choice){ |
|
|
|
var imap = { |
|
|
|
var interpret_map = { |
|
|
|
d : function(){ |
|
|
|
processedArgs._[0] = 'i' |
|
|
|
selectedinstance.instanceName = processedArgs._[1] = processedArgs._[1] || 'chess' |
|
|
|
selectedinstance.node_env = processedArgs.node_env = (process.env.NODE_ENV && process.env.NODE_ENV.trim()) || processedArgs.node_env || 'development' |
|
|
|
selectedinstance.reposerver = 'https://git.bbh.org.in' |
|
|
|
target.instanceName = processedArgs._[1] = processedArgs._[1] || 'chess' |
|
|
|
target.node_env = processedArgs.node_env = (process.env.NODE_ENV && process.env.NODE_ENV.trim()) || processedArgs.node_env || 'development' |
|
|
|
target.reposerver = 'https://git.bbh.org.in' |
|
|
|
} |
|
|
|
, n : function() { processedArgs._[0] = 'i' } |
|
|
|
, i : function() { processedArgs._[0] = 'i' } |
|
|
|
, c : function() { cli.prompter.ask(`Enter cmd : |
|
|
|
p) pull |
|
|
|
Default <= p |
|
|
|
: `).then(function (cmd) { |
|
|
|
if (!cmd || cmd === 'p') { |
|
|
|
processedArgs._[0] = 'pull' |
|
|
|
} |
|
|
|
else processedArgs._[0] = cmd |
|
|
|
return cmd; |
|
|
|
}) |
|
|
|
, c : async function() { |
|
|
|
Object.defineProperty(this, 'cmd', getPromptableAsyncPropDescriptor('cmd', { |
|
|
|
label : `Enter cmd : |
|
|
|
p) pull |
|
|
|
Default <= p |
|
|
|
: ` |
|
|
|
, defaultchoice : 'pull' |
|
|
|
} |
|
|
|
)); |
|
|
|
|
|
|
|
var cmd = await target['cmd']; |
|
|
|
if (!cmd || cmd === 'p') { target['cmd'] = processedArgs._[0] = 'pull' } |
|
|
|
else target['cmd'] = processedArgs._[0] = cmd |
|
|
|
return cmd; |
|
|
|
} |
|
|
|
, h : function() { console.log(elxr.help()); process.exit() } // PB : TODO -- Why do we need log. |
|
|
|
, q : function() { process.exit() } |
|
|
|
} |
|
|
|
if(!choice) return imap['c'] |
|
|
|
var __interpreter = interpret_map['c'] |
|
|
|
// if(!choice) return interpret_map['c']() // This should not happen prompter should always give us a default choice. |
|
|
|
if(interpret_map[choice]) __interpreter = interpret_map[choice]; |
|
|
|
|
|
|
|
return imap[choice] ? imap[choice]() : imap['c']; |
|
|
|
return __interpreter.call(target) |
|
|
|
} |
|
|
|
} |
|
|
|
, instanceName : { label : `Enter Instance Name ( <= ${selectedinstance.instanceName} ) : `, choices : [], defaultchoice : 'chess'} |
|
|
|
, instanceType : { label : `Enter Instance Type ( <= ${selectedinstance.instanceType} ) : `, choices : [], defaultchoice : 'development'} |
|
|
|
, reposerver : { label : `Enter Instance Name ( <= ${selectedinstance.reposerver} ) : `, choices : [], defaultchoice : 'https://git.bbh.org.in'} |
|
|
|
|
|
|
|
// get reposerver(){ |
|
|
|
// return cli.prompt(this.reposervers, 'git default repo').then(reposerver => { |
|
|
|
// Object.defineProperty(this, 'reposerver', { |
|
|
|
// value: reposerver, |
|
|
|
// writable: false, |
|
|
|
// configurable : true, |
|
|
|
// enumerable : true |
|
|
|
// }); |
|
|
|
// return reposerver |
|
|
|
// }) |
|
|
|
// } |
|
|
|
// , set reposerver(reposerver){ |
|
|
|
// Object.defineProperty(this, 'reposerver', { |
|
|
|
// value: reposerver, |
|
|
|
// writable: false, |
|
|
|
// configurable : true, |
|
|
|
// enumerable : true |
|
|
|
// }); |
|
|
|
// return reposerver |
|
|
|
// } |
|
|
|
, instanceName : { label : `Enter Instance Name ( <= ${target.instanceName || 'chess'} ) : `, choices : [], defaultchoice : 'chess'} |
|
|
|
, instanceType : { label : `Enter Instance Type ( <= ${target.instanceType || 'development'} ) : `, choices : [], defaultchoice : 'development'} |
|
|
|
, reposerver : { label : `Enter Instance Name ( <= ${target.reposerver || 'https://git.bbh.org.in'} ) : `, choices : [], defaultchoice : 'https://git.bbh.org.in'} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -2500,20 +2485,26 @@ var getPromptableAsyncPropDescriptor = function(propName, promptable){ |
|
|
|
return { |
|
|
|
get (){ |
|
|
|
return cli.prompt( promptable.choices, promptable.label, promptable.defaultchoice ).then(propValue => { |
|
|
|
propName = promptable.interpret(propValue) |
|
|
|
Object.defineProperty(this, propName, { |
|
|
|
value: propValue, |
|
|
|
writable: false, |
|
|
|
configurable : true, |
|
|
|
enumerable : true |
|
|
|
}); |
|
|
|
return propValue |
|
|
|
if(promptable.interpret){ |
|
|
|
return propName = promptable.interpret(propValue).then( |
|
|
|
()=>{ |
|
|
|
Object.defineProperty(this, propName, { |
|
|
|
value: propValue, |
|
|
|
writable: true, |
|
|
|
configurable : true, |
|
|
|
enumerable : true |
|
|
|
}); |
|
|
|
return propValue |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
else return propValue |
|
|
|
}) |
|
|
|
} |
|
|
|
// , set (propValue){ |
|
|
|
// Object.defineProperty(this, propName, { |
|
|
|
// value: propValue, |
|
|
|
// writable: false, |
|
|
|
// writable: true, // PB : TODO -- Use this to fix value permanently until run is over. |
|
|
|
// configurable : true, |
|
|
|
// enumerable : true |
|
|
|
// }) |