From ede86c924411ab7596abf126982337887c5e62cb Mon Sep 17 00:00:00 2001 From: JackyTianer Date: Mon, 11 Sep 2017 20:19:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?add=20envpath=20param=20to=20set=20sass=20?= =?UTF-8?q?=E3=80=81ruby=E3=80=81compass=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/compass.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/compass.js b/lib/compass.js index 72223a6..83c0eb0 100644 --- a/lib/compass.js +++ b/lib/compass.js @@ -22,6 +22,7 @@ var defaults = { require: false, logging: true, load_all: false, + env_path:[], project: process.cwd(), bundle_exec: false, debug: false, @@ -59,9 +60,9 @@ module.exports = function(files, opts, callback) { // check command exist if (opts.bundle_exec) { - compassExecutable = helpers.command('bundle', callback); + compassExecutable = helpers.command('bundle', opts.env_path,callback); } else { - compassExecutable = helpers.command(compassExecutable, callback); + compassExecutable = helpers.command(compassExecutable, opts.env_path, callback); } if (!compassExecutable) { From e16a1d59a856a371331e280c95eedc6c252a39f3 Mon Sep 17 00:00:00 2001 From: JackyTianer Date: Mon, 11 Sep 2017 20:35:10 +0800 Subject: [PATCH 2/3] add env_path options add env_path param to add sass/compass/ruby path --- lib/helpers.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 7c41e5c..3d00dd2 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -1,16 +1,25 @@ 'use strict'; var which = require('which').sync; +var isWindows = process.platform === 'win32' || + process.env.OSTYPE === 'cygwin' || + process.env.OSTYPE === 'msys'; +var COLON = isWindows ? ';' : ':' module.exports.isArray = function(obj) { return Object.prototype.toString.call(obj) === '[object Array]'; }; -module.exports.command = function(cmd, callback) { +module.exports.command = function(cmd, env_path,callback) { var command; - + var opt; + if(env_path.length>0){ + opt = { + path:env_path.join(COLON) + } + } try { - command = which(cmd); + command = which(cmd, opt); } catch (err) { if (callback) { From f2104c1f16589f0afc8b05c344aa53ccc43007bf Mon Sep 17 00:00:00 2001 From: JackyTianer Date: Wed, 13 Sep 2017 10:11:51 +0800 Subject: [PATCH 3/3] for jslint --- lib/helpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 3d00dd2..665a7b5 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -4,7 +4,7 @@ var which = require('which').sync; var isWindows = process.platform === 'win32' || process.env.OSTYPE === 'cygwin' || process.env.OSTYPE === 'msys'; -var COLON = isWindows ? ';' : ':' +var COLON = isWindows ? ';' : ':'; module.exports.isArray = function(obj) { return Object.prototype.toString.call(obj) === '[object Array]'; @@ -16,7 +16,7 @@ module.exports.command = function(cmd, env_path,callback) { if(env_path.length>0){ opt = { path:env_path.join(COLON) - } + }; } try { command = which(cmd, opt);