2017-03-29 17:50:05 +00:00
|
|
|
let shelljs = require('shelljs');
|
2017-02-18 13:01:03 +00:00
|
|
|
|
2017-03-29 17:50:05 +00:00
|
|
|
let Simulator = function(options) {
|
2017-02-18 13:01:03 +00:00
|
|
|
this.blockchainConfig = options.blockchainConfig;
|
|
|
|
};
|
|
|
|
|
|
|
|
Simulator.prototype.run = function(options) {
|
2017-03-29 17:50:05 +00:00
|
|
|
let cmds = [];
|
2017-02-18 13:01:03 +00:00
|
|
|
|
|
|
|
cmds.push("-p " + (this.blockchainConfig.rpcPort || options.port || 8545));
|
|
|
|
cmds.push("-h " + (this.blockchainConfig.rpcHost || options.host || 'localhost'));
|
|
|
|
cmds.push("-a " + (options.num || 10));
|
|
|
|
|
2017-02-18 21:06:39 +00:00
|
|
|
shelljs.exec('testrpc ' + cmds.join(' '));
|
2017-02-18 13:01:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Simulator;
|
|
|
|
|