Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openfin-launcher

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openfin-launcher - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

lib/expand-options.js

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'});
*/
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc