mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-03 17:34:22 +00:00
remove unnecessary passing of params around
This commit is contained in:
parent
000d7beb27
commit
21026e07ae
@ -32,34 +32,36 @@ class DeployManager {
|
|||||||
async.waterfall([
|
async.waterfall([
|
||||||
function buildContracts(callback) {
|
function buildContracts(callback) {
|
||||||
self.contractsManager.deployOnlyOnConfig = self.deployOnlyOnConfig; // temporary, should refactor
|
self.contractsManager.deployOnlyOnConfig = self.deployOnlyOnConfig; // temporary, should refactor
|
||||||
self.contractsManager.build(callback);
|
self.contractsManager.build(() => {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
function checkCompileOnly(contractsManager, callback){
|
function checkCompileOnly(callback){
|
||||||
if(self.onlyCompile){
|
if(self.onlyCompile){
|
||||||
self.events.emit('contractsDeployed', contractsManager);
|
self.events.emit('contractsDeployed', self.contractsManager);
|
||||||
return done();
|
return done();
|
||||||
}
|
}
|
||||||
return callback(null, contractsManager);
|
return callback();
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: could be implemented as an event (beforeDeployAll)
|
// TODO: could be implemented as an event (beforeDeployAll)
|
||||||
function checkIsConnectedToBlockchain(contractsManager, callback) {
|
function checkIsConnectedToBlockchain(callback) {
|
||||||
self.blockchain.assertNodeConnection((err) => {
|
self.blockchain.assertNodeConnection((err) => {
|
||||||
callback(err, contractsManager);
|
callback(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: this can be done on the fly or as part of the initialization
|
// TODO: this can be done on the fly or as part of the initialization
|
||||||
function determineDefaultAccount(contractsManager, callback) {
|
function determineDefaultAccount(callback) {
|
||||||
self.blockchain.determineDefaultAccount((err) => {
|
self.blockchain.determineDefaultAccount((err) => {
|
||||||
callback(err, contractsManager);
|
callback(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
function deployAllContracts(contractsManager, callback) {
|
function deployAllContracts(callback) {
|
||||||
let deploy = new Deploy({
|
let deploy = new Deploy({
|
||||||
blockchain: self.blockchain,
|
blockchain: self.blockchain,
|
||||||
contractsManager: contractsManager,
|
contractsManager: self.contractsManager,
|
||||||
logger: self.logger,
|
logger: self.logger,
|
||||||
events: self.events,
|
events: self.events,
|
||||||
chainConfig: self.chainConfig,
|
chainConfig: self.chainConfig,
|
||||||
@ -70,15 +72,15 @@ class DeployManager {
|
|||||||
|
|
||||||
deploy.deployAll(function (err) {
|
deploy.deployAll(function (err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
self.events.emit('contractsDeployed', contractsManager);
|
self.events.emit('contractsDeployed', self.contractsManager);
|
||||||
}
|
}
|
||||||
if (err && self.fatalErrors) {
|
if (err && self.fatalErrors) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
callback(null, contractsManager);
|
callback();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function runAfterDeployCommands(contractsManager, callback) {
|
function runAfterDeployCommands(callback) {
|
||||||
// TODO: should instead emit a afterDeploy event and/or run a afterDeploy plugin
|
// TODO: should instead emit a afterDeploy event and/or run a afterDeploy plugin
|
||||||
let afterDeployCmds = self.config.contractsConfig.afterDeploy || [];
|
let afterDeployCmds = self.config.contractsConfig.afterDeploy || [];
|
||||||
|
|
||||||
@ -87,7 +89,7 @@ class DeployManager {
|
|||||||
let onDeployCode = afterDeployCmds.map((cmd) => {
|
let onDeployCode = afterDeployCmds.map((cmd) => {
|
||||||
let realCmd = cmd.replace(regex, (match) => {
|
let realCmd = cmd.replace(regex, (match) => {
|
||||||
let referedContractName = match.slice(1);
|
let referedContractName = match.slice(1);
|
||||||
let referedContract = contractsManager.getContract(referedContractName);
|
let referedContract = self.contractsManager.getContract(referedContractName);
|
||||||
if (!referedContract) {
|
if (!referedContract) {
|
||||||
self.logger.error(referedContractName + ' does not exist');
|
self.logger.error(referedContractName + ' does not exist');
|
||||||
self.logger.error(__("error running afterDeploy: ") + cmd);
|
self.logger.error(__("error running afterDeploy: ") + cmd);
|
||||||
@ -128,14 +130,10 @@ class DeployManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(null, contractsManager);
|
callback();
|
||||||
}
|
|
||||||
], function (err, result) {
|
|
||||||
if (err) {
|
|
||||||
done(err, null);
|
|
||||||
} else {
|
|
||||||
done(null, result);
|
|
||||||
}
|
}
|
||||||
|
], function (err, _result) {
|
||||||
|
done(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user