Skip to content

Commit

Permalink
Fix server when runnign without plugins, fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
gnovos committed Jul 27, 2015
1 parent 6233e45 commit a233910
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions compositions/smoke/requestor.dre
Expand Up @@ -97,10 +97,10 @@ SOFTWARE. -->
assert.isUndefined(req1.success_data, 'Request did not succeed so the success method should not be called.');

assert.equal(req1.error_status, 404, 'Request to bad url should fail as a 404.');
assert.equal(req1.error_data, "NOT FOUND", 'Server response will be "NOT FOUND".');
assert.equal(req1.error_data, "FILE NOT FOUND", 'Server response will be "NOT FOUND".');

assert.equal(req1.always_status, 404, 'Request to bad url should trigger always method as a 404.');
assert.equal(req1.always_data, "NOT FOUND", 'Server response for always method will be "NOT FOUND".');
assert.equal(req1.always_data, "FILE NOT FOUND", 'Server response for always method will be "NOT FOUND".');


// Success with json (Removing \r is needed for Windows)
Expand Down
18 changes: 12 additions & 6 deletions core/pluginloader.js
Expand Up @@ -29,19 +29,25 @@ define(function(require, exports, module) {

this.__findPlugins = function() {
var pluginDirs = this.args['-plugin'];
if (!pluginDirs) {
pluginDirs = []
}
if (!Array.isArray(pluginDirs)) {
pluginDirs = [pluginDirs]
}

var errors = [];
for (var i=0;i<pluginDirs.length;i++) {
var dir = path.resolve(pluginDirs[i]);
if (fs.existsSync(dir + '/index.dre')) {
if (!define['PLUGIN']) {
define['PLUGIN'] = [];
var pdir = pluginDirs[i];
if (pdir) {
var dir = path.resolve(pdir);
if (fs.existsSync(dir + '/index.dre')) {
if (!define['PLUGIN']) {
define['PLUGIN'] = [];
}
define['PLUGIN'].push(dir + '/node_modules/');
this.__loadPlugin(dir, errors);
}
define['PLUGIN'].push(dir + '/node_modules/');
this.__loadPlugin(dir, errors);
}
}

Expand Down

0 comments on commit a233910

Please sign in to comment.