From c225d97e4b91e42341c16a345ac2f3b3fe53b040 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 8 Aug 2018 17:10:36 -0400 Subject: [PATCH] fix reload file removing plugins --- lib/constants.json | 4 ---- lib/core/config.js | 8 +++++--- lib/tests/test.js | 2 -- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/constants.json b/lib/constants.json index bedc38d22..c659b42e4 100644 --- a/lib/constants.json +++ b/lib/constants.json @@ -13,10 +13,6 @@ "reset": "reset", "any": "any" }, - "events": { - "contractFilesChanged": "contractFilesChanged", - "contractConfigChanged": "contractConfigChanged" - }, "process": { "processLaunchRequest": "process:launch-request", "processLaunchComplete": "process:launch-complete", diff --git a/lib/core/config.js b/lib/core/config.js index 1ad0c8f2c..66e3259b4 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -222,7 +222,6 @@ Config.prototype.loadContractsConfigFile = function() { const newContractsConfig = this._mergeConfig(configFilePath, configObject, this.env); if (!deepEqual(newContractsConfig, this.contractsConfig)) { - this.events.emit(constants.events.contractConfigChanged, newContractsConfig); this.contractsConfig = newContractsConfig; } }; @@ -333,8 +332,11 @@ Config.prototype.loadEmbarkConfigFile = function() { const contracts = this.embarkConfig.contracts; const newContractsFiles = this.loadFiles(contracts); if (!this.contractFiles || newContractsFiles.length !== this.contractFiles.length || !deepEqual(newContractsFiles, this.contractFiles)) { - this.events.emit(constants.events.contractFilesChanged, newContractsFiles); - this.contractsFiles = newContractsFiles; + this.contractsFiles = this.contractsFiles.concat(newContractsFiles).filter((file, index, arr) => { + return !arr.some((file2, index2) => { + return file.filename === file2.filename && index < index2; + }); + }); } // determine contract 'root' directories this.contractDirectories = contracts.map((dir) => { diff --git a/lib/tests/test.js b/lib/tests/test.js index da444e9db..ae9696e98 100644 --- a/lib/tests/test.js +++ b/lib/tests/test.js @@ -2,7 +2,6 @@ const async = require('async'); const Engine = require('../core/engine.js'); const TestLogger = require('./test_logger.js'); const Web3 = require('web3'); -const constants = require('../constants'); const Events = require('../core/events'); const AccountParser = require('../utils/accountParser'); // TODO: breaks module isolation; tests need to be refactored to use the engine and avoid this @@ -272,7 +271,6 @@ class Test { async.waterfall([ function getConfig(next) { self.engine.config.contractsConfig = {contracts: config.contracts, versions: self.versions_default}; - self.engine.events.emit(constants.events.contractConfigChanged, self.engine.config.contractsConfig); next(); }, function getAccounts(next) {