Skip to content

Commit

Permalink
Update master
Browse files Browse the repository at this point in the history
  • Loading branch information
diervo committed Jun 18, 2012
1 parent a648982 commit bafe736
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions lib/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,20 @@ Registry.prototype = {
if (options.tasks) {
this._loadTasks(options.tasks);
}
if (options.npm) {
this._loadExternalNPM(options.npm);
}
},

_loadModule: function(name) {
this._loadDir(path.resolve('node_modules', name, 'lib'));
},
_loadExternalNPM: function (dir) {
dir = dir || path.join(process.cwd(),'node_modules');
var fs = require('fs'),
packages = fs.readdirSync(dir),
self = this;

packages.forEach(function (name) {
self._loadModule(name);
});
},
_loadDir: function(dirname) {
var fs = require('fs'),
files = fs.readdirSync(dirname),
self = this;

if (!path.existsSync(dirname)) {
throw new Error('Directory ' + dirname + ' doesn\'t exist');
}

var fs = require('fs'),
files = fs.readdirSync(dirname),
self = this;

files.forEach(function(filename) {
self._loadFile(path.join(dirname, filename));
Expand Down

0 comments on commit bafe736

Please sign in to comment.