Detecting if solc is installed
This commit is contained in:
parent
e2a076df12
commit
3da50e6104
|
@ -26,6 +26,14 @@ function compileSolc(logger, contractFiles, cb) {
|
|||
if (!contractFiles || !contractFiles.length) {
|
||||
return cb();
|
||||
}
|
||||
|
||||
const solc = shelljs.which('solc');
|
||||
if (!solc) {
|
||||
logger.warn('solc is not installed on your machine');
|
||||
logger.info('You can install it by following the instructions on: http://solidity.readthedocs.io/en/latest/installing-solidity.html');
|
||||
process.exit();
|
||||
}
|
||||
|
||||
logger.info("compiling solidity contracts with command line solc...");
|
||||
let compiled_object = {};
|
||||
async.each(contractFiles,
|
||||
|
@ -35,7 +43,9 @@ function compileSolc(logger, contractFiles, cb) {
|
|||
return fileCb(err);
|
||||
}
|
||||
|
||||
let json = JSON.parse(compileString);
|
||||
let jsonStart = compileString.indexOf("\"contracts\":{");
|
||||
|
||||
let json = JSON.parse(compileString.substr(jsonStart - 1));
|
||||
|
||||
for (let contractFile in json.contracts) {
|
||||
let className = contractFile.substr( contractFile.indexOf(":") + 1);
|
||||
|
|
Loading…
Reference in New Issue