| var elxrcmd = (function(){ | var elxrcmd = (function(){ | ||||
| __cmdprototype = function(){}; | |||||
| var __cmdprototype = function(){}; | |||||
| function subcommandlabelFor(cmd, sub){ return (`${cmd} ${sub || ''}`).trim() } | function subcommandlabelFor(cmd, sub){ return (`${cmd} ${sub || ''}`).trim() } | ||||
| var __cmd = { | var __cmd = { |
| /* Version: 1.0.0 - December 2, 2021 21:12:33 */ | |||||
| /* Version: 1.0.0 - December 3, 2021 11:58:46 */ | |||||
| 'use strict'; | 'use strict'; | ||||
| var path$1 = require('path'); | var path$1 = require('path'); | ||||
| }; | }; | ||||
| const __ALIAS__STAMP__ = '9e7bebe0-1f57-11ec-8f88-778ffeea9d1b'; | const __ALIAS__STAMP__ = '9e7bebe0-1f57-11ec-8f88-778ffeea9d1b'; | ||||
| const BUILD_VERSION = 'Version: 1.0.0 - built on December 2, 2021 21:12:33'; | |||||
| const BUILD_VERSION = 'Version: 1.0.0 - built on December 3, 2021 11:58:46'; | |||||
| const runtimestamp = (new Date()).getTime(); | const runtimestamp = (new Date()).getTime(); | ||||
| function getVersion() { return BUILD_VERSION; } | function getVersion() { return BUILD_VERSION; } | ||||
| console.log(getVersion()); | console.log(getVersion()); | ||||
| var elxrcmd = (function(){ | var elxrcmd = (function(){ | ||||
| __cmdprototype = function(){}; | |||||
| var __cmdprototype = function(){}; | |||||
| function subcommandlabelFor(cmd, sub){ return (`${cmd} ${sub || ''}`).trim() } | function subcommandlabelFor(cmd, sub){ return (`${cmd} ${sub || ''}`).trim() } | ||||
| var __cmd = { | var __cmd = { |
| }) | }) | ||||
| } | } | ||||
| function unique(arr) { | |||||
| var hash = {}, result = []; | |||||
| for ( var i = 0, l = arr.length; i < l; ++i ) { | |||||
| if ( !hash.hasOwnProperty(arr[i]) ) { //it works with objects! in FF, at least | |||||
| hash[ arr[i] ] = true; | |||||
| result.push(arr[i]); | |||||
| } | |||||
| } | |||||
| return result; | |||||
| } | |||||
| // var ENV = Object.assign({}, process.env); // Shallow clone it. | |||||
| var WshShell = WScript.CreateObject("WScript.Shell") | |||||
| var ENV = WshShell.Environment("Process") | |||||
| WScript.echo( ENV("Path") ) | |||||
| function sysAddPathVar(path){ | |||||
| // Object.assign({ | |||||
| // inherit: true, shell: true, env: ENV, title: `${command} ${args}` | |||||
| // }, options) | |||||
| // var newpath = ENV("Path").split(';'); | |||||
| // newpath = Array.from(new Set(newpath.push(path))).join(';') | |||||
| var newpath = []; | |||||
| newpath.push(path) | |||||
| newpath = unique(newpath).join(';') | |||||
| // path.split(';').forEach(pel => { var kv = pel.split('='); kv[0] === key ? null : newpath.push(pel); } ) | |||||
| return any([nodeShellExec('setx', [/*'/m',*/ 'PATH', '"%PATH%;' + newpath + '"' ]) | |||||
| // , nodeShellExec('set', [/*'/m',*/ 'PATH', '"%PATH%;' + newpath + '"' ]) | |||||
| ] ); | |||||
| } | |||||
| var prerequisites = [ | var prerequisites = [ | ||||
| { | { | ||||
| shellcmd: 'git', | shellcmd: 'git', | ||||
| // return any([any(steps), any(prompts)]) | // return any([any(steps), any(prompts)]) | ||||
| } | } | ||||
| } | } | ||||
| , { | |||||
| shellcmd: 'python2' | |||||
| , url: 'https://www.python.org/ftp/python/2.7.18/python-2.7.18.amd64.msi' | |||||
| , installer: 'python-2.7.18.amd64.msi' | |||||
| , installcmd: ['MSIEXEC.exe', ['/i' | |||||
| , path.normalize(downloadsdir + '/' + 'python-2.7.18.amd64.msi') | |||||
| , 'ACCEPT=YES', '/passive']] | |||||
| , preinstallsteps : function() { return Promise.resolve(true) } | |||||
| , install : function() { | |||||
| var self = this; | |||||
| var ifns = [self.installcmd] | |||||
| if(!ifns.map) ifns.map = map; | |||||
| console.log('Installing') | |||||
| return any(ifns.map(callsheltask))['catch'](function(e){ | |||||
| if(e.code === 1602) { | |||||
| console.warn("Installation was probably cancelled.") | |||||
| } | |||||
| else throw e | |||||
| }).then(function(){ | |||||
| return self.postinstallsteps() | |||||
| }) | |||||
| } | |||||
| , postinstallsteps : function() { return sysAddPathVar('%USERPROFILE%\\AppData/Local\\Microsoft\\WindowsApps') } | |||||
| , exists : exists | |||||
| } | |||||
| , | , | ||||
| { | { | ||||
| shellcmd: 'elxr' | shellcmd: 'elxr' |
| var chalk = require('chalk') | var chalk = require('chalk') | ||||
| const homedir = require('os').homedir(); | const homedir = require('os').homedir(); | ||||
| var ENV = Object.assign({}, process.env); // Shallow clone it. | |||||
| function sysAddPathVar(path){ | |||||
| // Object.assign({ | |||||
| // inherit: true, shell: true, env: ENV, title: `${command} ${args}` | |||||
| // }, options) | |||||
| var newpath = path.split(';'); | |||||
| newpath = Array.from(new Set(newpath.push(path))).join(';') | |||||
| // path.split(';').forEach(pel => { var kv = pel.split('='); kv[0] === key ? null : newpath.push(pel); } ) | |||||
| return nodeShellExec('setx', ['/m', 'PATH', newpath ]); | |||||
| } | |||||
| // singleton one time lazy | // singleton one time lazy | ||||
| var getCredentials = function(){ | var getCredentials = function(){ | ||||
| var globSync = require('glob').sync; | var globSync = require('glob').sync; | ||||
| var ENV = Object.assign({}, process.env); // Shallow clone it. | |||||
| const { readdir } = require("fs").promises | const { readdir } = require("fs").promises | ||||
| // Directory shallow walk and do perform on each dir. | // Directory shallow walk and do perform on each dir. | ||||
| var elxrcmd = (function(){ | var elxrcmd = (function(){ | ||||
| __cmdprototype = function(){} | |||||
| var __cmdprototype = function(){} | |||||
| function subcommandlabelFor(cmd, sub){ return (`${cmd} ${sub || ''}`).trim() } | function subcommandlabelFor(cmd, sub){ return (`${cmd} ${sub || ''}`).trim() } | ||||
| var __cmd = { | var __cmd = { | ||||
| var successHandler = () => { | var successHandler = () => { | ||||
| var manifestpath = path.normalize(selected.root + '/' + selected.instanceName + '-config-' + selected.node_env + '/repo-manifest'); | var manifestpath = path.normalize(selected.root + '/' + selected.instanceName + '-config-' + selected.node_env + '/repo-manifest'); | ||||
| selectedinstance = require(manifestpath)( null, selectedinstance) | |||||
| utils.assign_strict(selectedinstance, require(manifestpath)( null, selectedinstance)) | |||||
| console.dir(selectedinstance.repos) | |||||
| // 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... | ||||
| if(!selectedinstance.repos[0].repo) { | if(!selectedinstance.repos[0].repo) { |