support getting contract from module; fix bug in which entire contract path was being replaced instead of just the beginning (if matching contracts in embark.json)
This commit is contained in:
parent
e0ab9cbde4
commit
7dd36a7a3b
|
@ -146,8 +146,13 @@ Config.prototype.loadExternalContractsFiles = function() {
|
|||
let contracts = this.contractsConfig.contracts;
|
||||
for (let contractName in contracts) {
|
||||
let contract = contracts[contractName];
|
||||
if (contract.file) {
|
||||
if (!contract.file) {
|
||||
continue;
|
||||
}
|
||||
if (fs.existsSync(contract.file)) {
|
||||
this.contractsFiles.push(new File({filename: contract.file, type: "dapp_file", basedir: '', path: contract.file}));
|
||||
} else if (fs.existsSync(path.join('./node_modules/', contract.file))) {
|
||||
this.contractsFiles.push(new File({filename: path.join('./node_modules/', contract.file), type: "dapp_file", basedir: '', path: path.join('./node_modules/', contract.file)}));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -22,7 +22,8 @@ class Solidity {
|
|||
let filename = file.filename;
|
||||
|
||||
for (let directory of self.contractDirectories) {
|
||||
filename = filename.replace(directory, '');
|
||||
let match = new RegExp("^" + directory);
|
||||
filename = filename.replace(match, '');
|
||||
}
|
||||
|
||||
file.content(function(fileContent) {
|
||||
|
|
|
@ -63,6 +63,9 @@
|
|||
100
|
||||
]
|
||||
},
|
||||
"ERC20": {
|
||||
"file": "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"
|
||||
},
|
||||
"SimpleStorageTest": {
|
||||
"file": "./some_folder/test_contract.sol",
|
||||
"args": [
|
||||
|
|
Loading…
Reference in New Issue