mirror of https://github.com/embarklabs/embark.git
replace beforeAction plugin api with event action api
This commit is contained in:
parent
8458acd207
commit
69e5af2308
|
@ -186,34 +186,7 @@ class Deploy {
|
|||
});
|
||||
},
|
||||
function applyBeforeDeploy(next) {
|
||||
let beforeDeployPlugins = self.plugins.getPluginsFor('beforeDeploy');
|
||||
|
||||
//self.logger.info("applying beforeDeploy plugins...", beforeDeployPlugins.length);
|
||||
async.eachSeries(beforeDeployPlugins, (plugin, eachPluginCb) => {
|
||||
self.logger.info(__("running beforeDeploy plugin %s .", plugin.name));
|
||||
|
||||
// calling each beforeDeploy handler declared by the plugin
|
||||
async.eachSeries(plugin.beforeDeploy, (beforeDeployFn, eachCb) => {
|
||||
function beforeDeployCb(resObj){
|
||||
contract.code = resObj.contractCode;
|
||||
eachCb();
|
||||
}
|
||||
beforeDeployFn({
|
||||
embarkDeploy: self,
|
||||
pluginConfig: plugin.pluginConfig,
|
||||
deploymentAccount: deploymentAccount,
|
||||
contract: contract,
|
||||
callback: beforeDeployCb
|
||||
}, beforeDeployCb);
|
||||
}, () => {
|
||||
//self.logger.info('All beforeDeploy handlers of the plugin has processed.');
|
||||
eachPluginCb();
|
||||
});
|
||||
}, () => {
|
||||
//self.logger.info('All beforeDeploy plugins has been processed.');
|
||||
contractCode = contract.code;
|
||||
next();
|
||||
});
|
||||
self.plugins.runActionsForEvent('deploy:contract:beforeDeploy', {contract: contract}, next);
|
||||
},
|
||||
function createDeployObject(next) {
|
||||
let contractObject = self.blockchain.ContractObject({abi: contract.abiDefinition});
|
||||
|
|
|
@ -23,9 +23,12 @@ module.exports = function (embark) {
|
|||
embark.addFileToPipeline('./fileInPipeline.js');
|
||||
embark.addFileToPipeline('./fileInPipeline.js', 'js/fileInPipeline.js');
|
||||
|
||||
embark.registerBeforeDeploy(function (options, callback) {
|
||||
// Just calling register to prove it works. We don't actually want to change the contracts
|
||||
callback({contractCode: options.contract.code});
|
||||
embark.registerActionForEvent("deploy:contract:beforeDeploy", (params, cb) => {
|
||||
embark.logger.info("applying beforeDeploy plugin...");
|
||||
//console.dir(params);
|
||||
//console.dir(cb);
|
||||
//console.dir('------------------');
|
||||
cb();
|
||||
});
|
||||
|
||||
// NOTE: uncommenting this will make dappConnection stop working
|
||||
|
|
Loading…
Reference in New Issue