Deployd/Deployd — Issue #3: Plugin Loading
Author: ritch
Created: 2011-12-09 00:52:49+00:00
State: open

For alpha, plugins (aka node modules) are loaded only if they exist in the plugins directory.

**boot.js line 14**

// load plugins
plugins.forEach(function(fd) {
path = __dirname + '/plugins/' + fd;
if(fs.statSync(path).isDirectory()) {
lib[fd] = require(path);
}
});

This needs to dynamically load plugin's via a user's package.json. Package.json is only really meant for meeting dependencies though. So we need to go one step beyond this. Merely doing a `npm install` will install the dependencies but will obviously not load them.

The plugin loader should also take into account a mechanism to expose the deployd lib. Plugins should have access to `app`, `Model` and `db`. This could be exposed by a global lib object, but that would be counter-intuitive for node developers. Instead we need to do something like symlink the /lib folder into /lib/plugins/node_modules folder.