Permalink
Browse files

corrected the plugin loading mechanism

  • Loading branch information...
Geoff Flarity
Geoff Flarity committed Jul 13, 2012
1 parent f8e9209 commit bf1f7342afbdf460970935e61abda14d8ef947fe
Showing with 10 additions and 17 deletions.
  1. +10 −17 lib/response.js
View
@@ -3,8 +3,6 @@ var path = require('path');
var graphite = require('./graphite');
var EventEmitter2 = require('eventemitter2').EventEmitter2;
-
-
var Response = function( config ) {
/*process.on('uncaughtException', function (err) {
@@ -13,7 +11,6 @@ var Response = function( config ) {
process.exit(1);
});*/
-
var that = this;
//create response dispatcher, plugins can communicate through this
@@ -53,24 +50,20 @@ Response.prototype.load_plugins = function () {
var that = this;
- var full_plugins_path = path.join( this.plugin_path, 'node_modules' );
-
-
+ var full_plugins_path = path.dirname( require.resolve( '../plugins/.keep' ) );
+
fs.readdir( full_plugins_path, function( err, entries ) {
var dirs = [];
entries = entries || [];
- debugger;
- entries.forEach( function( entry ) {
-
- var plugin = full_plugins_path + '/' + entry;
- fs.stat( plugin, function( err, stats ) {
- if ( stats.isDirectory() ) {
-
- require( plugin )( that.graphite_emitter, that.dispatch_emitter );
- }
- } );
- } );
+ entries.forEach( function( entry ) {
+ var plugin = full_plugins_path + '/' + entry;
+ fs.stat( plugin, function( err, stats ) {
+ if ( stats.isDirectory() ) {
+ require( plugin )( that.graphite_emitter, that.dispatch_emitter );
+ }
+ } );
+ } );
}

0 comments on commit bf1f734

Please sign in to comment.