Look for plugins relative to decktape.js script

Otherwise you have to run it from the installation directory.
This commit is contained in:
Rick Lupton 2015-07-15 12:44:05 +01:00 committed by astefanutti
parent 513cf2c8e2
commit 7aa0fb0cff

View File

@ -12,7 +12,7 @@ var process = {
}
};
var plugins = loadAvailablePlugins();
var plugins = loadAvailablePlugins(phantom.libraryPath + "/plugins/");
var parser = require("./libs/nomnom")
.nocolors()
@ -111,11 +111,11 @@ page.open(options.url, function(status) {
}
});
function loadAvailablePlugins() {
return fs.list("plugins/").reduce(function(plugins, plugin) {
function loadAvailablePlugins(pluginPath) {
return fs.list(pluginPath).reduce(function(plugins, plugin) {
var matches = plugin.match(/^(.*)\.js$/);
if (matches && fs.isFile("plugins/" + plugin))
plugins[matches[1]] = require("./plugins/" + matches[1]);
if (matches && fs.isFile(pluginPath + plugin))
plugins[matches[1]] = require(pluginPath + matches[1]);
return plugins;
}, {});
}