embark/lib/cmds/simulator.js

21 lines
469 B
JavaScript
Raw Normal View History

2017-03-29 17:50:05 +00:00
let shelljs = require('shelljs');
2017-03-30 11:12:39 +00:00
class Simulator {
constructor(options) {
this.blockchainConfig = options.blockchainConfig;
}
2017-03-30 11:12:39 +00:00
run(options) {
let cmds = [];
2017-03-30 11:12:39 +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-03-30 11:12:39 +00:00
shelljs.exec('testrpc ' + cmds.join(' '));
}
}
module.exports = Simulator;