Selaa lähdekoodia

Added vscode install

pull/9/head
guest 2 vuotta sitten
vanhempi
commit
76358c2254
1 muutettua tiedostoa jossa 60 lisäystä ja 3 poistoa
  1. 60
    3
      i.win.js

+ 60
- 3
i.win.js Näytä tiedosto

@@ -70,6 +70,32 @@ catch(e) {
scripthostName = 'wsh'
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 = {
log : function(m) { WScript.Echo(m)}
, error : function(m) {WScript.Echo(m) }
@@ -819,6 +845,7 @@ function __main( selectedinstance ){
var downloadtasks = [];
var installtasks = [];
prerequisites.forEach(function(preq) {
if(!all && preq.optional) return
var p = preq.exists().then(function(exists) {
if (exists) console.log( preq.shellcmd + ' exists');
else {
@@ -890,8 +917,10 @@ function __main( selectedinstance ){
// var ENV = Object.assign({}, process.env); // Shallow clone it.
var WshShell = WScript.CreateObject("WScript.Shell")
var ENV = WshShell.Environment("Process")
WScript.echo( ENV("Path") )
// WScript.echo( ENV("Path") )
function sysAddPathVar(path){

return true; // PB : TODO -- Not yet enabled. Remove sys path from path before saving.
// Object.assign({
// inherit: true, shell: true, env: ENV, title: `${command} ${args}`
// }, options)
@@ -1078,6 +1107,7 @@ function __main( selectedinstance ){
}
, {
shellcmd: 'python2'
, optional : true
, 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'
@@ -1101,8 +1131,35 @@ function __main( selectedinstance ){
, postinstallsteps : function() { return sysAddPathVar('%USERPROFILE%\\AppData/Local\\Microsoft\\WindowsApps') }
, 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'
, installcmd: [ isWin() ? 'npm.cmd' : 'npm' , ['link'], { cwd : selectedinstance.root + '\\elxr' /* cwd should be the cloned dir*/}]
, preinstallsteps: function() {

Loading…
Peruuta
Tallenna