Skip to content

Commit 460f78c

Browse files
committed
update events name for code generation
1 parent 6157968 commit 460f78c

File tree

4 files changed

+36
-15
lines changed

4 files changed

+36
-15
lines changed

lib/contracts/code_generator.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Templates = {
1111
web3_connector: require('./code_templates/web3-connector.js.ejs'),
1212
do_when_loaded: require('./code_templates/do-when-loaded.js.ejs'),
1313
exec_when_env_loaded: require('./code_templates/exec-when-env-loaded.js.ejs')
14-
}
14+
};
1515

1616
class CodeGenerator {
1717
constructor(options) {
@@ -27,6 +27,7 @@ class CodeGenerator {
2727
listenToCommands() {
2828
let self = this;
2929

30+
// deprecated events; to remove in embark 2.7.0
3031
this.events.setCommandHandler('abi-vanila', function(cb) {
3132
let vanillaABI = self.generateABI({useEmbarkJS: false});
3233
let contractsJSON = self.generateContractsJSON();
@@ -54,6 +55,37 @@ class CodeGenerator {
5455

5556
cb(vanillaABI, contractsJSON);
5657
});
58+
59+
// new events
60+
this.events.setCommandHandler('code-vanila', function(cb) {
61+
let vanillaABI = self.generateABI({useEmbarkJS: false});
62+
let contractsJSON = self.generateContractsJSON();
63+
64+
cb(vanillaABI, contractsJSON);
65+
});
66+
67+
this.events.setCommandHandler('code', function(cb) {
68+
let embarkJSABI = self.generateABI({useEmbarkJS: true});
69+
let contractsJSON = self.generateContractsJSON();
70+
71+
cb(embarkJSABI, contractsJSON);
72+
});
73+
74+
this.events.setCommandHandler('code-contracts-vanila', function(cb) {
75+
let vanillaContractsABI = self.generateContracts(false, true, false);
76+
let contractsJSON = self.generateContractsJSON();
77+
78+
cb(vanillaContractsABI, contractsJSON);
79+
});
80+
81+
this.events.setCommandHandler('code-vanila-deployment', function(cb) {
82+
let vanillaABI = self.generateABI({useEmbarkJS: false, deployment: true});
83+
let contractsJSON = self.generateContractsJSON();
84+
85+
cb(vanillaABI, contractsJSON);
86+
});
87+
88+
5789
}
5890

5991
generateProvider(isDeployment) {

lib/core/engine.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Engine {
8181
plugins: this.plugins
8282
});
8383
this.events.on('code-generator-ready', function () {
84-
self.events.request('abi', function (abi, contractsJSON) {
84+
self.events.request('code', function (abi, contractsJSON) {
8585
self.currentAbi = abi;
8686
self.contractsJSON = contractsJSON;
8787
pipeline.build(abi, contractsJSON, null, function() {

lib/core/test.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,10 @@ Test.prototype.deployAll = function(contractsConfig, cb) {
7171
callback();
7272
},
7373
function deploy(callback) {
74-
//self.engine.events.setHandler('abi-contracts-vanila', function(vanillaABI) {
75-
//elf.engine.events.on('abi-contracts-vanila', function(vanillaABI) {
7674
self.engine.events.on('code-generator-ready', function () {
77-
self.engine.events.request('abi-contracts-vanila', function(vanillaABI) {
78-
console.log("got abi-contracts-vanila request");
75+
self.engine.events.request('code-contracts-vanila', function(vanillaABI) {
7976
callback(null, vanillaABI);
8077
});
81-
//self.engine.events.on('abi-contracts-vanila', function(vanillaABI) {
82-
// console.log("got abi-contracts-vanila");
83-
// callback(null, vanillaABI);
84-
//});
85-
//self.engine.events.request('abi', function(vanillaABI) {
86-
// console.log("got abi");
87-
// callback(null, vanillaABI);
88-
//});
8978
});
9079

9180
self.engine.deployManager.deployContracts(function(err, result) {

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Embark {
8181
});
8282
dashboard.start(function () {
8383
engine.events.on('code-generator-ready', function () {
84-
engine.events.request('abi-vanila-deployment', function (abi) {
84+
engine.events.request('code-vanila-deployment', function (abi) {
8585
dashboard.console.runCode(abi);
8686
});
8787
});

0 commit comments

Comments
 (0)