mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-02 18:34:09 +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) {
|
module.exports = function(embark) {
|
||||||
embark.registerBeforeDeploy(function(options) {
|
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');
|
let beforeDeployPlugins = self.plugins.getPluginsFor('beforeDeploy');
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
(asyncCallback)=>{
|
(asyncCallback) => {
|
||||||
//self.logger.info("applying beforeDeploy plugins...", beforeDeployPlugins.length);
|
//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 + " .");
|
self.logger.info("running beforeDeploy plugin " + plugin.name + " .");
|
||||||
|
|
||||||
// calling each beforeDeploy handler declared by the plugin
|
// calling each beforeDeploy handler declared by the plugin
|
||||||
async.eachSeries(plugin.beforeDeploy, (beforeDeployFn, eachCb)=>{
|
async.eachSeries(plugin.beforeDeploy, (beforeDeployFn, eachCb) => {
|
||||||
beforeDeployFn({
|
beforeDeployFn({
|
||||||
embarkDeploy: self,
|
embarkDeploy: self,
|
||||||
pluginConfig: plugin.pluginConfig,
|
pluginConfig: plugin.pluginConfig,
|
||||||
@ -233,17 +233,17 @@ class Deploy {
|
|||||||
eachCb();
|
eachCb();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}, ()=>{
|
}, () => {
|
||||||
//self.logger.info('All beforeDeploy handlers of the plugin has processed.');
|
//self.logger.info('All beforeDeploy handlers of the plugin has processed.');
|
||||||
eachPluginCb();
|
eachPluginCb();
|
||||||
});
|
});
|
||||||
}, ()=>{
|
}, () => {
|
||||||
//self.logger.info('All beforeDeploy plugins has been processed.');
|
//self.logger.info('All beforeDeploy plugins has been processed.');
|
||||||
contractCode = contract.code;
|
contractCode = contract.code;
|
||||||
asyncCallback();
|
asyncCallback();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
(asyncCallback)=>{
|
(asyncCallback) => {
|
||||||
let contractObject = new self.web3.eth.Contract(contract.abiDefinition);
|
let contractObject = new self.web3.eth.Contract(contract.abiDefinition);
|
||||||
let deployObject;
|
let deployObject;
|
||||||
|
|
||||||
@ -251,9 +251,13 @@ class Deploy {
|
|||||||
deployObject = contractObject.deploy({arguments: contractParams, data: "0x" + contractCode});
|
deployObject = contractObject.deploy({arguments: contractParams, data: "0x" + contractCode});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
if (e.indexOf('Invalid number of parameters for "undefined"') >= 0) {
|
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 {
|
} else {
|
||||||
return callback(new Error(e));
|
callback(new Error(e));
|
||||||
|
asyncCallback();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,6 +289,8 @@ class Deploy {
|
|||||||
}).on('error', function(error) {
|
}).on('error', function(error) {
|
||||||
return callback(new Error("error deploying =" + contract.className + "= due to error: " + error.message));
|
return callback(new Error("error deploying =" + contract.className + "= due to error: " + error.message));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
asyncCallback();
|
||||||
}
|
}
|
||||||
]); // end of async.waterfall
|
]); // end of async.waterfall
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user