remove contracts manager dependency from deploy manager

This commit is contained in:
Iuri Matias 2018-05-30 07:01:22 -04:00
parent 1d782c0e53
commit 45f7767313
3 changed files with 9 additions and 5 deletions

View File

@ -34,6 +34,13 @@ class ContractsManager {
cb(self.getContract(contractName)); cb(self.getContract(contractName));
}); });
self.events.setCommandHandler("contracts:build", (configOnly, cb) => {
self.deployOnlyOnConfig = configOnly; // temporary, should refactor
self.build(() => {
cb();
});
});
self.events.on("deploy:contract:error", (_contract) => { self.events.on("deploy:contract:error", (_contract) => {
self.events.emit('contractsState', self.contractsState()); self.events.emit('contractsState', self.contractsState());
}); });
@ -45,6 +52,7 @@ class ContractsManager {
self.events.on("deploy:contract:undeployed", (_contract) => { self.events.on("deploy:contract:undeployed", (_contract) => {
self.events.emit('contractsState', self.contractsState()); self.events.emit('contractsState', self.contractsState());
}); });
} }
build(done) { build(done) {

View File

@ -10,7 +10,6 @@ class DeployManager {
this.events = options.events; this.events = options.events;
this.plugins = options.plugins; this.plugins = options.plugins;
this.blockchain = options.blockchain; this.blockchain = options.blockchain;
this.contractsManager = options.contractsManager;
this.gasLimit = false; this.gasLimit = false;
this.fatalErrors = false; this.fatalErrors = false;
this.deployOnlyOnConfig = false; this.deployOnlyOnConfig = false;
@ -63,8 +62,7 @@ class DeployManager {
async.waterfall([ async.waterfall([
function buildContracts(callback) { function buildContracts(callback) {
self.contractsManager.deployOnlyOnConfig = self.deployOnlyOnConfig; // temporary, should refactor self.events.request("contracts:build", self.deployOnlyOnConfig, (cb) => {
self.contractsManager.build(() => {
callback(); callback();
}); });
}, },

View File

@ -234,12 +234,10 @@ class Engine {
this.deployManager = new DeployManager({ this.deployManager = new DeployManager({
blockchain: this.blockchain, blockchain: this.blockchain,
trackContracts: options.trackContracts,
config: this.config, config: this.config,
logger: this.logger, logger: this.logger,
plugins: this.plugins, plugins: this.plugins,
events: this.events, events: this.events,
contractsManager: this.contractsManager,
onlyCompile: options.onlyCompile onlyCompile: options.onlyCompile
}); });