mirror of https://github.com/embarklabs/embark.git
fix onDeploy cmds
This commit is contained in:
parent
0a4a757af8
commit
7c33720c98
|
@ -96,6 +96,13 @@ class CodeGenerator {
|
|||
|
||||
}
|
||||
|
||||
generateContext() {
|
||||
let result = "";
|
||||
result += Templates.main_context();
|
||||
result += Templates.load_manager();
|
||||
return result;
|
||||
}
|
||||
|
||||
generateProvider(isDeployment) {
|
||||
let self = this;
|
||||
let result = "";
|
||||
|
|
|
@ -77,10 +77,16 @@ class Deploy {
|
|||
if (contract.onDeploy !== undefined) {
|
||||
self.logger.info('executing onDeploy commands');
|
||||
let codeGenerator = new CodeGenerator({contractsManager: self.contractsManager});
|
||||
let context = codeGenerator.generateContext();
|
||||
let code = codeGenerator.generateContracts(false, true, true);
|
||||
let cmds = contract.onDeploy.join(';\n');
|
||||
|
||||
RunCode.doEval(code + "\n" + cmds, self.web3);
|
||||
let _cmds = ""
|
||||
_cmds += "__mainContext.__loadManagerInstance.execWhenReady(function() {"
|
||||
_cmds += cmds;
|
||||
_cmds += "});"
|
||||
|
||||
RunCode.doEval(context + "\n" + code + "\n" + _cmds, self.web3);
|
||||
}
|
||||
|
||||
callback();
|
||||
|
|
Loading…
Reference in New Issue