add onDeploy cmds to contract depedencies

This commit is contained in:
Iuri Matias 2017-12-20 14:30:01 -05:00
parent 281ebc643d
commit eb43fa2526
2 changed files with 11 additions and 1 deletions

View File

@ -132,7 +132,7 @@
"no-labels": "error",
"no-lone-blocks": "error",
"no-lonely-if": "off",
"no-loop-func": "error",
"no-loop-func": "off",
"no-magic-numbers": "off",
"no-mixed-operators": "error",
"no-mixed-requires": "error",

View File

@ -168,6 +168,16 @@ class ContractsManager {
self.contractDependencies[className].push(arg.substr(1));
}
}
// look in onDeploy for dependencies
if (contract.onDeploy === [] || contract.onDeploy === undefined) continue;
let regex = /\$\w+/g;
contract.onDeploy.map((cmd) => {
cmd.replace(regex, (match) => {
self.contractDependencies[className] = self.contractDependencies[className] || [];
self.contractDependencies[className].push(match.substr(1));
});
});
}
callback();
}