mirror of https://github.com/embarklabs/embark.git
update events name for code generation
This commit is contained in:
parent
6157968c5e
commit
460f78cc55
|
@ -11,7 +11,7 @@ const Templates = {
|
|||
web3_connector: require('./code_templates/web3-connector.js.ejs'),
|
||||
do_when_loaded: require('./code_templates/do-when-loaded.js.ejs'),
|
||||
exec_when_env_loaded: require('./code_templates/exec-when-env-loaded.js.ejs')
|
||||
}
|
||||
};
|
||||
|
||||
class CodeGenerator {
|
||||
constructor(options) {
|
||||
|
@ -27,6 +27,7 @@ class CodeGenerator {
|
|||
listenToCommands() {
|
||||
let self = this;
|
||||
|
||||
// deprecated events; to remove in embark 2.7.0
|
||||
this.events.setCommandHandler('abi-vanila', function(cb) {
|
||||
let vanillaABI = self.generateABI({useEmbarkJS: false});
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
@ -54,6 +55,37 @@ class CodeGenerator {
|
|||
|
||||
cb(vanillaABI, contractsJSON);
|
||||
});
|
||||
|
||||
// new events
|
||||
this.events.setCommandHandler('code-vanila', function(cb) {
|
||||
let vanillaABI = self.generateABI({useEmbarkJS: false});
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
cb(vanillaABI, contractsJSON);
|
||||
});
|
||||
|
||||
this.events.setCommandHandler('code', function(cb) {
|
||||
let embarkJSABI = self.generateABI({useEmbarkJS: true});
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
cb(embarkJSABI, contractsJSON);
|
||||
});
|
||||
|
||||
this.events.setCommandHandler('code-contracts-vanila', function(cb) {
|
||||
let vanillaContractsABI = self.generateContracts(false, true, false);
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
cb(vanillaContractsABI, contractsJSON);
|
||||
});
|
||||
|
||||
this.events.setCommandHandler('code-vanila-deployment', function(cb) {
|
||||
let vanillaABI = self.generateABI({useEmbarkJS: false, deployment: true});
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
cb(vanillaABI, contractsJSON);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
generateProvider(isDeployment) {
|
||||
|
|
|
@ -81,7 +81,7 @@ class Engine {
|
|||
plugins: this.plugins
|
||||
});
|
||||
this.events.on('code-generator-ready', function () {
|
||||
self.events.request('abi', function (abi, contractsJSON) {
|
||||
self.events.request('code', function (abi, contractsJSON) {
|
||||
self.currentAbi = abi;
|
||||
self.contractsJSON = contractsJSON;
|
||||
pipeline.build(abi, contractsJSON, null, function() {
|
||||
|
|
|
@ -71,21 +71,10 @@ Test.prototype.deployAll = function(contractsConfig, cb) {
|
|||
callback();
|
||||
},
|
||||
function deploy(callback) {
|
||||
//self.engine.events.setHandler('abi-contracts-vanila', function(vanillaABI) {
|
||||
//elf.engine.events.on('abi-contracts-vanila', function(vanillaABI) {
|
||||
self.engine.events.on('code-generator-ready', function () {
|
||||
self.engine.events.request('abi-contracts-vanila', function(vanillaABI) {
|
||||
console.log("got abi-contracts-vanila request");
|
||||
self.engine.events.request('code-contracts-vanila', function(vanillaABI) {
|
||||
callback(null, vanillaABI);
|
||||
});
|
||||
//self.engine.events.on('abi-contracts-vanila', function(vanillaABI) {
|
||||
// console.log("got abi-contracts-vanila");
|
||||
// callback(null, vanillaABI);
|
||||
//});
|
||||
//self.engine.events.request('abi', function(vanillaABI) {
|
||||
// console.log("got abi");
|
||||
// callback(null, vanillaABI);
|
||||
//});
|
||||
});
|
||||
|
||||
self.engine.deployManager.deployContracts(function(err, result) {
|
||||
|
|
|
@ -81,7 +81,7 @@ class Embark {
|
|||
});
|
||||
dashboard.start(function () {
|
||||
engine.events.on('code-generator-ready', function () {
|
||||
engine.events.request('abi-vanila-deployment', function (abi) {
|
||||
engine.events.request('code-vanila-deployment', function (abi) {
|
||||
dashboard.console.runCode(abi);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue