Comparing version 2.1.1 to 2.1.2
66
index.js
'use strict'; | ||
var fs = require('fs'); | ||
var archiveType = require('archive-type'); | ||
@@ -7,4 +8,3 @@ var execSeries = require('exec-series'); | ||
var Download = require('download'); | ||
var read = require('fs').readFile; | ||
var rm = require('rimraf'); | ||
var rimraf = require('rimraf'); | ||
var tempfile = require('tempfile'); | ||
@@ -27,6 +27,7 @@ var urlRegex = require('url-regex'); | ||
this.opts.strip = this.opts.strip <= 0 ? 0 : !this.opts.strip ? 1 : this.opts.strip; | ||
this._cmd = []; | ||
this._tmp = tempfile(); | ||
this.tmp = tempfile(); | ||
} | ||
module.exports = BinBuild; | ||
/** | ||
@@ -60,3 +61,5 @@ * Define the source archive to download | ||
this._cmd = this._cmd || []; | ||
this._cmd.push(str); | ||
return this; | ||
@@ -74,6 +77,5 @@ }; | ||
cb = cb || function () {}; | ||
var self = this; | ||
if (urlRegex().test(this.src())) { | ||
return this.get(function (err) { | ||
return this.download(function (err) { | ||
if (err) { | ||
@@ -84,7 +86,7 @@ cb(err); | ||
self.exec(self._tmp, cb); | ||
}); | ||
this.exec(this.tmp, cb); | ||
}.bind(this)); | ||
} | ||
read(this.src(), function (err, data) { | ||
fs.readFile(this.src(), function (err, data) { | ||
if (err && err.code !== 'EISDIR') { | ||
@@ -96,3 +98,3 @@ cb(err); | ||
if (archiveType(data)) { | ||
return self.decompress(function (err) { | ||
return this.extract(function (err) { | ||
if (err) { | ||
@@ -103,8 +105,8 @@ cb(err); | ||
self.exec(self._tmp, cb); | ||
}); | ||
this.exec(this.tmp, cb); | ||
}.bind(this)); | ||
} | ||
self.exec(self.src(), cb); | ||
}); | ||
this.exec(this.src(), cb); | ||
}.bind(this)); | ||
}; | ||
@@ -121,7 +123,5 @@ | ||
BinBuild.prototype.exec = function (cwd, cb) { | ||
var self = this; | ||
execSeries(this.cmd(), { cwd: cwd }, function (err) { | ||
execSeries(this.cmd(), {cwd: cwd}, function (err) { | ||
if (err) { | ||
err.message = [self.cmd().join(' && '), err.message].join('\n'); | ||
err.message = [this.cmd().join(' && '), err.message].join('\n'); | ||
cb(err); | ||
@@ -131,4 +131,4 @@ return; | ||
rm(self._tmp, cb); | ||
}); | ||
rimraf(this.tmp, cb); | ||
}.bind(this)); | ||
}; | ||
@@ -143,3 +143,3 @@ | ||
BinBuild.prototype.decompress = function (cb) { | ||
BinBuild.prototype.extract = function (cb) { | ||
var decompress = new Decompress({ | ||
@@ -150,9 +150,10 @@ mode: '777', | ||
decompress.src(this.src()); | ||
decompress.dest(this._tmp); | ||
decompress.run(cb); | ||
decompress | ||
.src(this.src()) | ||
.dest(this.tmp) | ||
.run(cb); | ||
}; | ||
/** | ||
* Download source | ||
* Download source file | ||
* | ||
@@ -163,3 +164,3 @@ * @param {Function} cb | ||
BinBuild.prototype.get = function (cb) { | ||
BinBuild.prototype.download = function (cb) { | ||
var download = new Download({ | ||
@@ -171,11 +172,6 @@ strip: this.opts.strip, | ||
download.get(this.src()); | ||
download.dest(this._tmp); | ||
download.run(cb); | ||
download | ||
.get(this.src()) | ||
.dest(this.tmp) | ||
.run(cb); | ||
}; | ||
/** | ||
* Module exports | ||
*/ | ||
module.exports = BinBuild; |
{ | ||
"name": "bin-build", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Easily build binaries", | ||
@@ -29,3 +29,3 @@ "license": "MIT", | ||
"decompress": "^2.1.1", | ||
"download": "^3.1.0", | ||
"download": "^4.1.2", | ||
"exec-series": "^1.0.0", | ||
@@ -38,4 +38,4 @@ "rimraf": "^2.2.6", | ||
"ava": "^0.0.4", | ||
"nock": "^0.56.0" | ||
"nock": "^2.6.0" | ||
} | ||
} |
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
5609
4
70
135
+ Addedansi-gray@0.1.1(transitive)
+ Addedansi-wrap@0.1.0(transitive)
+ Addedarchive-type@3.2.0(transitive)
+ Addedarr-diff@2.0.0(transitive)
+ Addedarr-flatten@1.1.0(transitive)
+ Addedarray-differ@1.0.0(transitive)
+ Addedarray-uniq@1.0.3(transitive)
+ Addedarray-unique@0.2.1(transitive)
+ Addedbeeper@1.1.1(transitive)
+ Addedbraces@1.8.5(transitive)
+ Addedcapture-stack-trace@1.0.2(transitive)
+ Addedcaw@1.2.0(transitive)
+ Addedcolor-support@1.1.3(transitive)
+ Addedconvert-source-map@1.9.0(transitive)
+ Addedcreate-error-class@3.0.2(transitive)
+ Addeddateformat@2.2.0(transitive)
+ Addeddecompress@3.0.0(transitive)
+ Addeddeep-extend@0.6.0(transitive)
+ Addeddownload@4.4.3(transitive)
+ Addedduplexer2@0.0.2(transitive)
+ Addedexpand-brackets@0.1.5(transitive)
+ Addedexpand-range@1.8.2(transitive)
+ Addedextend-shallow@2.0.1(transitive)
+ Addedextglob@0.3.2(transitive)
+ Addedfancy-log@1.3.3(transitive)
+ Addedfilename-regex@2.0.1(transitive)
+ Addedfilename-reserved-regex@1.0.0(transitive)
+ Addedfilenamify@1.2.1(transitive)
+ Addedfill-range@2.2.4(transitive)
+ Addedfor-in@1.0.2(transitive)
+ Addedfor-own@0.1.5(transitive)
+ Addedget-proxy@1.1.0(transitive)
+ Addedglob@5.0.15(transitive)
+ Addedglob-base@0.3.0(transitive)
+ Addedglob-parent@2.0.03.1.0(transitive)
+ Addedglob-stream@5.3.5(transitive)
+ Addedglogg@1.0.2(transitive)
+ Addedgot@5.7.1(transitive)
+ Addedgulp-decompress@1.2.0(transitive)
+ Addedgulp-sourcemaps@1.6.0(transitive)
+ Addedgulp-util@3.0.8(transitive)
+ Addedgulplog@1.0.0(transitive)
+ Addedhas-gulplog@0.1.0(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedis-dotfile@1.0.3(transitive)
+ Addedis-equal-shallow@0.1.3(transitive)
+ Addedis-extendable@0.1.1(transitive)
+ Addedis-extglob@1.0.02.1.1(transitive)
+ Addedis-glob@2.0.13.1.0(transitive)
+ Addedis-number@2.1.04.0.0(transitive)
+ Addedis-obj@1.0.1(transitive)
+ Addedis-posix-bracket@0.1.1(transitive)
+ Addedis-primitive@2.0.0(transitive)
+ Addedis-redirect@1.0.0(transitive)
+ Addedis-retry-allowed@1.2.0(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedis-url@1.2.4(transitive)
+ Addedis-valid-glob@0.3.0(transitive)
+ Addedisobject@2.1.0(transitive)
+ Addedkind-of@3.2.26.0.3(transitive)
+ Addedlazystream@1.0.1(transitive)
+ Addedlodash._basecopy@3.0.1(transitive)
+ Addedlodash._basetostring@3.0.1(transitive)
+ Addedlodash._basevalues@3.0.0(transitive)
+ Addedlodash._getnative@3.9.1(transitive)
+ Addedlodash._isiterateecall@3.0.9(transitive)
+ Addedlodash._reescape@3.0.0(transitive)
+ Addedlodash._reevaluate@3.0.0(transitive)
+ Addedlodash._reinterpolate@3.0.0(transitive)
+ Addedlodash._root@3.0.1(transitive)
+ Addedlodash.escape@3.2.0(transitive)
+ Addedlodash.isarguments@3.1.0(transitive)
+ Addedlodash.isarray@3.0.4(transitive)
+ Addedlodash.isequal@4.5.0(transitive)
+ Addedlodash.keys@3.1.2(transitive)
+ Addedlodash.restparam@3.6.1(transitive)
+ Addedlodash.template@3.6.2(transitive)
+ Addedlodash.templatesettings@3.1.1(transitive)
+ Addedlowercase-keys@1.0.1(transitive)
+ Addedmath-random@1.0.4(transitive)
+ Addedmerge-stream@1.0.1(transitive)
+ Addedmicromatch@2.3.11(transitive)
+ Addedmultipipe@0.1.2(transitive)
+ Addednode-status-codes@1.0.0(transitive)
+ Addednormalize-path@2.1.1(transitive)
+ Addedobject-assign@3.0.0(transitive)
+ Addedobject.omit@2.0.1(transitive)
+ Addedordered-read-streams@0.3.0(transitive)
+ Addedparse-glob@3.0.4(transitive)
+ Addedparse-node-version@1.0.1(transitive)
+ Addedpath-dirname@1.0.2(transitive)
+ Addedprepend-http@1.0.4(transitive)
+ Addedpreserve@0.2.0(transitive)
+ Addedrandomatic@3.1.1(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedregex-cache@0.4.4(transitive)
+ Addedremove-trailing-separator@1.1.0(transitive)
+ Addedrepeat-element@1.1.4(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedsparkles@1.0.1(transitive)
+ Addedstrip-bom-stream@1.0.0(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedstrip-outer@1.0.1(transitive)
+ Addedthrough2-filter@2.0.0(transitive)
+ Addedtime-stamp@1.1.0(transitive)
+ Addedtimed-out@3.1.3(transitive)
+ Addedto-absolute-glob@0.1.1(transitive)
+ Addedtrim-repeated@1.0.0(transitive)
+ Addedtunnel-agent@0.4.3(transitive)
+ Addedunzip-response@1.0.2(transitive)
+ Addedurl-parse-lax@1.0.0(transitive)
+ Addedvali-date@1.0.0(transitive)
+ Addedvinyl@0.5.3(transitive)
+ Addedvinyl-fs@2.4.4(transitive)
- Removedajv@6.12.6(transitive)
- Removedansi-regex@0.2.1(transitive)
- Removedansi-styles@1.1.0(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedbl@0.9.5(transitive)
- Removedcamelcase@1.2.1(transitive)
- Removedcamelcase-keys@1.0.0(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedchalk@0.5.1(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddecompress-tar@2.0.2(transitive)
- Removeddecompress-tarbz2@2.0.2(transitive)
- Removeddecompress-targz@2.1.0(transitive)
- Removeddecompress-unzip@2.1.2(transitive)
- Removeddeep-extend@0.2.11(transitive)
- Removeddefaults@1.0.4(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddownload@3.3.0(transitive)
- Removeddownload-status@2.2.1(transitive)
- Removedduplexer@0.1.2(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedget-stdin@3.0.2(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedglob-stream@3.1.18(transitive)
- Removedglob-watcher@0.0.6(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhas-ansi@0.1.0(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedindent-string@1.2.2(transitive)
- Removedis-integer@1.0.7(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlongest@1.0.1(transitive)
- Removedlpad-align@1.1.2(transitive)
- Removedmeow@2.1.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedminimist@0.0.10(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedprogress@1.1.8(transitive)
- Removedpsl@1.9.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrc@0.5.5(transitive)
- Removedrepeating@1.1.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstream-combiner@0.2.2(transitive)
- Removedstrip-ansi@0.3.0(transitive)
- Removedstrip-dirs@0.1.1(transitive)
- Removedstrip-json-comments@0.1.3(transitive)
- Removedsupports-color@0.2.0(transitive)
- Removedtar-stream@0.4.7(transitive)
- Removedthrough@2.3.8(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removedunique-stream@1.0.0(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
- Removedvinyl-fs@0.3.14(transitive)
Updateddownload@^4.1.2