fix(flattener): fix path not being correct

This commit is contained in:
Jonathan Rainville 2019-03-15 14:32:40 -04:00
parent 37bdffbc89
commit e037384e1c
2 changed files with 5 additions and 6 deletions

View File

@ -6,12 +6,12 @@ module.exports = (embark) => {
const flattenerVerifier = new FlattenerVerifier(embark);
embark.registerConsoleCommand({
description: "Flattens all or some of your contracts so that they can be verified on etherscan\n\t\tYou can specify which contract to flatten by using their filename (relative to the contract directory specified in embark.json). For multiple contracts, separate them using a comma",
description: "Flattens all or some of your contracts so that they can be verified on Etherscan\n\t\tYou can specify which contract to flatten by using their contract name. For multiple contracts, separate them using a comma",
matches: (cmd) => {
const [commandName] = cmd.split(' ');
return commandName === 'flatten';
},
usage: "flatten or flatten <contracts>",
usage: "flatten or flatten [contracts]",
process: (cmd, callback) => {
const [, contractNames] = cmd.split(' ');
@ -28,13 +28,12 @@ module.exports = (embark) => {
const etherscanKeyDocsLink = 'https://etherscancom.freshdesk.com/support/solutions/articles/35000022163-i-need-an-api-key';
embark.registerConsoleCommand({
description: `Verifies a contract on Etherscan using you contract configuration\n\t\tRequires an Etherscan API key.
See: ${etherscanKeyDocsLink}`,
description: `Verifies a contract on Etherscan using you contract configuration\n\t\tRequires an Etherscan API key.\n\t\tSee: ${etherscanKeyDocsLink}`,
matches: (cmd) => {
const [commandName] = cmd.split(' ');
return commandName === 'verify';
},
usage: "verify <apiKey> <contractName>]",
usage: "verify [apiKey] [contractName]",
process: (cmd, callback) => {
const [, apiKey, contractName] = cmd.split(' ');

View File

@ -287,7 +287,7 @@ class FlattenerVerifier {
if (!contract) {
throw new Error('No contract named ' + contractName);
}
return this.embark.config.contractsFiles.find(file => path.normalize(file.path) === path.normalize(contract.originalFilename));
return this.embark.config.contractsFiles.find(file => path.normalize(file.originalPath) === path.normalize(contract.originalFilename));
});
} catch (e) {
return callback(null, e.message.red);