make ethersim optional

This commit is contained in:
Iuri Matias 2016-05-23 16:00:54 -04:00
parent 402f8fed57
commit 7b9de1b259
3 changed files with 19 additions and 4 deletions

View File

@ -6,7 +6,6 @@ var wrench = require('wrench');
var grunt = require('grunt');
require('shelljs/global');
var readYaml = require('read-yaml');
var EtherSim = require('ethersim');
var Embark = require('..');
var run = function(cmd) {
@ -175,6 +174,13 @@ program.command('meteor_demo').description('create a working meteor dapp with a
});
program.command('simulator').description('run a fast ethereum rpc simulator').action(function() {
try {
var EtherSim = require('ethersim');
} catch(e) {
console.log('EtherSim not found; Please install it with "npm install ethersim --save"');
console.log('For more information see https://github.com/iurimatias/ethersim');
exit();
}
EtherSim.startServer();
});

View File

@ -1,7 +1,17 @@
var ethersim = require('ethersim');
try {
var ethersim = require('ethersim');
} catch(e) {
var ethersim = false;
}
var web3 = require('web3');
Test = function(contractFiles, blockchainFile, contractFile, _env) {
if (ethersim === false) {
console.log('EtherSim not found; Please install it with "npm install ethersim --save"');
console.log('For more information see https://github.com/iurimatias/ethersim');
exit();
}
this.env = _env || 'development';
this.web3 = web3;
this.web3.setProvider(ethersim.web3Provider());

View File

@ -24,8 +24,7 @@
"toposort": "^0.2.10",
"web3": "^0.15.0",
"bignumber.js": "debris/bignumber.js#master",
"wrench": "^1.5.8",
"ethersim": "^0.3.0"
"wrench": "^1.5.8"
},
"author": "Iuri Matias <iuri.matias@gmail.com>",
"contributors": [],