diff --git a/bin/slush.js b/bin/slush.js index 2cfcb48..1b1a538 100755 --- a/bin/slush.js +++ b/bin/slush.js @@ -177,25 +177,30 @@ function getModulesPaths () { if (process.env.NODE_ENV === 'test') { return [path.join(__dirname, '..', 'test')]; } + var sep = (process.platform === 'win32') ? ';' : ':'; var paths = []; - if (process.platform === 'win32') { - paths.push(path.join(process.env.APPDATA, 'npm', 'node_modules')); + + if (process.env.NODE_PATH) { + paths = paths.concat(process.env.NODE_PATH.split(sep)); } else { - paths.push('/usr/lib/node_modules'); + if (process.platform === 'win32') { + paths.push(path.join(process.env.APPDATA, 'npm', 'node_modules')); + } else { + paths.push('/usr/lib/node_modules'); + } } + paths.push(path.join(__dirname, '..', '..')); paths.push.apply(paths, require.main.paths); - return paths.map(function(path){ - return path.toLowerCase(); - }).filter(function(path, index, all){ + return paths.filter(function(path, index, all){ return all.lastIndexOf(path) === index; }); } function findGenerators (searchpaths) { return searchpaths.reduce(function (arr, searchpath) { - return arr.concat(glob.sync('slush-*', {cwd: searchpath, stat: true}).map(function (match) { - var generator = {path: path.join(searchpath, match), name: match.slice(6), pkg: {}}; + return arr.concat(glob.sync('{@*/,}slush-*', {cwd: searchpath, stat: true}).map(function (match) { + var generator = {path: path.join(searchpath, match), name: match.replace(/(?:@[\w]+[\/|\\]+)?slush-/, ""), pkg: {}}; try { generator.pkg = require(path.join(searchpath, match, 'package.json')); } catch (e) { diff --git a/test/slush.js b/test/slush.js index 320b3e4..c9a6a5f 100644 --- a/test/slush.js +++ b/test/slush.js @@ -25,8 +25,8 @@ describe('slush', function () { }); slush.on('close', function (code) { code.should.equal(0); - data.should.match(/\[gulp\] ├── default/); - data.should.match(/\[gulp\] └── app/); + data.should.match(/├── default/); + data.should.match(/└── app/); done(); }); });