From 1b692db9415f99ddd43d95f30ea3f05e7c28789b Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Fri, 22 Nov 2013 14:55:01 +0100 Subject: [PATCH 1/2] look for modules in config.paths.modules --- lib/timodule.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/timodule.js b/lib/timodule.js index 40f04c5f..46178595 100644 --- a/lib/timodule.js +++ b/lib/timodule.js @@ -60,7 +60,7 @@ exports.scopedDetect = function scopedDetect(searchPaths, config, logger, callba * @param {Object} logger - A logger instance * @param {Function} callback - A function to call when done */ -exports.detect = function detect(searchPaths, logger, callback, bypassCache) { +exports.detect = function detect(searchPaths, config, logger, callback, bypassCache) { if (moduleCache && !bypassCache) { return callback(moduleCache); } @@ -85,12 +85,19 @@ exports.detect = function detect(searchPaths, logger, callback, bypassCache) { project: function (next) { detectModules(searchPaths.map(function (p) { return path.join(p, 'modules'); - }), null, logger, next); + }), config, logger, next); + }, + user: function (next) { + if (config.paths && Array.isArray(config.paths.modules)) { + detectModules(config.paths.modules, config, logger, next); + } else { + next(); + } }, global: function (next) { detectModules(sdkPaths.map(function (p) { return path.join(p, 'modules'); - }), null, logger, next); + }), config, logger, next); } }, function (err, results) { callback(moduleCache = results); @@ -110,7 +117,7 @@ exports.detect = function detect(searchPaths, logger, callback, bypassCache) { * @param {Object} logger - A logger instance * @param {Function} callback - A function to call when done */ -exports.find = function find(modules, platforms, deployType, sdkVersion, searchPaths, logger, callback) { +exports.find = function find(modules, platforms, deployType, sdkVersion, searchPaths, config, logger, callback) { var result = { found: [], missing: [], @@ -126,7 +133,7 @@ exports.find = function find(modules, platforms, deployType, sdkVersion, searchP Array.isArray(platforms) || (platforms = [platforms]); platforms.push('commonjs'); // add commonjs to the list of valid module platforms - exports.detect(searchPaths, logger, function (installed) { + exports.detect(searchPaths, config, logger, function (installed) { modules.forEach(function (module) { var originalVersion = module.version || 'latest', scopes = ['project', 'global'], From 78ad1795b0d85aa28d2e601c34e3fd36c4f6eafc Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Fri, 22 Nov 2013 15:00:03 +0100 Subject: [PATCH 2/2] missing scope --- lib/timodule.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/timodule.js b/lib/timodule.js index 46178595..a82c062f 100644 --- a/lib/timodule.js +++ b/lib/timodule.js @@ -136,7 +136,7 @@ exports.find = function find(modules, platforms, deployType, sdkVersion, searchP exports.detect(searchPaths, config, logger, function (installed) { modules.forEach(function (module) { var originalVersion = module.version || 'latest', - scopes = ['project', 'global'], + scopes = ['project', 'user', 'global'], i, j, scope, info, platform, found, ver, tmp; // make sure the module has a valid array of platforms