From ea6b469b19faf660f5e3c3760bf77ceb5f81f982 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Wed, 11 Jul 2018 15:25:44 -0500 Subject: [PATCH 1/5] no need for ganache-cli "bin" entry --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index d3e8c99ba..9e2434f97 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,7 @@ "fulltest": "npm run lint && npm run test && npm run testdapp_1 && npm run testdapp_2" }, "bin": { - "embark": "./bin/embark", - "ganache-cli-embark": "./node_modules/.bin/ganache-cli" + "embark": "./bin/embark" }, "main": "./lib/index.js", "directories": { From 28036bb53087e8440302b3c3ae92bd8a3c166ff8 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Thu, 12 Jul 2018 14:54:45 -0500 Subject: [PATCH 2/5] dont' need shelljs.which, can directly invoke embark's node_modules/.bin/ganache-cli --- lib/cmds/simulator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cmds/simulator.js b/lib/cmds/simulator.js index 29762c38f..9cc60fb48 100644 --- a/lib/cmds/simulator.js +++ b/lib/cmds/simulator.js @@ -1,3 +1,4 @@ +const path = require('path'); let shelljs = require('shelljs'); let proxy = require('../core/proxy'); const Ipc = require('../core/ipc'); @@ -12,7 +13,7 @@ class Simulator { run(options) { let cmds = []; - const ganache = shelljs.which('ganache-cli-embark'); + const ganache = path.join(__dirname, '../../node_modules/.bin/ganache-cli'); // const testrpc = shelljs.which('testrpc'); // const ganache = shelljs.which('ganache-cli'); // if (!testrpc && !ganache) { From 25df1528267e0bb97fadd13cd8686c4836408393 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Thu, 12 Jul 2018 14:56:55 -0500 Subject: [PATCH 3/5] disable dead code path -- ganache will never be falsy --- lib/cmds/simulator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cmds/simulator.js b/lib/cmds/simulator.js index 9cc60fb48..825b5867a 100644 --- a/lib/cmds/simulator.js +++ b/lib/cmds/simulator.js @@ -27,9 +27,9 @@ class Simulator { let port = (options.port || this.blockchainConfig.rpcPort || 8545); cmds.push("-p " + (port + (useProxy ? constants.blockchain.servicePortOnProxy : 0))); - if (!ganache) { - cmds.push("-h " + host); - } + // if (!ganache) { + // cmds.push("-h " + host); + // } cmds.push("-a " + (options.numAccounts || 10)); cmds.push("-e " + (options.defaultBalance || 100)); cmds.push("-l " + (options.gasLimit || 8000000)); From 33048b01b74f8924d04e7ea9d5f5d79e627f8de2 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Thu, 12 Jul 2018 16:03:56 -0500 Subject: [PATCH 4/5] rm commented code and extra whitespace --- lib/cmds/simulator.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/cmds/simulator.js b/lib/cmds/simulator.js index 825b5867a..27381b444 100644 --- a/lib/cmds/simulator.js +++ b/lib/cmds/simulator.js @@ -14,13 +14,6 @@ class Simulator { let cmds = []; const ganache = path.join(__dirname, '../../node_modules/.bin/ganache-cli'); - // const testrpc = shelljs.which('testrpc'); - // const ganache = shelljs.which('ganache-cli'); - // if (!testrpc && !ganache) { - // this.logger.warn(__('%s is not installed on your machine', 'Ganache CLI (TestRPC)')); - // this.logger.info(__('You can install it by running: %s', 'npm -g install ganache-cli')); - // process.exit(); - // } let useProxy = this.blockchainConfig.proxy || false; let host = (options.host || this.blockchainConfig.rpcHost || 'localhost'); @@ -46,8 +39,6 @@ class Simulator { cmds.push("-b \"" + (simulatorBlocktime) +"\""); } - // const programName = ganache ? 'ganache-cli' : 'testrpc'; - // const program = ganache ? ganache : testrpc; const programName = 'ganache-cli'; const program = ganache; console.log(`running: ${programName} ${cmds.join(' ')}`); @@ -57,7 +48,6 @@ class Simulator { let ipcObject = new Ipc({ipcRole: 'client'}); proxy.serve(ipcObject, host, port, false); } - } } From d78c9bd74ad0f6c0ff6cb0d780c5c1209a272d4f Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Thu, 12 Jul 2018 16:04:19 -0500 Subject: [PATCH 5/5] set the host flag for ganache-cli --- lib/cmds/simulator.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/cmds/simulator.js b/lib/cmds/simulator.js index 27381b444..eeeb8131a 100644 --- a/lib/cmds/simulator.js +++ b/lib/cmds/simulator.js @@ -20,9 +20,7 @@ class Simulator { let port = (options.port || this.blockchainConfig.rpcPort || 8545); cmds.push("-p " + (port + (useProxy ? constants.blockchain.servicePortOnProxy : 0))); - // if (!ganache) { - // cmds.push("-h " + host); - // } + cmds.push("-h " + host); cmds.push("-a " + (options.numAccounts || 10)); cmds.push("-e " + (options.defaultBalance || 100)); cmds.push("-l " + (options.gasLimit || 8000000));