move copmiler to a module

This commit is contained in:
Iuri Matias 2018-07-20 20:22:12 +03:00
parent 9707b0076d
commit 5bf89b0fea
2 changed files with 11 additions and 8 deletions

View File

@ -192,11 +192,7 @@ class Engine {
deploymentService(options) {
let self = this;
const Compiler = require('../contracts/compiler.js');
let compiler = new Compiler({plugins: self.plugins, logger: self.logger});
this.events.setCommandHandler("compiler:contracts", function(contractFiles, cb) {
compiler.compile_contracts(contractFiles, cb);
});
this.registerModule('compiler', {plugins: self.plugins});
this.ipc = new IPC({logger: this.logger, ipcRole: options.ipcRole});
if (this.ipc.isServer()) {

View File

@ -1,9 +1,16 @@
let async = require('../utils/async_extend.js');
let async = require('../../utils/async_extend.js');
class Compiler {
constructor(options) {
constructor(embark, options) {
const self = this;
this.plugins = options.plugins;
this.logger = options.logger;
this.events = embark.events;
this.logger = embark.logger;
this.events.setCommandHandler("compiler:contracts", function(contractFiles, cb) {
self.compile_contracts(contractFiles, cb);
});
}
compile_contracts(contractFiles, cb) {