From 40e58dbcf2c0805d4f53513bc04598b906a02bbf Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 27 Jul 2018 13:57:39 -0400 Subject: [PATCH] move deployment to a module --- lib/core/engine.js | 11 +---------- lib/modules/deployment/index.js | 6 ++++++ lib/tests/run_tests.js | 2 +- lib/tests/test.js | 4 +--- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lib/core/engine.js b/lib/core/engine.js index 98da3dea..3f0acb47 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -216,16 +216,7 @@ class Engine { events: this.events }); - const DeployManager = require('../modules/deployment/index.js'); - this.deployManager = new DeployManager({ - config: this.config, - logger: this.logger, - events: this.events - }, { - blockchain: this.blockchain, - plugins: this.plugins, - onlyCompile: options.onlyCompile - }); + this.registerModule('deployment', {blockchain: this.blockchain, plugins: this.plugins, onlyCompile: options.onlyCompile}); this.events.on('file-event', function (fileType) { clearTimeout(self.fileTimeout); diff --git a/lib/modules/deployment/index.js b/lib/modules/deployment/index.js index 31db0f66..ce303bc8 100644 --- a/lib/modules/deployment/index.js +++ b/lib/modules/deployment/index.js @@ -33,6 +33,12 @@ class DeployManager { this.events.setCommandHandler('deploy:contracts', (cb) => { self.deployContracts(cb); }); + + this.events.setCommandHandler('deploy:contracts:test', (cb) => { + self.fatalErrors = true; + self.deployOnlyOnConfig = true; + self.deployContracts(cb); + }); } deployAll(done) { diff --git a/lib/tests/run_tests.js b/lib/tests/run_tests.js index d544e6ef..17db45c2 100644 --- a/lib/tests/run_tests.js +++ b/lib/tests/run_tests.js @@ -104,7 +104,7 @@ module.exports = { mocha.reporter(EmbarkSpec, { events: global.embark.engine.events, gasDetails: options.gasDetails, - gasLimit: global.embark.engine.deployManager.gasLimit + gasLimit: 6000000 }); mocha.addFile(file); diff --git a/lib/tests/test.js b/lib/tests/test.js index 6241441e..8fd82010 100644 --- a/lib/tests/test.js +++ b/lib/tests/test.js @@ -304,9 +304,7 @@ class Test { }); }, function deploy(accounts, next) { - self.engine.deployManager.fatalErrors = true; - self.engine.deployManager.deployOnlyOnConfig = true; - self.engine.events.request('deploy:contracts', () => { + self.engine.events.request('deploy:contracts:test', () => { next(null, accounts); }); },