emit contractsDeployed event only

This commit is contained in:
Iuri Matias 2018-05-30 06:56:51 -04:00
parent 68e6782f49
commit 1d782c0e53
2 changed files with 4 additions and 8 deletions

View File

@ -1,9 +1,5 @@
let async = require('async'); let async = require('async');
// TODO: remove contractsManager dependency
// * use events
// * in the engine use the instance instead
class DeployManager { class DeployManager {
constructor(options) { constructor(options) {
const self = this; const self = this;
@ -76,7 +72,7 @@ class DeployManager {
// TODO: shouldn't be necessary // TODO: shouldn't be necessary
function checkCompileOnly(callback){ function checkCompileOnly(callback){
if(self.onlyCompile){ if(self.onlyCompile){
self.events.emit('contractsDeployed', self.contractsManager); self.events.emit('contractsDeployed');
return done(); return done();
} }
return callback(); return callback();
@ -101,7 +97,7 @@ class DeployManager {
function deployAllContracts(callback) { function deployAllContracts(callback) {
self.deployAll(function (err) { self.deployAll(function (err) {
if (!err) { if (!err) {
self.events.emit('contractsDeployed', self.contractsManager); self.events.emit('contractsDeployed');
} }
if (err && self.fatalErrors) { if (err && self.fatalErrors) {
return callback(err); return callback(err);

View File

@ -189,8 +189,8 @@ class Engine {
generateCode(tasks[tasks.length - 1].contractsManager); generateCode(tasks[tasks.length - 1].contractsManager);
self.events.once('outputDone', callback); self.events.once('outputDone', callback);
}); });
const addToCargo = function (contractsManager) { const addToCargo = function () {
cargo.push({contractsManager}); cargo.push({contractsManager: self.contractsManager});
}; };
this.events.on('contractsDeployed', addToCargo); this.events.on('contractsDeployed', addToCargo);