cleanup module call

This commit is contained in:
Iuri Matias 2018-05-30 12:26:49 -04:00
parent 7d795fa180
commit b43a766de7
11 changed files with 33 additions and 46 deletions

View File

@ -93,7 +93,7 @@ class Engine {
}
registerModule(moduleName, options) {
this.plugins.loadInternalPlugin(moduleName, options);
this.plugins.loadInternalPlugin(moduleName, options || {});
}
startService(serviceName, _options) {
@ -149,12 +149,7 @@ class Engine {
}
namingSystem(_options) {
this.registerModule('ens', {
logger: this.logger,
events: this.events,
web3: this.blockchain.web3,
namesConfig: this.config.namesystemConfig
});
this.registerModule('ens');
}
codeRunnerService(_options) {
@ -206,22 +201,11 @@ class Engine {
compiler.compile_contracts(contractFiles, cb);
});
this.registerModule('solidity', {
contractDirectories: self.config.contractDirectories
});
this.registerModule('vyper', {
contractDirectories: self.config.contractDirectories
});
this.registerModule('profiler', {
events: this.events,
logger: this.logger
});
this.registerModule('deploytracker', {
});
this.registerModule('specialconfigs', {
});
this.registerModule('solidity');
this.registerModule('vyper');
this.registerModule('profiler');
this.registerModule('deploytracker');
this.registerModule('specialconfigs');
this.contractsManager = new ContractsManager({
contractFiles: this.config.contractsFiles,
@ -284,7 +268,6 @@ class Engine {
ipfsService(_options) {
this.registerModule('ipfs', {
addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor),
storageConfig: this.config.storageConfig,
host: _options.host,
port: _options.port
});
@ -293,7 +276,6 @@ class Engine {
swarmService(_options) {
this.registerModule('swarm', {
addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor),
storageConfig: this.config.storageConfig,
// TODO: this should not be needed and should be deducted from the config instead
// the eth provider is not necessary the same as the swarm one
bzz: this.blockchain.web3.bzz
@ -314,7 +296,6 @@ class Engine {
this.registerModule('whisper', {
addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor),
communicationConfig: this.config.communicationConfig,
// TODO: this should not be needed and should be deducted from the config instead
// the eth provider is not necessary the same as the whisper one
web3: this.blockchain.web3

View File

@ -59,7 +59,7 @@ Plugins.prototype.loadInternalPlugin = function(pluginName, pluginConfig) {
var pluginWrapper = new Plugin({
name: pluginName,
pluginModule: plugin,
pluginConfig: pluginConfig,
pluginConfig: pluginConfig || {},
logger: this.logger,
pluginPath: pluginPath,
interceptLogs: this.interceptLogs,

View File

@ -2,11 +2,10 @@ const fs = require('../../core/fs.js');
const utils = require('../../utils/utils.js');
class ENS {
constructor(embark, options) {
constructor(embark, _options) {
this.logger = embark.logger;
this.events = embark.events;
this.web3 = options.web3;
this.namesConfig = options.namesConfig;
this.namesConfig = embark.config.namesystemConfig;
this.embark = embark;
this.addENSToEmbarkJS();

View File

@ -10,7 +10,7 @@ class IPFS {
this.logger = embark.logger;
this.events = embark.events;
this.buildDir = options.buildDir;
this.storageConfig = options.storageConfig;
this.storageConfig = embark.config.storageConfig;
this.host = options.host || this.storageConfig.host;
this.port = options.port || this.storageConfig.port;
this.addCheck = options.addCheck;

View File

@ -5,7 +5,6 @@ class Profiler {
this.embark = embark;
this.logger = embark.logger;
this.events = embark.events;
this.plugins = embark.plugins;
this.registerConsoleCommand();
}

View File

@ -3,10 +3,10 @@ let SolcW = require('./solcW.js');
class Solidity {
constructor(embark, options) {
constructor(embark, _options) {
this.logger = embark.logger;
this.events = embark.events;
this.contractDirectories = options.contractDirectories;
this.contractDirectories = embark.config.contractDirectories;
this.solcAlreadyLoaded = false;
this.solcW = null;

View File

@ -8,7 +8,7 @@ class Swarm {
this.logger = embark.logger;
this.events = embark.events;
this.buildDir = options.buildDir;
this.storageConfig = options.storageConfig;
this.storageConfig = embark.config.storageConfig;
this.host = options.host || this.storageConfig.host;
this.port = options.port || this.storageConfig.port;
this.addCheck = options.addCheck;

View File

@ -4,10 +4,10 @@ const path = require('path');
class Vyper {
constructor(embark, options) {
constructor(embark, _options) {
this.logger = embark.logger;
this.events = embark.events;
this.contractDirectories = options.contractDirectories;
this.contractDirectories = embark.config.contractDirectories;
// FIXME: Use array of extensions instead of duplicatiing
embark.registerCompiler(".py", this.compile_vyper.bind(this));

View File

@ -6,7 +6,7 @@ class Whisper {
constructor(embark, options) {
this.logger = embark.logger;
this.events = embark.events;
this.communicationConfig = options.communicationConfig;
this.communicationConfig = embark.config.communicationConfig;
this.addCheck = options.addCheck;
// TODO: this should not be needed and should be deducted from the config instead
this.web3 = options.web3;

File diff suppressed because one or more lines are too long

View File

@ -26,9 +26,12 @@ describe('embark.Contracts', function() {
describe('simple', function() {
let plugins = new Plugins({
logger: new TestLogger({}),
events: TestEvents
events: TestEvents,
config: {
contractDirectories: ['app/contracts/']
}
});
plugins.loadInternalPlugin('solidity', {solcVersion: '0.4.17', contractDirectories: ['app/contracts/']});
plugins.loadInternalPlugin('solidity');
let compiler = new Compiler({plugins: plugins, logger: plugins.logger});
let events = new Events();
@ -115,9 +118,12 @@ describe('embark.Contracts', function() {
describe('config with contract instances', function() {
let plugins = new Plugins({
logger: new TestLogger({}),
events: TestEvents
events: TestEvents,
config: {
contractDirectories: ['app/contracts/']
}
});
plugins.loadInternalPlugin('solidity', {solcVersion: '0.4.17', contractDirectories: ['app/contracts/']});
plugins.loadInternalPlugin('solidity');
let compiler = new Compiler({plugins: plugins, logger: plugins.logger});
let events = new Events();