Browse Source

Added vscode install

master
guest 2 years ago
parent
commit
76358c2254
1 changed files with 60 additions and 3 deletions
  1. 60
    3
      i.win.js

+ 60
- 3
i.win.js View File

scripthostName = 'wsh' scripthostName = 'wsh'
WScript.Echo(WScript.FullName) WScript.Echo(WScript.FullName)


// WScript.Echo('--' + WScript.Arguments(0) + '--')
// WScript.Echo('------------ALL-----------')
// var argEnumerator = new Enumerator(WScript.Arguments)
// for(; !argEnumerator.atEnd(); argEnumerator.moveNext()){
// WScript.Echo('-arg-' + argEnumerator.item() + '-arg-')
// }


// // Unnamed
// WScript.Echo('------------UNNAMED-----------')
// argEnumerator = new Enumerator(WScript.Arguments.Unnamed)
// for(; !argEnumerator.atEnd(); argEnumerator.moveNext()){
// WScript.Echo('-arg-' + argEnumerator.item() + '-arg-') // Value
// }

// // Named
// WScript.Echo('------------NAMED-----------')
// argEnumerator = new Enumerator(WScript.Arguments.Named)
// for(; !argEnumerator.atEnd(); argEnumerator.moveNext()){
// // WScript.Echo('-arg-' + argEnumerator.item(argEnumerator) + '-arg-') // Key
// WScript.Echo('-key-' + argEnumerator.item() + '-key-') // Key
// WScript.Echo('-val=' + WScript.Arguments.Named(argEnumerator.item()) + '=val-') // Value
// }

var all = WScript.Arguments.Named('all');
console = { console = {
log : function(m) { WScript.Echo(m)} log : function(m) { WScript.Echo(m)}
, error : function(m) {WScript.Echo(m) } , error : function(m) {WScript.Echo(m) }
var downloadtasks = []; var downloadtasks = [];
var installtasks = []; var installtasks = [];
prerequisites.forEach(function(preq) { prerequisites.forEach(function(preq) {
if(!all && preq.optional) return
var p = preq.exists().then(function(exists) { var p = preq.exists().then(function(exists) {
if (exists) console.log( preq.shellcmd + ' exists'); if (exists) console.log( preq.shellcmd + ' exists');
else { else {
// var ENV = Object.assign({}, process.env); // Shallow clone it. // var ENV = Object.assign({}, process.env); // Shallow clone it.
var WshShell = WScript.CreateObject("WScript.Shell") var WshShell = WScript.CreateObject("WScript.Shell")
var ENV = WshShell.Environment("Process") var ENV = WshShell.Environment("Process")
WScript.echo( ENV("Path") )
// WScript.echo( ENV("Path") )
function sysAddPathVar(path){ function sysAddPathVar(path){

return true; // PB : TODO -- Not yet enabled. Remove sys path from path before saving.
// Object.assign({ // Object.assign({
// inherit: true, shell: true, env: ENV, title: `${command} ${args}` // inherit: true, shell: true, env: ENV, title: `${command} ${args}`
// }, options) // }, options)
} }
, { , {
shellcmd: 'python2' shellcmd: 'python2'
, optional : true
, url: 'https://www.python.org/ftp/python/2.7.18/python-2.7.18.amd64.msi' , url: 'https://www.python.org/ftp/python/2.7.18/python-2.7.18.amd64.msi'
, installer: 'python-2.7.18.amd64.msi' , installer: 'python-2.7.18.amd64.msi'
, installcmd: ['MSIEXEC.exe', ['/i' , installcmd: ['MSIEXEC.exe', ['/i'
, postinstallsteps : function() { return sysAddPathVar('%USERPROFILE%\\AppData/Local\\Microsoft\\WindowsApps') } , postinstallsteps : function() { return sysAddPathVar('%USERPROFILE%\\AppData/Local\\Microsoft\\WindowsApps') }
, exists : exists , exists : exists
} }
,
{
, {
shellcmd: 'code'
, optional : true
, url: 'https://vscode-update.azurewebsites.net/latest/win32-x64/stable'
, installer: 'vscode-win32-x64-latest-stable.exe'
, installcmd: ['cmd', ['/c', 'start',
'/WAIT', downloadsdir + '/' + 'Git-2.33.0.2-64-bit.exe'
, '/VERYSILENT'
// , '/MERGETASKS=!runcode' // This is required only for vscode...
]]
, 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'
, installcmd: [ isWin() ? 'npm.cmd' : 'npm' , ['link'], { cwd : selectedinstance.root + '\\elxr' /* cwd should be the cloned dir*/}] , installcmd: [ isWin() ? 'npm.cmd' : 'npm' , ['link'], { cwd : selectedinstance.root + '\\elxr' /* cwd should be the cloned dir*/}]
, preinstallsteps: function() { , preinstallsteps: function() {

Loading…
Cancel
Save