Merge pull request #58 from gerbrand/develop

Add option to run geth with any command
This commit is contained in:
Iuri Matias 2015-08-18 07:22:36 -04:00
commit 14f98c0020
3 changed files with 27 additions and 2 deletions

View File

@ -139,6 +139,18 @@ program.command('blockchain [env]').description('run blockchain').action(functio
}
});
program.command('geth <env> [args...]').description('run geth with specified arguments').action(function(env_, args_) {
var env = env_ || 'development';
var embarkConfig = readYaml.sync("./embark.yml");
var args = args_.join(' ');
Embark.init()
Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig)
Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig)
Embark.geth(env, args);
});
program.command('demo').description('create a working dapp with a SimpleStorage contract').action(function() {
var boilerPath = path.join(__dirname + '/../boilerplate');
var demoPath = path.join(__dirname + '/../demo');
@ -169,4 +181,3 @@ if (!process.argv.slice(2).length) {
}
exit();

View File

@ -57,6 +57,10 @@ Blockchain.prototype.init_command = function() {
return this.generate_basic_command() + "account new ";
}
Blockchain.prototype.geth_command = function(geth_args) {
return this.generate_basic_command() + geth_args;
}
Blockchain.prototype.run_command = function(address, use_tmp) {
var cmd = this.generate_basic_command();
var config = this.config;
@ -116,4 +120,10 @@ Blockchain.prototype.startChain = function(use_tmp) {
exec(this.run_command(address, use_tmp));
}
Blockchain.prototype.execGeth = function(args) {
var cmd = this.geth_command(args);
console.log("executing: " + cmd);
exec(cmd);
}
module.exports = Blockchain

View File

@ -44,8 +44,12 @@ Embark = {
return deploy.generate_abi_file(destFile);
},
geth: function(env, args) {
var chain = new Blockchain(this.blockchainConfig.config(env));
chain.execGeth(args);
},
release: Release
}
module.exports = Embark;