move copmiler to a module

This commit is contained in:
Iuri Matias 2018-07-20 20:22:12 +03:00
parent f589f68330
commit 69bb03d56d
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) {