openfin-launcher
Advanced tools
Comparing version 0.2.0 to 0.2.1
56
index.js
@@ -1,56 +0,16 @@ | ||
var exec = require('child_process').exec, | ||
os = require('os'), | ||
path = require('path'), | ||
rvmDownloader = require('./lib/rvm-downloader'), | ||
fs = require('fs'), | ||
_ = require('lodash'), | ||
q = require('q'), | ||
defaultOptions = { | ||
rvmPath: path.resolve('OpenFinRVM.exe'), | ||
rvmUrl: 'https://developer.openfin.co/release/rvm/latest', | ||
rvmGlobalCommand: null | ||
}, | ||
nonSupportedOSMessage = 'non windows, launcher not supported.'; | ||
var os = require('os'); | ||
var rvmDownloader = require('./lib/rvm-downloader'); | ||
var nixLauncher = require('./lib/nix-launcher'); | ||
var winLauncher = require('./lib/win-launcher'); | ||
var expandOptions = require('./lib/expand-options'); | ||
function launchOpenFin(options) { | ||
var deffered = q.defer(); | ||
//check if we are in windows. | ||
_.extend(defaultOptions, options); | ||
var isWindows = os.type().toLowerCase().indexOf('windows') !== -1; | ||
var launchOpenFin = isWindows ? winLauncher.launchOpenFin : nixLauncher.launchOpenFin; | ||
function launch() { | ||
fs.exists(defaultOptions.rvmPath, function(exists) { | ||
var executeCommand = defaultOptions.rvmGlobalCommand || defaultOptions.rvmPath; | ||
if (exists || defaultOptions.rvmGlobalCommand) { | ||
exec(executeCommand + ' --config="' + defaultOptions.configPath + '"', function callback(error) { | ||
if (error) { | ||
console.error(error); | ||
deffered.reject(error); | ||
} | ||
deffered.resolve(); | ||
}); | ||
} else { | ||
console.log('no rvm found at specified location, downloading'); | ||
//make sure the second time around we specify the local repository. | ||
defaultOptions.rvmPath = path.resolve('OpenFinRVM.exe'); | ||
rvmDownloader.download(defaultOptions.rvmUrl) | ||
.then(launch) | ||
.fail(deffered.reject); | ||
} | ||
}); | ||
} | ||
if (os.type().toLowerCase().indexOf('windows') > -1) { | ||
launch(); | ||
} else { | ||
deffered.reject(new Error(nonSupportedOSMessage)); | ||
} | ||
return deffered.promise; | ||
} | ||
module.exports = { | ||
launchOpenFin: launchOpenFin, | ||
downloadRvm: function() { | ||
var defaultOptions = expandOptions({}); | ||
return rvmDownloader.download(defaultOptions.rvmUrl); | ||
} | ||
}; |
@@ -1,8 +0,9 @@ | ||
var https = require('https'), | ||
http = require('http'), | ||
path = require('path'), | ||
unzip = require('unzip'), | ||
q = require('q'); | ||
var https = require('https'); | ||
var http = require('http'); | ||
var request = require('request'); | ||
var path = require('path'); | ||
var unzip = require('unzip'); | ||
var q = require('q'); | ||
function download(url) { | ||
function download(url, writePath) { | ||
var deffered = q.defer(), | ||
@@ -25,13 +26,7 @@ isHttps, | ||
downloadStream.get(rvmUrl, function(response) { | ||
if (response.statusCode !== 200) { | ||
onError('Download Failed'); | ||
} else { | ||
response.pipe(unzip.Extract({ | ||
path: path.resolve() | ||
})).on('close', function() { | ||
deffered.resolve(); | ||
}); | ||
} | ||
}).on('error', onError); | ||
request.get(rvmUrl).on('error', onError).pipe(unzip.Extract({ | ||
path: path.dirname(writePath) | ||
}).on('close', function() { | ||
deffered.resolve(); | ||
})); | ||
} | ||
@@ -38,0 +33,0 @@ |
{ | ||
"name": "openfin-launcher", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "OpenFin launcher", | ||
@@ -18,3 +18,4 @@ "author": "Ricardo de Pena <ricardo.depena@gmail.com>", | ||
"lodash": "^2.4.1", | ||
"q": "^1.1.2" | ||
"q": "^1.1.2", | ||
"request": "^2.69.0" | ||
}, | ||
@@ -21,0 +22,0 @@ "devDependencies": { |
@@ -13,1 +13,11 @@ /*global describe, it */ | ||
}); | ||
/* | ||
var ofl = require('./index'); | ||
ofl.launchOpenFin({configPath: 'http://local:8080/app.json'}); | ||
var ofl = require('./index'); | ||
ofl.launchOpenFin({configPath: 'http://cdn.openfin.co/demos/lightstreamer/app.json'}); | ||
*/ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13184
15
230
4
2
4
+ Addedrequest@^2.69.0
+ Addedajv@6.12.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpsl@1.13.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)