bin-wrapper
Advanced tools
Comparing version 0.3.2 to 0.3.3
26
index.js
@@ -81,3 +81,11 @@ 'use strict'; | ||
this._use = path.join(this.dest(), str); | ||
var opts = { path: this.dest(), global: this.global, exclude: 'node_modules/.bin' }; | ||
var bin = find(str, opts); | ||
if (bin && bin.length > 0) { | ||
this._use = bin[0]; | ||
} else { | ||
this._use = path.join(this.dest(), str); | ||
} | ||
return this; | ||
@@ -99,3 +107,3 @@ }; | ||
this.parse(this.src()); | ||
this.test(cmd, function (err, bin) { | ||
this.test(cmd, function (err) { | ||
if (err) { | ||
@@ -117,4 +125,2 @@ return download(self.src(), self.dest(), { mode: '0755' }) | ||
self.dest(path.dirname(bin)); | ||
self.use(path.basename(bin)); | ||
cb(); | ||
@@ -133,8 +139,6 @@ }); | ||
BinWrapper.prototype.test = function (cmd, cb) { | ||
var opts = { path: this.dest(), global: this.global, exclude: 'node_modules/.bin' }; | ||
var bin = find(path.basename(this.use()), opts) || []; | ||
var self = this; | ||
if (bin.length > 0) { | ||
return binCheck(bin[0], cmd, function (err, works) { | ||
if (this.use()) { | ||
return binCheck(self.use(), cmd, function (err, works) { | ||
if (err) { | ||
@@ -149,5 +153,5 @@ return cb(err); | ||
if (self.opts.version) { | ||
return binCheck(bin[0], ['--version'], function (err, works, msg) { | ||
return binCheck(self.use(), ['--version'], function (err, works, msg) { | ||
if (msg.indexOf(self.opts.version) !== -1) { | ||
return cb(null, bin[0]); | ||
return cb(null, self.use()); | ||
} | ||
@@ -159,3 +163,3 @@ | ||
cb(null, bin[0]); | ||
cb(null, self.use()); | ||
}); | ||
@@ -162,0 +166,0 @@ } |
{ | ||
"name": "bin-wrapper", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Binary wrapper that makes your programs seamlessly available as local dependencies", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
157
6347