|
|
|
|
|
|
|
|
interpret() { |
|
|
interpret() { |
|
|
var interpreted = {} |
|
|
var interpreted = {} |
|
|
// Non custom command has universal positiona args. |
|
|
// Non custom command has universal positiona args. |
|
|
processedArgs._[1] ? interpreted.instanceName = processedArgs._[1]: null; |
|
|
|
|
|
|
|
|
interpreted.instanceName = processedArgs._[1] ? processedArgs._[1] : null; |
|
|
|
|
|
interpreted.runchoice = processedArgs._[0] || selectedinstance.runchoice; |
|
|
// return clioverrides |
|
|
// return clioverrides |
|
|
// cmds[cmd] = { |
|
|
// cmds[cmd] = { |
|
|
// interpret() { |
|
|
// interpret() { |
|
|
|
|
|
|
|
|
, getPossiblePrompts(){ return { username : true, password : true, instanceName : true, instanceType : true, reposerver : true } } |
|
|
, getPossiblePrompts(){ return { username : true, password : true, instanceName : true, instanceType : true, reposerver : true } } |
|
|
, cmdFn : ()=>{ throw "Elxr Unknown command."} |
|
|
, cmdFn : ()=>{ throw "Elxr Unknown command."} |
|
|
, finalized : true |
|
|
, finalized : true |
|
|
, toArgs : function( o ){ return o } |
|
|
|
|
|
|
|
|
, toArgs : function( o ){ |
|
|
|
|
|
// PB : TODO -- need to call this before selectedinstance is built. The instanceName is dependent on the specific cmd. |
|
|
|
|
|
return o } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function __createO(o){ |
|
|
function __createO(o){ |
|
|
|
|
|
|
|
|
return cmds[cmd].interpret() |
|
|
return cmds[cmd].interpret() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var chessinstances = { current_run : {} }; |
|
|
var clioverrides = interpretrun() |
|
|
var clioverrides = interpretrun() |
|
|
clioverrides = utils.assign( { cmd : processedArgs._[0], node_env : ENV.NODE_ENV, root : ENV.wd, instanceType : ENV.NODE_ENV } |
|
|
clioverrides = utils.assign( { cmd : processedArgs._[0], node_env : ENV.NODE_ENV, root : ENV.wd, instanceType : ENV.NODE_ENV } |
|
|
, clioverrides, cmds[clioverrides.cmd].toArgs(processedArgs), { root : ENV.wd } ) |
|
|
, clioverrides, cmds[clioverrides.cmd].toArgs(processedArgs), { root : ENV.wd } ) |
|
|
|
|
|
|
|
|
var existinglocalinstances = { current_run : {}, error : true } |
|
|
var existinglocalinstances = { current_run : {}, error : true } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var chessinstances = utils.assign_core( { arraymergetype : utils.assign_core.DISTINCT_UNION }, existinglocalinstances); |
|
|
|
|
|
|
|
|
chessinstances = utils.assign_core( { arraymergetype : utils.assign_core.DISTINCT_UNION }, existinglocalinstances); |
|
|
// console.dir(chessinstances) |
|
|
// console.dir(chessinstances) |
|
|
return chessinstances |
|
|
return chessinstances |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var localinstancesPath = `${instanceroot}/${p}.elxr`; |
|
|
var localinstancesPath = `${instanceroot}/${p}.elxr`; |
|
|
if(existsSync( localinstancesPath )) { |
|
|
if(existsSync( localinstancesPath )) { |
|
|
try { |
|
|
try { |
|
|
var chessinstances = acquirelocalinstances( { root : `${instanceroot}/${p}` } ) |
|
|
|
|
|
|
|
|
acquirelocalinstances( { root : `${instanceroot}/${p}` } ) |
|
|
if(chessinstances.error) { |
|
|
if(chessinstances.error) { |
|
|
delete chessinstances.error; delete chessinstances.e |
|
|
delete chessinstances.error; delete chessinstances.e |
|
|
return {} |
|
|
return {} |
|
|
|
|
|
|
|
|
return utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }, { error : true, e }, moverrides) |
|
|
return utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }, { error : true, e }, moverrides) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
var getReconfirmAll = ()=>{return { instanceName : true, instanceType : true, reposerver : true, username : true, password : true } } |
|
|
|
|
|
|
|
|
var selectedinstance = (function() { |
|
|
var selectedinstance = (function() { |
|
|
|
|
|
|
|
|
// PB : TODO -- Override cli prefs and call with undefined selectedinstance only if there is no cli overide or selection. |
|
|
// PB : TODO -- Override cli prefs and call with undefined selectedinstance only if there is no cli overide or selection. |
|
|
var chessinstances = acquirelocalinstances( { root : ENV.wd } ) |
|
|
|
|
|
|
|
|
acquirelocalinstances( { root : ENV.wd } ) |
|
|
|
|
|
|
|
|
if(chessinstances.error) { |
|
|
if(chessinstances.error) { |
|
|
delete chessinstances.error |
|
|
delete chessinstances.error |
|
|
// use installchoices only when we don't find chessinstances. |
|
|
// use installchoices only when we don't find chessinstances. |
|
|
try { var installchoices = require(path.normalize(ENV.wd + '/installchoices.js')) |
|
|
try { var installchoices = require(path.normalize(ENV.wd + '/installchoices.js')) |
|
|
chessinstances[installchoices.instanceName] = chessinstances[installchoices.instanceName] || {} |
|
|
|
|
|
chessinstances[installchoices.instanceName][installchoices.node_env || clioverrides.node_env] = installchoices |
|
|
|
|
|
installchoices.username = installchoices.gitUser |
|
|
|
|
|
installchoices.email = installchoices.gitEmail |
|
|
|
|
|
|
|
|
var instanceName = installchoices.instanceName; |
|
|
|
|
|
var reposerver = installchoices.reposerver |
|
|
|
|
|
var node_env = clioverrides.node_env || installchoices.node_env |
|
|
|
|
|
var __instance = (chessinstances[instanceName] = chessinstances[instanceName] || createLocalChessInstance( { |
|
|
|
|
|
instanceName, node_env, root, reposerver /* promptkeys['reposerver'] */ } ))[node_env]; |
|
|
|
|
|
chessinstances['current_run'] = { instanceName, node_env, reposerver, root } |
|
|
|
|
|
|
|
|
|
|
|
// if(path.normalize(selectedinstance.root) !== path.normalize(chessinstances[selectedinstance.instanceName][selectedinstance.node_env].root)) { |
|
|
|
|
|
// throw "instanceName and instanceType specified doesn't match whats already present do you want to continue " + chessinstances[instanceName][node_env].root + ' does not match ' + selectedinstance.root |
|
|
|
|
|
// } |
|
|
|
|
|
// chessinstances[installchoices.instanceName] = chessinstances[installchoices.instanceName] || {} |
|
|
|
|
|
// chessinstances[installchoices.instanceName][installchoices.node_env || clioverrides.node_env] = installchoices |
|
|
|
|
|
__instance.username = installchoices.username = installchoices.gitUser |
|
|
|
|
|
__instance.email = installchoices.email = installchoices.gitEmail |
|
|
} |
|
|
} |
|
|
catch(e){ |
|
|
catch(e){ |
|
|
|
|
|
console.warn(e) |
|
|
console.warn( 'Install choices not found. WIll prompt for choices' ) // This is not an error. A new fresh instance is probably being setup. |
|
|
console.warn( 'Install choices not found. WIll prompt for choices' ) // This is not an error. A new fresh instance is probably being setup. |
|
|
throw 'PROMPT FOR INSTLL CHOICES TO BE IMPLEMENTED' |
|
|
throw 'PROMPT FOR INSTLL CHOICES TO BE IMPLEMENTED' |
|
|
chessinstances[installchoices.instanceName] = chessinstances[installchoices.instanceName] || {} |
|
|
|
|
|
chessinstances[installchoices.instanceName][installchoices.node_env || clioverrides.node_env] = installchoices |
|
|
|
|
|
|
|
|
// chessinstances[installchoices.instanceName] = chessinstances[installchoices.instanceName] || {} |
|
|
|
|
|
// chessinstances[installchoices.instanceName][installchoices.node_env || clioverrides.node_env] = installchoices |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// PB : chessinstances.js update if we are switching repo servers, username etc... Myabe always refresh on each run. |
|
|
// PB : chessinstances.js update if we are switching repo servers, username etc... Myabe always refresh on each run. |
|
|
// root location for instance swithc ?? should not be allowd... |
|
|
// root location for instance swithc ?? should not be allowd... |
|
|
var selectedInstanceName = chessinstances[clioverrides.instanceName || chessinstances.current_run.instanceName]; |
|
|
|
|
|
var instance = selectedInstanceName ? selectedInstanceName[clioverrides.node_env || (selectedinstance && selectedinstance.node_env) || [chessinstances.current_run.node_env] ] |
|
|
|
|
|
: clioverrides |
|
|
|
|
|
|
|
|
var selectedInstaneTypes = chessinstances[clioverrides.instanceName || chessinstances.current_run.instanceName]; |
|
|
|
|
|
var instance = selectedInstaneTypes ? selectedInstaneTypes[clioverrides.node_env || [chessinstances.current_run.node_env] ] |
|
|
|
|
|
: utils.assign(chessinstances['current_run'], clioverrides) |
|
|
// PB : TODO -- Handle instance not found cases. and prompt cases.. |
|
|
// PB : TODO -- Handle instance not found cases. and prompt cases.. |
|
|
|
|
|
|
|
|
// PB : TODO -- Embed defaults in the build instead of inlining here... |
|
|
// PB : TODO -- Embed defaults in the build instead of inlining here... |
|
|
|
|
|
|
|
|
var __pub = utils.assign_core( { arraymergetype : utils.assign_core.DISTINCT_UNION }, {}, __pvt |
|
|
var __pub = utils.assign_core( { arraymergetype : utils.assign_core.DISTINCT_UNION }, {}, __pvt |
|
|
// Finalized immutables. |
|
|
// Finalized immutables. |
|
|
// We don't need pub to prevent immutability. |
|
|
// We don't need pub to prevent immutability. |
|
|
, { get root(){ |
|
|
|
|
|
return __pvt.root |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
, { get root(){ return __pvt.root } |
|
|
, get node_env(){ return __pvt.node_env } |
|
|
, get node_env(){ return __pvt.node_env } |
|
|
, get instanceName() { return __pvt.instanceName } |
|
|
, get instanceName() { return __pvt.instanceName } |
|
|
, get reposindexed(){ |
|
|
, get reposindexed(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chessinstances[__pub.instanceName] = chessinstances[__pub.instanceName] || {} |
|
|
chessinstances[__pub.instanceName] = chessinstances[__pub.instanceName] || {} |
|
|
chessinstances[__pub.instanceName][__pub.instanceType] = __pub |
|
|
chessinstances[__pub.instanceName][__pub.instanceType] = __pub |
|
|
|
|
|
// PB : TODO initinstances is now obselete relocated here |
|
|
|
|
|
// Upgrade old formats.. |
|
|
|
|
|
if(__pub?.repos && !__pub?.repos[0]?.repo) { |
|
|
|
|
|
console.warn('repo manifest has obsolete format. Attempting upgrade.') |
|
|
|
|
|
__pub.repos = __pub.repos.map(function(repo){ return { repo } }) |
|
|
|
|
|
} |
|
|
|
|
|
if(__pub?.elevated && !__pub?.elevated[0]?.repo) { |
|
|
|
|
|
console.warn('elevated repo manifest has obsolete format. Attempting upgrade.') |
|
|
|
|
|
__pub.elevated = __pub.elevated.map(function(repo){ return { repo } }) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Config from server always override merges into selection except for the current selection. |
|
|
|
|
|
// PB : TODO -- utils.assign Array merges are non-distinct... |
|
|
|
|
|
// chessinstances[instanceName][node_env] = selectedinstance; |
|
|
|
|
|
// chessinstances[selectedinstance.instanceName][selectedinstance.node_env] = selectedinstance; |
|
|
|
|
|
// cacheWriteInstanceConfig(chessinstances, __pub.root, __pub) |
|
|
|
|
|
|
|
|
|
|
|
// PB : TODO -- We should probably write the new server config also... |
|
|
|
|
|
__pub.reposerver = __pub.reposerver || __pub.reposervers[0] // PB : TODO -- Attempt first one that is available and online... |
|
|
|
|
|
|
|
|
cacheWriteInstanceConfig(chessinstances, __pub.root, __pub ) |
|
|
cacheWriteInstanceConfig(chessinstances, __pub.root, __pub ) |
|
|
|
|
|
|
|
|
Object.defineProperty(__g, 'selectedinstance', { |
|
|
Object.defineProperty(__g, 'selectedinstance', { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var __default = selectedinstance; // PB : TODO -- Eliminate __default references. |
|
|
var __default = selectedinstance; // PB : TODO -- Eliminate __default references. |
|
|
|
|
|
|
|
|
// initinstances(selectedinstance) |
|
|
|
|
|
|
|
|
|
|
|
var any = utils.any; |
|
|
var any = utils.any; |
|
|
var Tasq = utils.Tasq |
|
|
var Tasq = utils.Tasq |
|
|
var statuslog = utils.Traq |
|
|
var statuslog = utils.Traq |
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
}).catch((e) => { |
|
|
}).catch((e) => { |
|
|
console.error(e) |
|
|
console.error(e) |
|
|
}).finally(Traq.finally) |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
// .finally(Traq.finally) |
|
|
} |
|
|
} |
|
|
t2.statuslog = statuslog |
|
|
t2.statuslog = statuslog |
|
|
var regularpulltasks = shell_verse.getNonElevatedTask( t2 ) |
|
|
var regularpulltasks = shell_verse.getNonElevatedTask( t2 ) |
|
|
|
|
|
|
|
|
// We first load the default and then override with a runconfig if it exists else we override with the interactive prompts. |
|
|
// We first load the default and then override with a runconfig if it exists else we override with the interactive prompts. |
|
|
// Then acquire and reload and replace this default. |
|
|
// Then acquire and reload and replace this default. |
|
|
|
|
|
|
|
|
var getReconfirmAll = ()=>{return { instanceName : true, instanceType : true, reposerver : true, username : true, password : true } } |
|
|
|
|
|
if(clioverrides.reconfirm) { |
|
|
if(clioverrides.reconfirm) { |
|
|
var reconfirm = getReconfirmAll() |
|
|
var reconfirm = getReconfirmAll() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var email = 'guest@bbh.org.in'; |
|
|
var email = 'guest@bbh.org.in'; |
|
|
var password = '***'; |
|
|
var password = '***'; |
|
|
|
|
|
|
|
|
return any( getInteractionPoints(selectedinstance, promptkeys, { username, password, email}) ).then(()=>{ |
|
|
|
|
|
|
|
|
return any( getInteractionPoints([selectedinstance], promptkeys, { username, password, email}) ).then(()=>{ |
|
|
if(!data.find(e => e === selectedinstance.username)) { |
|
|
if(!data.find(e => e === selectedinstance.username)) { |
|
|
var steps = [ |
|
|
var steps = [ |
|
|
['git', ['config', '--global', '--add', 'user.name', `${username}`]] |
|
|
['git', ['config', '--global', '--add', 'user.name', `${username}`]] |
|
|
|
|
|
|
|
|
// function updateselection(selected) { selectedinstance = utils.assign(selectedinstance, selected) } |
|
|
// function updateselection(selected) { selectedinstance = utils.assign(selectedinstance, selected) } |
|
|
var runconfig = null; |
|
|
var runconfig = null; |
|
|
|
|
|
|
|
|
var chessinstances = { current_run : {} }; |
|
|
|
|
|
var promptkeys = { |
|
|
var promptkeys = { |
|
|
cmd : processedArgs._[0] || 'pull' |
|
|
cmd : processedArgs._[0] || 'pull' |
|
|
// Try not to prompt anything unless absolutely necessary or reconfirm is forced. |
|
|
// Try not to prompt anything unless absolutely necessary or reconfirm is forced. |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var skipprerequisites = false; |
|
|
var skipprerequisites = false; |
|
|
function initinstances(selected_overrides) { |
|
|
|
|
|
var root = selected_overrides.root // We should always have this coz we are running at some place which is fixed by . |
|
|
|
|
|
|
|
|
function initinstances() { |
|
|
|
|
|
// var root = selectedinstance.root |
|
|
|
|
|
|
|
|
|
|
|
var instanceName = selectedinstance.instanceName |
|
|
|
|
|
var node_env = selectedinstance.node_env |
|
|
|
|
|
var reposerver = selectedinstance.reposerver |
|
|
|
|
|
|
|
|
var instanceName = selected_overrides.instanceName |
|
|
|
|
|
|| clioverrides.instanceName |
|
|
|
|
|
// || processedArgs._[1] |
|
|
|
|
|
|| chessinstances.current_run.instanceName |
|
|
|
|
|
|
|
|
// var instanceName = selectedinstance.instanceName |
|
|
|
|
|
// || clioverrides.instanceName |
|
|
|
|
|
// // || processedArgs._[1] |
|
|
|
|
|
// || chessinstances.current_run.instanceName |
|
|
|
|
|
|
|
|
var node_env = selected_overrides.node_env |
|
|
|
|
|
|| clioverrides.node_env |
|
|
|
|
|
// || processedArgs.node_env |
|
|
|
|
|
|| chessinstances.current_run.node_env |
|
|
|
|
|
|
|
|
|
|
|
var reposerver = selected_overrides.reposerver |
|
|
|
|
|
|| clioverrides.reposerver |
|
|
|
|
|
// || processedArgs.node_env |
|
|
|
|
|
|| chessinstances.current_run.reposerver |
|
|
|
|
|
|
|
|
// var node_env = selectedinstance.node_env |
|
|
|
|
|
// || clioverrides.node_env |
|
|
|
|
|
// // || processedArgs.node_env |
|
|
|
|
|
// || chessinstances.current_run.node_env |
|
|
|
|
|
|
|
|
|
|
|
// var reposerver = selectedinstance.reposerver |
|
|
|
|
|
// || clioverrides.reposerver |
|
|
|
|
|
// // || processedArgs.node_env |
|
|
|
|
|
// || chessinstances.current_run.reposerver |
|
|
|
|
|
|
|
|
if(!instanceName) { |
|
|
|
|
|
promptkeys['instanceName'] = instanceName = chessinstances.current_run.instanceName = promptkeys['instanceName'] || __default.instanceName; |
|
|
|
|
|
promptkeys['node_env'] = node_env = chessinstances.current_run.node_env = promptkeys['node_env'] || __default.node_env; |
|
|
|
|
|
promptkeys['reposerver'] = reposerver = chessinstances.current_run.reposerver = promptkeys['reposerver'] || __default.reposervers[0]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// if(!instanceName) { |
|
|
|
|
|
// promptkeys['instanceName'] = instanceName = chessinstances.current_run.instanceName = promptkeys['instanceName'] || __default.instanceName; |
|
|
|
|
|
// promptkeys['node_env'] = node_env = chessinstances.current_run.node_env = promptkeys['node_env'] || __default.node_env; |
|
|
|
|
|
// promptkeys['reposerver'] = reposerver = chessinstances.current_run.reposerver = promptkeys['reposerver'] || __default.reposervers[0]; |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
if(!node_env) { |
|
|
|
|
|
promptkeys['node_env'] = node_env = chessinstances.current_run.node_env = promptkeys['node_env'] || __default.node_env; |
|
|
|
|
|
promptkeys['reposerver'] = reposerver = chessinstances.current_run.reposerver = promptkeys['reposerver'] || __default.reposervers[0]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// if(!node_env) { |
|
|
|
|
|
// promptkeys['node_env'] = node_env = chessinstances.current_run.node_env = promptkeys['node_env'] || __default.node_env; |
|
|
|
|
|
// promptkeys['reposerver'] = reposerver = chessinstances.current_run.reposerver = promptkeys['reposerver'] || __default.reposervers[0]; |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
if(!reposerver) { |
|
|
|
|
|
promptkeys['reposerver'] = reposerver = chessinstances.current_run.reposerver = promptkeys['reposerver'] || __default.reposervers[0]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// if(!reposerver) { |
|
|
|
|
|
// promptkeys['reposerver'] = reposerver = chessinstances.current_run.reposerver = promptkeys['reposerver'] || __default.reposervers[0]; |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
chessinstances[instanceName] = chessinstances[instanceName] || createLocalChessInstance( { |
|
|
|
|
|
instanceName, node_env, root : selected_overrides.root, reposerver : selected_overrides.reposerver /* promptkeys['reposerver'] */ } ); |
|
|
|
|
|
chessinstances['current_run'] = { instanceName: instanceName, node_env, reposerver, root } |
|
|
|
|
|
|
|
|
// chessinstances[instanceName] = chessinstances[instanceName] || createLocalChessInstance( { |
|
|
|
|
|
// instanceName, node_env, root : selectedinstance.root, reposerver : selectedinstance.reposerver /* promptkeys['reposerver'] */ } ); |
|
|
|
|
|
// chessinstances['current_run'] = { instanceName: selectedinstance.instanceName, node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver, root } |
|
|
|
|
|
|
|
|
if(path.normalize(selected_overrides.root) !== path.normalize(chessinstances[instanceName][node_env].root)) { |
|
|
|
|
|
throw "instanceName and instanceType specified doesn't match whats already present do you want to continue " + chessinstances[instanceName][node_env].root + ' does not match ' + selected_overrides.root |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// if(path.normalize(selectedinstance.root) !== path.normalize(chessinstances[selectedinstance.instanceName][selectedinstance.node_env].root)) { |
|
|
|
|
|
// throw "instanceName and instanceType specified doesn't match whats already present do you want to continue " + chessinstances[instanceName][node_env].root + ' does not match ' + selectedinstance.root |
|
|
|
|
|
// } |
|
|
// Override sequence. |
|
|
// Override sequence. |
|
|
// __default, chessinstances[current_run], instanceName-config-development, cliargs, interactve_promts |
|
|
// __default, chessinstances[current_run], instanceName-config-development, cliargs, interactve_promts |
|
|
// PB : TODO -- Undefined keys are overriding and deleting values. We should not allow that. |
|
|
// PB : TODO -- Undefined keys are overriding and deleting values. We should not allow that. |
|
|
// This is ordinary utils.assign behavior. The key should not exist as undefined in the override. |
|
|
// This is ordinary utils.assign behavior. The key should not exist as undefined in the override. |
|
|
// PB : TODO -- We now have options that can be passed into assign_core to control this behavior. |
|
|
// PB : TODO -- We now have options that can be passed into assign_core to control this behavior. |
|
|
if(selected_overrides.node_env === undefined) delete selected_overrides.node_env |
|
|
|
|
|
|
|
|
if(selectedinstance.node_env === undefined) delete selectedinstance.node_env |
|
|
|
|
|
|
|
|
selectedinstance = __g.selectedinstance = utils.assign_core( { arraymergetype : utils.assign_core.DISTINCT_UNION } |
|
|
|
|
|
, __default |
|
|
|
|
|
, chessinstances[instanceName][node_env] |
|
|
|
|
|
, clioverrides |
|
|
|
|
|
, selected_overrides |
|
|
|
|
|
// , __interactive_prompts -- Cant just override. Also need selectedinstance to be ready... |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
// selectedinstance = __g.selectedinstance = utils.assign_core( { arraymergetype : utils.assign_core.DISTINCT_UNION } |
|
|
|
|
|
// , __default |
|
|
|
|
|
// , chessinstances[instanceName][node_env] |
|
|
|
|
|
// , clioverrides |
|
|
|
|
|
// , selectedinstance |
|
|
|
|
|
// // , __interactive_prompts -- Cant just override. Also need selectedinstance to be ready... |
|
|
|
|
|
// ); |
|
|
|
|
|
|
|
|
// chessinstances[instanceName] = chessinstances[instanceName] || {} |
|
|
// chessinstances[instanceName] = chessinstances[instanceName] || {} |
|
|
// chessinstances[instanceName][node_env] = chessinstances[instanceName][node_env] || {} |
|
|
// chessinstances[instanceName][node_env] = chessinstances[instanceName][node_env] || {} |
|
|
|
|
|
|
|
|
// selectedinstance = Object.assign( __default, selectedinstance ) |
|
|
// selectedinstance = Object.assign( __default, selectedinstance ) |
|
|
// } |
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// Upgrade old formats.. |
|
|
if(selectedinstance?.repos && !selectedinstance?.repos[0]?.repo) { |
|
|
if(selectedinstance?.repos && !selectedinstance?.repos[0]?.repo) { |
|
|
console.warn('repo manifest has obsolete format. Attempting upgrade.') |
|
|
console.warn('repo manifest has obsolete format. Attempting upgrade.') |
|
|
selectedinstance.repos = selectedinstance.repos.map(function(repo){ return { repo } }) |
|
|
selectedinstance.repos = selectedinstance.repos.map(function(repo){ return { repo } }) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Config from server always override merges into selection except for the current selection. |
|
|
// Config from server always override merges into selection except for the current selection. |
|
|
// PB : TODO -- utils.assign Array merges are non-distinct... |
|
|
// PB : TODO -- utils.assign Array merges are non-distinct... |
|
|
chessinstances[instanceName][node_env] = selectedinstance; |
|
|
|
|
|
|
|
|
// chessinstances[instanceName][node_env] = selectedinstance; |
|
|
// chessinstances[selectedinstance.instanceName][selectedinstance.node_env] = selectedinstance; |
|
|
// chessinstances[selectedinstance.instanceName][selectedinstance.node_env] = selectedinstance; |
|
|
cacheWriteInstanceConfig(chessinstances, selectedinstance.root) |
|
|
cacheWriteInstanceConfig(chessinstances, selectedinstance.root) |
|
|
|
|
|
|
|
|
// PB : TODO -- We should probably write the new server config also... |
|
|
// PB : TODO -- We should probably write the new server config also... |
|
|
selectedinstance.reposerver = selectedinstance.reposerver || selectedinstance.reposervers[0] // PB : TODO -- Attempt first one that is available and online... |
|
|
selectedinstance.reposerver = selectedinstance.reposerver || selectedinstance.reposervers[0] // PB : TODO -- Attempt first one that is available and online... |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// chessinstances = acquirelocalinstances(selectedinstance); |
|
|
// chessinstances = acquirelocalinstances(selectedinstance); |
|
|
// findlocalinstances(chessinstances, detectedinstanceoptions) |
|
|
// findlocalinstances(chessinstances, detectedinstanceoptions) |
|
|
initinstances(selectedinstance) // use the local instances for defaults if at all possible. |
|
|
initinstances(selectedinstance) // use the local instances for defaults if at all possible. |
|
|
var todo = any( getInteractionPoints([selectedinstance], promptkeys) ).then(()=>{ |
|
|
|
|
|
|
|
|
var todo = any( getInteractionPoints(detectedinstanceoptions, promptkeys) ).then(()=>{ |
|
|
var inst = initinstances(selectedinstance) |
|
|
var inst = initinstances(selectedinstance) |
|
|
detection_state.localInstanceDetected = true; |
|
|
detection_state.localInstanceDetected = true; |
|
|
return inst; |
|
|
return inst; |