diff --git a/lib/modules/deployment/index.js b/lib/modules/deployment/index.js index 33bb6788d..ebdd97eb9 100644 --- a/lib/modules/deployment/index.js +++ b/lib/modules/deployment/index.js @@ -41,20 +41,19 @@ class DeployManager { deployAll(done) { let self = this; - async.waterfall([ - function loadTracker(next) { - self.events.request("deployTracker:load", next); - }, - function doDeployAll() { - self.events.request('contracts:dependencies', (err, contractDependencies) => { - self.events.request('contracts:list', (err, contracts) => { - if (err) { - return done(err); - } - self.logger.info(__("deploying contracts")); - self.events.emit("deploy:beforeAll"); + self.events.request('contracts:dependencies', (err, contractDependencies) => { + self.events.request('contracts:list', (err, contracts) => { + if (err) { + return done(err); + } + self.logger.info(__("deploying contracts")); + async.waterfall([ + function (next) { + self.plugins.emitAndRunActionsForEvent("deploy:beforeAll", next); + }, + function () { const contractDeploys = {}; const errors = []; contracts.forEach(contract => { @@ -100,10 +99,10 @@ class DeployManager { self.logger.error(e.message || e); done(__('Error deploying')); } - }); - }); - } - ]); + } + ]); + }); + }); } deployContracts(done) { diff --git a/lib/modules/deploytracker/index.js b/lib/modules/deploytracker/index.js index 19766cdc9..274e9f098 100644 --- a/lib/modules/deploytracker/index.js +++ b/lib/modules/deploytracker/index.js @@ -19,7 +19,7 @@ class DeployTracker { registerEvents() { const self = this; - this.events.setCommandHandler("deployTracker:load", this.setCurrentChain.bind(this)); + this.embark.registerActionForEvent("deploy:beforeAll", this.setCurrentChain.bind(this)); this.events.on("deploy:contract:deployed", (contract) => { self.trackContract(contract.className, contract.realRuntimeBytecode, contract.realArgs, contract.deployedAddress);