From eb43fa2526c305a3406eab5a4cb40549fa868b0e Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 20 Dec 2017 14:30:01 -0500 Subject: [PATCH] add onDeploy cmds to contract depedencies --- .eslintrc.json | 2 +- lib/contracts/contracts.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 5f28a099..c8b8e4ef 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -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", diff --git a/lib/contracts/contracts.js b/lib/contracts/contracts.js index 09cafcc3..9940e809 100644 --- a/lib/contracts/contracts.js +++ b/lib/contracts/contracts.js @@ -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(); }