mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-09 13:36:14 +00:00
move code generator to a module
This commit is contained in:
parent
b35d034692
commit
b48ec4c638
@ -158,23 +158,28 @@ class Engine {
|
|||||||
codeGeneratorService(_options) {
|
codeGeneratorService(_options) {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
const CodeGenerator = require('../contracts/code_generator.js');
|
this.registerModule('code_generator', {plugins: self.plugins, env: self.env});
|
||||||
this.codeGenerator = new CodeGenerator({
|
//const CodeGenerator = require('../contracts/code_generator.js');
|
||||||
blockchainConfig: self.config.blockchainConfig,
|
//this.codeGenerator = new CodeGenerator({
|
||||||
contractsConfig: self.config.contractsConfig,
|
// blockchainConfig: self.config.blockchainConfig,
|
||||||
plugins: self.plugins,
|
// contractsConfig: self.config.contractsConfig,
|
||||||
storageConfig: self.config.storageConfig,
|
// plugins: self.plugins,
|
||||||
namesystemConfig: self.config.namesystemConfig,
|
// storageConfig: self.config.storageConfig,
|
||||||
communicationConfig: self.config.communicationConfig,
|
// namesystemConfig: self.config.namesystemConfig,
|
||||||
events: self.events,
|
// communicationConfig: self.config.communicationConfig,
|
||||||
env: self.env
|
// events: self.events,
|
||||||
});
|
// env: self.env
|
||||||
this.codeGenerator.listenToCommands();
|
//});
|
||||||
|
//this.codeGenerator.listenToCommands();
|
||||||
|
|
||||||
const generateCode = function () {
|
const generateCode = function () {
|
||||||
self.codeGenerator.buildEmbarkJS(function() {
|
self.events.request("code-generator:embarkjs:build", () => {
|
||||||
self.events.emit('code-generator-ready');
|
self.events.emit('code-generator-ready');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//self.codeGenerator.buildEmbarkJS(function() {
|
||||||
|
// self.events.emit('code-generator-ready');
|
||||||
|
//});
|
||||||
};
|
};
|
||||||
const cargo = async.cargo((_tasks, callback) => {
|
const cargo = async.cargo((_tasks, callback) => {
|
||||||
generateCode();
|
generateCode();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
let async = require('async');
|
let async = require('async');
|
||||||
let fs = require('../core/fs.js');
|
let fs = require('../../core/fs.js');
|
||||||
const utils = require('../utils/utils.js');
|
const utils = require('../../utils/utils.js');
|
||||||
|
|
||||||
require('ejs');
|
require('ejs');
|
||||||
const Templates = {
|
const Templates = {
|
||||||
@ -19,17 +19,24 @@ const Templates = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class CodeGenerator {
|
class CodeGenerator {
|
||||||
constructor(options) {
|
constructor(embark, options) {
|
||||||
this.blockchainConfig = options.blockchainConfig || {};
|
this.blockchainConfig = embark.config.blockchainConfig || {};
|
||||||
this.rpcHost = this.blockchainConfig.rpcHost || '';
|
this.rpcHost = this.blockchainConfig.rpcHost || '';
|
||||||
this.rpcPort = this.blockchainConfig.rpcPort || '';
|
this.rpcPort = this.blockchainConfig.rpcPort || '';
|
||||||
this.contractsConfig = options.contractsConfig || {};
|
this.contractsConfig = embark.config.contractsConfig || {};
|
||||||
this.storageConfig = options.storageConfig || {};
|
this.storageConfig = embark.config.storageConfig || {};
|
||||||
this.communicationConfig = options.communicationConfig || {};
|
this.communicationConfig = embark.config.communicationConfig || {};
|
||||||
this.namesystemConfig = options.namesystemConfig || {};
|
this.namesystemConfig = embark.config.namesystemConfig || {};
|
||||||
this.env = options.env || 'development';
|
this.env = options.env || 'development';
|
||||||
this.plugins = options.plugins;
|
this.plugins = options.plugins;
|
||||||
this.events = options.events;
|
this.events = embark.events;
|
||||||
|
|
||||||
|
this.listenToCommands();
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
this.events.setCommandHandler("code-generator:embarkjs:build", (cb) => {
|
||||||
|
self.buildEmbarkJS(cb);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
listenToCommands() {
|
listenToCommands() {
|
Loading…
x
Reference in New Issue
Block a user