mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-03 01:13:55 +00:00
Merge pull request #628 from embark-framework/features/invoke-local-ganache-cli-directly
invoke embark's local ganache-cli directly
This commit is contained in:
commit
07f600f756
@ -1,3 +1,4 @@
|
||||
const path = require('path');
|
||||
let shelljs = require('shelljs');
|
||||
let proxy = require('../core/proxy');
|
||||
const Ipc = require('../core/ipc');
|
||||
@ -12,23 +13,14 @@ class Simulator {
|
||||
run(options) {
|
||||
let cmds = [];
|
||||
|
||||
const ganache = shelljs.which('ganache-cli-embark');
|
||||
// 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();
|
||||
// }
|
||||
const ganache = path.join(__dirname, '../../node_modules/.bin/ganache-cli');
|
||||
|
||||
let useProxy = this.blockchainConfig.proxy || false;
|
||||
let host = (options.host || this.blockchainConfig.rpcHost || 'localhost');
|
||||
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("-a " + (options.numAccounts || 10));
|
||||
cmds.push("-e " + (options.defaultBalance || 100));
|
||||
cmds.push("-l " + (options.gasLimit || 8000000));
|
||||
@ -45,8 +37,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(' ')}`);
|
||||
@ -56,7 +46,6 @@ class Simulator {
|
||||
let ipcObject = new Ipc({ipcRole: 'client'});
|
||||
proxy.serve(ipcObject, host, port, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user