cli-eb-test
Advanced tools
Comparing version 2.12.0 to 2.13.0
@@ -6,7 +6,7 @@ const exec = require('child_process').exec | ||
const ProgressBar = require('progress') | ||
const spawnSync = require('child_process').spawnSync | ||
const UpdateCheck = require('./UpdateCheck') | ||
const url = 'http://raw.githubusercontent.com/eduardoboucas/cli/master/core/bin/dadi-macos' | ||
const Installer = function ({cachePath, targetDirectory}) { | ||
this.baseUrl = 'http://raw.githubusercontent.com/eduardoboucas/cli/master/core/bin/' | ||
this.cachePath = cachePath | ||
@@ -42,4 +42,39 @@ this.targetDirectory = targetDirectory | ||
Installer.prototype.detectPlatform = function () { | ||
const platform = process.platform | ||
if (platform !== 'linux') { | ||
return platform | ||
} | ||
const ldd = spawnSync('ldd', [ | ||
process.execPath | ||
]).stdout.toString() | ||
return /\bmusl\b/.test(ldd) ? 'alpine' : platform | ||
} | ||
Installer.prototype.getBinaryURLForPlatform = function () { | ||
switch (this.detectPlatform()) { | ||
case 'alpine': | ||
return this.baseUrl + 'dadi-alpine' | ||
case 'darwin': | ||
return this.baseUrl + 'dadi-macos' | ||
case 'linux': | ||
return this.baseUrl + 'dadi-linux' | ||
case 'win32': | ||
return this.baseUrl + 'dadi-win.exe' | ||
default: | ||
throw new Error('PLATFORM_NOT_SUPPORTED') | ||
} | ||
} | ||
Installer.prototype.install = function (newVersion) { | ||
return fetch(url, { | ||
const binaryUrl = this.getBinaryURLForPlatform() | ||
return fetch(binaryUrl, { | ||
compress: false | ||
@@ -46,0 +81,0 @@ }).then(res => { |
{ | ||
"name": "cli-eb-test", | ||
"version": "2.12.0", | ||
"version": "2.13.0", | ||
"description": "A command-line tool for installation and customisation of the DADI platform", | ||
@@ -5,0 +5,0 @@ "bin": { |
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
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
6662
201
3