mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-11 14:34:40 +00:00
add command event to add a contract file; fix internal plugin Path
This commit is contained in:
parent
f9e62b9f49
commit
e0e3887aaf
@ -31,6 +31,12 @@ var Config = function(options) {
|
|||||||
self.events.setCommandHandler("config:contractsFiles", (cb) => {
|
self.events.setCommandHandler("config:contractsFiles", (cb) => {
|
||||||
cb(self.contractsFiles);
|
cb(self.contractsFiles);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
self.events.setCommandHandler("config:contractsFiles:add", (filename) => {
|
||||||
|
self.contractsFiles.push(new File({filename: filename, type: File.types.custom, path: filename, resolver: function(callback) {
|
||||||
|
callback(fs.readFileSync(filename).toString());
|
||||||
|
}}));
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Config.prototype.loadConfigFiles = function(options) {
|
Config.prototype.loadConfigFiles = function(options) {
|
||||||
@ -376,6 +382,7 @@ Config.prototype.loadFiles = function(files) {
|
|||||||
return readFiles;
|
return readFiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// NOTE: this doesn't work for internal modules
|
||||||
Config.prototype.loadPluginContractFiles = function() {
|
Config.prototype.loadPluginContractFiles = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
@ -139,6 +139,9 @@ Plugin.prototype.addFileToPipeline = function(file, intendedPath, options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.addContractFile = function(file) {
|
Plugin.prototype.addContractFile = function(file) {
|
||||||
|
if (this.isInternal) {
|
||||||
|
throw new Error("this API cannot work for internal modules. please use an event command instead: config:contractsFiles:add");
|
||||||
|
}
|
||||||
this.contractsFiles.push(file);
|
this.contractsFiles.push(file);
|
||||||
this.addPluginType('contractFiles');
|
this.addPluginType('contractFiles');
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const async = require('async');
|
const async = require('async');
|
||||||
var Plugin = require('./plugin.js');
|
var Plugin = require('./plugin.js');
|
||||||
var utils = require('../utils/utils.js');
|
var utils = require('../utils/utils.js');
|
||||||
|
var fs = require('../core/fs.js');
|
||||||
|
|
||||||
var Plugins = function(options) {
|
var Plugins = function(options) {
|
||||||
this.pluginList = options.plugins || [];
|
this.pluginList = options.plugins || [];
|
||||||
@ -61,7 +62,7 @@ Plugins.prototype.loadInternalPlugin = function(pluginName, pluginConfig) {
|
|||||||
pluginModule: plugin,
|
pluginModule: plugin,
|
||||||
pluginConfig: pluginConfig || {},
|
pluginConfig: pluginConfig || {},
|
||||||
logger: this.logger,
|
logger: this.logger,
|
||||||
pluginPath: pluginPath,
|
pluginPath: fs.embarkPath('lib/modules/' + pluginName),
|
||||||
interceptLogs: this.interceptLogs,
|
interceptLogs: this.interceptLogs,
|
||||||
events: this.events,
|
events: this.events,
|
||||||
config: this.config,
|
config: this.config,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user