simplify determine args method
This commit is contained in:
parent
cf13f098ac
commit
f08bb56337
|
@ -30,38 +30,30 @@ class Deploy {
|
|||
}
|
||||
}
|
||||
|
||||
let realArgs = [];
|
||||
async.eachLimit(args, 1, (arg, nextEachCb) => {
|
||||
async.map(args, (arg, nextEachCb) => {
|
||||
if (arg[0] === "$") {
|
||||
let contractName = arg.substr(1);
|
||||
self.events.request('contracts:contract', contractName, (referedContract) => {
|
||||
realArgs.push(referedContract.deployedAddress);
|
||||
nextEachCb();
|
||||
nextEachCb(null, referedContract.deployedAddress);
|
||||
});
|
||||
} else if (Array.isArray(arg)) {
|
||||
let subRealArgs = [];
|
||||
|
||||
async.eachLimit(arg, 1, (sub_arg, nextSubEachCb) => {
|
||||
async.map(arg, (sub_arg, nextSubEachCb) => {
|
||||
if (sub_arg[0] === "$") {
|
||||
let contractName = sub_arg.substr(1);
|
||||
|
||||
self.events.request('contracts:contract', contractName, (referedContract) => {
|
||||
subRealArgs.push(referedContract.deployedAddress);
|
||||
nextSubEachCb();
|
||||
nextSubEachCb(null, referedContract.deployedAddress);
|
||||
});
|
||||
} else {
|
||||
subRealArgs.push(sub_arg);
|
||||
nextSubEachCb();
|
||||
nextSubEachCb(null, sub_arg);
|
||||
}
|
||||
}, () => {
|
||||
realArgs.push(subRealArgs);
|
||||
nextEachCb();
|
||||
}, (err, subRealArgs) => {
|
||||
nextEachCb(null, subRealArgs);
|
||||
});
|
||||
} else {
|
||||
realArgs.push(arg);
|
||||
nextEachCb();
|
||||
nextEachCb(null, arg);
|
||||
}
|
||||
}, () => {
|
||||
}, (err, realArgs) => {
|
||||
callback(realArgs);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue