mirror of https://github.com/embarklabs/embark.git
Merge pull request #529 from embark-framework/bug_fix/after-deploy
Fix afterDeploy in build and also build files
This commit is contained in:
commit
e63ca1855b
|
@ -133,8 +133,7 @@ class DeployManager {
|
||||||
return callback(new Error("error running afterDeploy"));
|
return callback(new Error("error running afterDeploy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: convert to for to avoid repeated callback
|
async.each(onDeployCode, (cmd, eachCb) => {
|
||||||
for(let cmd of onDeployCode) {
|
|
||||||
self.logger.info("executing: " + cmd);
|
self.logger.info("executing: " + cmd);
|
||||||
try {
|
try {
|
||||||
RunCode.doEval(cmd, web3);
|
RunCode.doEval(cmd, web3);
|
||||||
|
@ -142,11 +141,14 @@ class DeployManager {
|
||||||
if (e.message.indexOf("invalid opcode") >= 0) {
|
if (e.message.indexOf("invalid opcode") >= 0) {
|
||||||
self.logger.error('the transaction was rejected; this usually happens due to a throw or a require, it can also happen due to an invalid operation');
|
self.logger.error('the transaction was rejected; this usually happens due to a throw or a require, it can also happen due to an invalid operation');
|
||||||
}
|
}
|
||||||
return callback(new Error(e));
|
return eachCb(new Error(e));
|
||||||
}
|
}
|
||||||
}
|
eachCb();
|
||||||
|
}, (err) => {
|
||||||
|
callback(err, contractsManager);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
callback(null, contractsManager);
|
|
||||||
}
|
}
|
||||||
], function (err, result) {
|
], function (err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -202,13 +202,20 @@ class Embark {
|
||||||
engine.deployManager.deployContracts(function (err) {
|
engine.deployManager.deployContracts(function (err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
function waitForWriteFinish(callback) {
|
||||||
|
engine.logger.info("Finished deploying".underline);
|
||||||
|
// Necessary log for simple projects. This event is trigger to soon because there is no file
|
||||||
|
// Also, not exiting straight after the deploy leaves time for async afterDeploys to finish
|
||||||
|
engine.logger.info("If you have no files to build, you can exit now with CTRL+C");
|
||||||
|
engine.events.on('outputDone', callback);
|
||||||
}
|
}
|
||||||
], function (err, _result) {
|
], function (err, _result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
engine.logger.error(err.message);
|
engine.logger.error(err.message);
|
||||||
engine.logger.debug(err.stack);
|
engine.logger.debug(err.stack);
|
||||||
} else {
|
} else {
|
||||||
engine.logger.info("finished building".underline);
|
engine.logger.info("Finished building".underline);
|
||||||
}
|
}
|
||||||
// needed due to child processes
|
// needed due to child processes
|
||||||
process.exit();
|
process.exit();
|
||||||
|
|
Loading…
Reference in New Issue