mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-23 13:48:49 +00:00
[*] Fixed eslint warnings.
[+] Added proper asyncCallback for async.waterfall().
This commit is contained in:
parent
ffe9af74bb
commit
2a88bb8cde
@ -158,7 +158,9 @@ example:
|
||||
|
||||
module.exports = function(embark) {
|
||||
embark.registerBeforeDeploy(function(options) {
|
||||
return options.contract.code.replace(/deaddeaddeaddeaddeaddeaddeaddeaddeaddead/ig, 'c0dec0dec0dec0dec0dec0dec0dec0dec0dec0de');
|
||||
var code = options.contract.code.replace(/deaddeaddeaddeaddeaddeaddeaddeaddeaddead/ig, 'c0dec0dec0dec0dec0dec0dec0dec0dec0dec0de');
|
||||
options.callback({ contractCode: code });
|
||||
return; // ignored
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -215,13 +215,13 @@ class Deploy {
|
||||
let beforeDeployPlugins = self.plugins.getPluginsFor('beforeDeploy');
|
||||
|
||||
async.waterfall([
|
||||
(asyncCallback)=>{
|
||||
(asyncCallback) => {
|
||||
//self.logger.info("applying beforeDeploy plugins...", beforeDeployPlugins.length);
|
||||
async.eachSeries(beforeDeployPlugins, (plugin, eachPluginCb)=>{
|
||||
async.eachSeries(beforeDeployPlugins, (plugin, eachPluginCb) => {
|
||||
self.logger.info("running beforeDeploy plugin " + plugin.name + " .");
|
||||
|
||||
// calling each beforeDeploy handler declared by the plugin
|
||||
async.eachSeries(plugin.beforeDeploy, (beforeDeployFn, eachCb)=>{
|
||||
async.eachSeries(plugin.beforeDeploy, (beforeDeployFn, eachCb) => {
|
||||
beforeDeployFn({
|
||||
embarkDeploy: self,
|
||||
pluginConfig: plugin.pluginConfig,
|
||||
@ -233,17 +233,17 @@ class Deploy {
|
||||
eachCb();
|
||||
})
|
||||
});
|
||||
}, ()=>{
|
||||
}, () => {
|
||||
//self.logger.info('All beforeDeploy handlers of the plugin has processed.');
|
||||
eachPluginCb();
|
||||
});
|
||||
}, ()=>{
|
||||
}, () => {
|
||||
//self.logger.info('All beforeDeploy plugins has been processed.');
|
||||
contractCode = contract.code;
|
||||
asyncCallback();
|
||||
});
|
||||
},
|
||||
(asyncCallback)=>{
|
||||
(asyncCallback) => {
|
||||
let contractObject = new self.web3.eth.Contract(contract.abiDefinition);
|
||||
let deployObject;
|
||||
|
||||
@ -251,9 +251,13 @@ class Deploy {
|
||||
deployObject = contractObject.deploy({arguments: contractParams, data: "0x" + contractCode});
|
||||
} catch(e) {
|
||||
if (e.indexOf('Invalid number of parameters for "undefined"') >= 0) {
|
||||
return callback(new Error("attempted to deploy " + contractObject.className + " without specifying parameters"));
|
||||
callback(new Error("attempted to deploy " + contractObject.className + " without specifying parameters"));
|
||||
asyncCallback();
|
||||
return;
|
||||
} else {
|
||||
return callback(new Error(e));
|
||||
callback(new Error(e));
|
||||
asyncCallback();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,6 +289,8 @@ class Deploy {
|
||||
}).on('error', function(error) {
|
||||
return callback(new Error("error deploying =" + contract.className + "= due to error: " + error.message));
|
||||
});
|
||||
|
||||
asyncCallback();
|
||||
}
|
||||
]); // end of async.waterfall
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user