From 7b9de1b259840687d940eaeeaf02b0a949fcf609 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 23 May 2016 16:00:54 -0400 Subject: [PATCH] make ethersim optional --- bin/embark | 8 +++++++- lib/test.js | 12 +++++++++++- package.json | 3 +-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/embark b/bin/embark index c227bc88..9d545f49 100755 --- a/bin/embark +++ b/bin/embark @@ -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(); }); diff --git a/lib/test.js b/lib/test.js index bb7e8362..2ba0a05d 100644 --- a/lib/test.js +++ b/lib/test.js @@ -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()); diff --git a/package.json b/package.json index 26cd0add..0b2903f8 100644 --- a/package.json +++ b/package.json @@ -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 ", "contributors": [],