mirror of
https://gitlab.silvrtree.co.uk/martind2000/rss-braider.git
synced 2025-02-11 05:39:15 +00:00
WIP Plugins Dir
This commit is contained in:
parent
76772ddded
commit
bfadf61cc9
@ -15,7 +15,7 @@ var RssBraider = function (options) {
|
|||||||
this.indent = options.indent || " ";
|
this.indent = options.indent || " ";
|
||||||
this.dedupe_fields = options.dedupe_fields || []; // The fields to use to identify duplicate articles
|
this.dedupe_fields = options.dedupe_fields || []; // The fields to use to identify duplicate articles
|
||||||
this.date_sort_order = options.date_sort_order || "desc";
|
this.date_sort_order = options.date_sort_order || "desc";
|
||||||
|
this.plugins_directories = options.plugins_directories || [];
|
||||||
// load plugins from plugins folder
|
// load plugins from plugins folder
|
||||||
// TODO, specify plugins location
|
// TODO, specify plugins location
|
||||||
this.plugins = {};
|
this.plugins = {};
|
||||||
@ -25,16 +25,21 @@ var RssBraider = function (options) {
|
|||||||
|
|
||||||
// loadup self.plugins with the plugin functions
|
// loadup self.plugins with the plugin functions
|
||||||
RssBraider.prototype.loadPlugins = function () {
|
RssBraider.prototype.loadPlugins = function () {
|
||||||
var self = this,
|
var self = this;
|
||||||
path = __dirname + '/plugins',
|
|
||||||
filenames = fs.readdirSync(path);
|
|
||||||
|
|
||||||
// load up each file and assign it to the plugins
|
if (self.plugins_directories.length < 1) {
|
||||||
filenames.forEach(function(filename){
|
logger.info("No plugins_directories specified. No plugins loaded.");
|
||||||
var plugin_name = filename.replace(/.js$/, '');
|
}
|
||||||
self.plugins[plugin_name] = require(path + '/' + plugin_name);
|
|
||||||
// logger.info("plugin loaded:", plugin_name);
|
self.plugins_directories.forEach(function(dir){
|
||||||
|
// load up each file and assign it to the plugins
|
||||||
|
filenames.forEach(function(filename){
|
||||||
|
var plugin_name = filename.replace(/.js$/, '');
|
||||||
|
self.plugins[plugin_name] = require(path + '/' + plugin_name);
|
||||||
|
// logger.info("plugin loaded:", plugin_name);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
RssBraider.prototype.feedExists = function (feed_name) {
|
RssBraider.prototype.feedExists = function (feed_name) {
|
||||||
|
Loading…
Reference in New Issue
Block a user