Browse Source

Cleanups

master
pb 3 years ago
parent
commit
7255d6c89a
1 changed files with 17 additions and 13 deletions
  1. 17
    13
      index.js

+ 17
- 13
index.js View File

// Usage : // Usage :
// elxr pull -- Defaults to run config // elxr pull -- Defaults to run config


return elxr.getpulltask()()
return elxr.getpulltask(selectedinstance)()
} }
, 'isInstalled': () => { , 'isInstalled': () => {
return nodeShellExec('where', [processedArgs._[1]], { inherit: true }).then(() => { return nodeShellExec('where', [processedArgs._[1]], { inherit: true }).then(() => {
} }
, getpulltask(def){ , getpulltask(def){


def = def || {
def = (def ? (
def.requiresElevation = true,
def.reqularRepos = def.repos,
def.elevatedRepos = def.elevatedRunasRepos

) : false) || {
requiresElevation : true, requiresElevation : true,
reqularRepos : gitRepos, reqularRepos : gitRepos,
elevatedRepos : elevatedRunasRepos elevatedRepos : elevatedRunasRepos
} }

console.log(`-------------------Processing pull for : ${def.repo} ${def.branch}`) console.log(`-------------------Processing pull for : ${def.repo} ${def.branch}`)
console.dir(def) console.dir(def)


Warning : Cannot locate your preferred configuration since it was not specified Warning : Cannot locate your preferred configuration since it was not specified
You should fork the default chess configuration to customize and make it You should fork the default chess configuration to customize and make it
your own instance with a named config as your own instance with a named config as
{{yourowninstancename}}-config-{{yourcurrentenvironment}}
{{yourowninstancename}}-config-{{yourchosenenvironment}}
And then run this tool as follows And then run this tool as follows
NODE_ENV={{yourenvironment}} elxr i {{yourowninstancename}}
NODE_ENV={{yourchosenenvironment}} elxr i {{yourowninstancename}}
OR OR
Run this tool with the following command to use a quick start default. Run this tool with the following command to use a quick start default.
node elxr --default
elxr --default
OR OR
Choose the the option to create a new instance for you interactively.
Choose one of the options below to run interactively.


We will run your choice of default or create your own at the next prompt.
We will run your choice at the next prompt.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
`)) `))
var prompt = cli.prompter; var prompt = cli.prompter;
q) Quit q) Quit
Default <= d Default <= d
: `).then((choice) => { : `).then((choice) => {
prompt.close();
if (choice && choice === 'd' || !choice) { if (choice && choice === 'd' || !choice) {
processedArgs._[0] = 'i' processedArgs._[0] = 'i'
selectedinstance.instanceName = processedArgs._[1] = processedArgs._[1] || 'chess' selectedinstance.instanceName = processedArgs._[1] = processedArgs._[1] || 'chess'
} }


return p1.ask(`Enter preferred repo server ( <= ${selectedinstance.reposerver || selectedinstance.reposervers[0]} ) : `).then(function (reposerver) { return p1.ask(`Enter preferred repo server ( <= ${selectedinstance.reposerver || selectedinstance.reposervers[0]} ) : `).then(function (reposerver) {
p1.close()
selectedinstance.reposerver = reposerver || selectedinstance.reposervers[0] || 'https://git.bbh.org.in' selectedinstance.reposerver = reposerver || selectedinstance.reposervers[0] || 'https://git.bbh.org.in'
}) })
}) })
else processedArgs._[0] = cmd else processedArgs._[0] = cmd
return p1.ask(`Enter preferred repo server ( <= ${selectedinstance.reposerver || selectedinstance.reposervers[0]} ) : `).then(function (reposerver) { return p1.ask(`Enter preferred repo server ( <= ${selectedinstance.reposerver || selectedinstance.reposervers[0]} ) : `).then(function (reposerver) {
selectedinstance.reposerver = reposerver || selectedinstance.reposervers[0] || 'https://git.bbh.org.in' selectedinstance.reposerver = reposerver || selectedinstance.reposervers[0] || 'https://git.bbh.org.in'
p1.close()
}) })
}) })
}) })
() => prompt.ask(`git user name : ( <= ${gitUser} )`).then((user) => { gitUser = user; }) () => prompt.ask(`git user name : ( <= ${gitUser} )`).then((user) => { gitUser = user; })
, () => prompt.ask(`git email : ( <= ${gitEmail} )`).then((email) => { gitEmail = email; }) , () => prompt.ask(`git email : ( <= ${gitEmail} )`).then((email) => { gitEmail = email; })
] ]
return any([any(steps), any(prompts)]).then(() => { prompt.close() })
return any([any(steps), any(prompts)])
} }
, installsteps: function () { , installsteps: function () {
return any([this.installcmd].map(callsheltask)) return any([this.installcmd].map(callsheltask))
if(!processedArgs._[0] || !selectedinstance.node_env || !selectedinstance.instanceName){ if(!processedArgs._[0] || !selectedinstance.node_env || !selectedinstance.instanceName){
// Weve been told what to do. // Weve been told what to do.
todo = acquireChoices(selectedinstance)
todo = todo.then(() => { return acquireChoices(selectedinstance) })
} }
todo = todo.then(() => { todo = todo.then(() => {
// Currently it retains 2*n when proc needs to be relaunched in elevated mode !!! // Currently it retains 2*n when proc needs to be relaunched in elevated mode !!!
ensureDirectoryExistence(`${selectedinstance.root}/.elxr/run-${runtimestamp}/download.bat`) ensureDirectoryExistence(`${selectedinstance.root}/.elxr/run-${runtimestamp}/download.bat`)
if (!skipprerequisites && !__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);
}) })

Loading…
Cancel
Save