move onDeploy to new api
This commit is contained in:
parent
93e5003c64
commit
16653d491b
|
@ -262,12 +262,7 @@ class Deploy {
|
|||
// just need to figure out the gasLimit coupling issue
|
||||
self.events.request('code-generator:contract:vanilla', contract, self.gasLimit, (contractCode) => {
|
||||
self.events.request('runcode:eval', contractCode);
|
||||
|
||||
let onDeployPlugins = self.plugins.getPluginsProperty('onDeployActions', 'onDeployActions');
|
||||
|
||||
async.eachLimit(onDeployPlugins, 1, function(plugin, nextEach) {
|
||||
plugin.call(plugin, contract, nextEach);
|
||||
}, () => {
|
||||
self.plugins.runActionsForEvent('deploy:contract:deployed', {contract: contract}, () => {
|
||||
return next(null, receipt);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -116,13 +116,23 @@ Plugins.prototype.getPluginsProperty = function(pluginType, property, sub_proper
|
|||
return matchingProperties.reduce((a,b) => { return a.concat(b); }) || [];
|
||||
};
|
||||
|
||||
//Plugins.prototype.runActionsForEvent = function(eventName, args, cb) {
|
||||
Plugins.prototype.runActionsForEvent = function(eventName, cb) {
|
||||
Plugins.prototype.runActionsForEvent = function(eventName, args, cb) {
|
||||
if (typeof(args) === 'function') {
|
||||
cb = args;
|
||||
}
|
||||
let actionPlugins = this.getPluginsProperty('eventActions', 'eventActions', eventName);
|
||||
|
||||
if (actionPlugins.length === 0) {
|
||||
return cb();
|
||||
}
|
||||
|
||||
async.eachLimit(actionPlugins, 1, function(plugin, nextEach) {
|
||||
//plugin.call(plugin, ...args, nextEach);
|
||||
plugin.call(plugin, nextEach);
|
||||
if (typeof(args) === 'function') {
|
||||
plugin.call(plugin, nextEach);
|
||||
} else {
|
||||
//plugin.call(plugin, ...args, nextEach);
|
||||
plugin.call(plugin, args, nextEach);
|
||||
}
|
||||
}, cb);
|
||||
};
|
||||
|
||||
|
|
|
@ -80,7 +80,9 @@ class SpecialConfigs {
|
|||
registerOnDeployAction() {
|
||||
const self = this;
|
||||
|
||||
this.embark.registerOnDeployContracts((contract, cb) => {
|
||||
this.embark.registerActionForEvent("deploy:contract:deployed", (params, cb) => {
|
||||
let contract = params.contract;
|
||||
|
||||
if (!contract.onDeploy) {
|
||||
return cb();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue