move deployment to a module

This commit is contained in:
Iuri Matias 2018-07-27 13:57:39 -04:00
parent f9321776b1
commit 40e58dbcf2
4 changed files with 9 additions and 14 deletions

View File

@ -216,16 +216,7 @@ class Engine {
events: this.events events: this.events
}); });
const DeployManager = require('../modules/deployment/index.js'); this.registerModule('deployment', {blockchain: this.blockchain, plugins: this.plugins, onlyCompile: options.onlyCompile});
this.deployManager = new DeployManager({
config: this.config,
logger: this.logger,
events: this.events
}, {
blockchain: this.blockchain,
plugins: this.plugins,
onlyCompile: options.onlyCompile
});
this.events.on('file-event', function (fileType) { this.events.on('file-event', function (fileType) {
clearTimeout(self.fileTimeout); clearTimeout(self.fileTimeout);

View File

@ -33,6 +33,12 @@ class DeployManager {
this.events.setCommandHandler('deploy:contracts', (cb) => { this.events.setCommandHandler('deploy:contracts', (cb) => {
self.deployContracts(cb); self.deployContracts(cb);
}); });
this.events.setCommandHandler('deploy:contracts:test', (cb) => {
self.fatalErrors = true;
self.deployOnlyOnConfig = true;
self.deployContracts(cb);
});
} }
deployAll(done) { deployAll(done) {

View File

@ -104,7 +104,7 @@ module.exports = {
mocha.reporter(EmbarkSpec, { mocha.reporter(EmbarkSpec, {
events: global.embark.engine.events, events: global.embark.engine.events,
gasDetails: options.gasDetails, gasDetails: options.gasDetails,
gasLimit: global.embark.engine.deployManager.gasLimit gasLimit: 6000000
}); });
mocha.addFile(file); mocha.addFile(file);

View File

@ -304,9 +304,7 @@ class Test {
}); });
}, },
function deploy(accounts, next) { function deploy(accounts, next) {
self.engine.deployManager.fatalErrors = true; self.engine.events.request('deploy:contracts:test', () => {
self.engine.deployManager.deployOnlyOnConfig = true;
self.engine.events.request('deploy:contracts', () => {
next(null, accounts); next(null, accounts);
}); });
}, },