mirror of https://github.com/embarklabs/embark.git
add config to the plugin api (temporary)
This commit is contained in:
parent
8325943bd7
commit
007be84f23
|
@ -36,7 +36,7 @@ Config.prototype.loadConfigFiles = function(options) {
|
||||||
this.embarkConfig = fs.readJSONSync(options.embarkConfig);
|
this.embarkConfig = fs.readJSONSync(options.embarkConfig);
|
||||||
this.embarkConfig.plugins = this.embarkConfig.plugins || {};
|
this.embarkConfig.plugins = this.embarkConfig.plugins || {};
|
||||||
|
|
||||||
this.plugins = new Plugins({plugins: this.embarkConfig.plugins, logger: this.logger, interceptLogs: interceptLogs, events: this.events});
|
this.plugins = new Plugins({plugins: this.embarkConfig.plugins, logger: this.logger, interceptLogs: interceptLogs, events: this.events, config: this});
|
||||||
this.plugins.loadPlugins();
|
this.plugins.loadPlugins();
|
||||||
|
|
||||||
this.loadEmbarkConfigFile();
|
this.loadEmbarkConfigFile();
|
||||||
|
|
|
@ -20,6 +20,7 @@ var Plugin = function(options) {
|
||||||
this.pluginTypes = [];
|
this.pluginTypes = [];
|
||||||
this.logger = options.logger;
|
this.logger = options.logger;
|
||||||
this.events = options.events;
|
this.events = options.events;
|
||||||
|
this.config = options.config;
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.loadPlugin = function() {
|
Plugin.prototype.loadPlugin = function() {
|
||||||
|
|
|
@ -8,6 +8,7 @@ var Plugins = function(options) {
|
||||||
// TODO: need backup 'NullLogger'
|
// TODO: need backup 'NullLogger'
|
||||||
this.logger = options.logger;
|
this.logger = options.logger;
|
||||||
this.events = options.events;
|
this.events = options.events;
|
||||||
|
this.config = options.config;
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugins.prototype.loadPlugins = function() {
|
Plugins.prototype.loadPlugins = function() {
|
||||||
|
@ -30,7 +31,7 @@ Plugins.prototype.loadPlugin = function(pluginName, pluginConfig) {
|
||||||
var pluginPath = utils.joinPath(process.env.PWD, 'node_modules', pluginName);
|
var pluginPath = utils.joinPath(process.env.PWD, 'node_modules', pluginName);
|
||||||
var plugin = require(pluginPath);
|
var plugin = require(pluginPath);
|
||||||
|
|
||||||
var pluginWrapper = new Plugin({name: pluginName, pluginModule: plugin, pluginConfig: pluginConfig, logger: this.logger, pluginPath: pluginPath, interceptLogs: this.interceptLogs, events: this.events});
|
var pluginWrapper = new Plugin({name: pluginName, pluginModule: plugin, pluginConfig: pluginConfig, logger: this.logger, pluginPath: pluginPath, interceptLogs: this.interceptLogs, events: this.events, config: this.config});
|
||||||
pluginWrapper.loadPlugin();
|
pluginWrapper.loadPlugin();
|
||||||
this.plugins.push(pluginWrapper);
|
this.plugins.push(pluginWrapper);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue