mirror of https://github.com/embarklabs/embark.git
refactor to use commonOptions method
This commit is contained in:
parent
a5bc17f0de
commit
6920ae9481
|
@ -4,48 +4,6 @@ var GethCommands = function(options) {
|
||||||
this.name = "Go-Ethereum (https://github.com/ethereum/go-ethereum)";
|
this.name = "Go-Ethereum (https://github.com/ethereum/go-ethereum)";
|
||||||
};
|
};
|
||||||
|
|
||||||
GethCommands.prototype.initGenesisCommmand = function() {
|
|
||||||
var config = this.config;
|
|
||||||
var cmd = "geth ";
|
|
||||||
|
|
||||||
if (config.networkType === 'testnet') {
|
|
||||||
cmd += "--testnet ";
|
|
||||||
} else if (config.networkType === 'olympic') {
|
|
||||||
cmd += "--olympic ";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.datadir) {
|
|
||||||
cmd += "--datadir=\"" + config.datadir + "\" ";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.genesisBlock) {
|
|
||||||
cmd += "init \"" + config.genesisBlock + "\" ";
|
|
||||||
}
|
|
||||||
|
|
||||||
return cmd;
|
|
||||||
};
|
|
||||||
|
|
||||||
GethCommands.prototype.newAccountCommand = function() {
|
|
||||||
var config = this.config;
|
|
||||||
var cmd = "geth ";
|
|
||||||
|
|
||||||
if (config.networkType === 'testnet') {
|
|
||||||
cmd += "--testnet ";
|
|
||||||
} else if (config.networkType === 'olympic') {
|
|
||||||
cmd += "--olympic ";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.datadir) {
|
|
||||||
cmd += "--datadir=\"" + config.datadir + "\" ";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.account && config.account.password) {
|
|
||||||
cmd += "--password " + config.account.password + " ";
|
|
||||||
}
|
|
||||||
|
|
||||||
return cmd + "account new ";
|
|
||||||
};
|
|
||||||
|
|
||||||
GethCommands.prototype.commonOptions = function() {
|
GethCommands.prototype.commonOptions = function() {
|
||||||
var config = this.config;
|
var config = this.config;
|
||||||
var cmd = "";
|
var cmd = "";
|
||||||
|
@ -69,6 +27,21 @@ GethCommands.prototype.commonOptions = function() {
|
||||||
return cmd;
|
return cmd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GethCommands.prototype.initGenesisCommmand = function() {
|
||||||
|
var config = this.config;
|
||||||
|
var cmd = "geth " + this.commonOptions();
|
||||||
|
|
||||||
|
if (config.genesisBlock) {
|
||||||
|
cmd += "init \"" + config.genesisBlock + "\" ";
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmd;
|
||||||
|
};
|
||||||
|
|
||||||
|
GethCommands.prototype.newAccountCommand = function() {
|
||||||
|
return "geth " + this.commonOptions() + "account new ";
|
||||||
|
};
|
||||||
|
|
||||||
GethCommands.prototype.listAccountsCommand = function() {
|
GethCommands.prototype.listAccountsCommand = function() {
|
||||||
return "geth " + this.commonOptions() + "account list ";
|
return "geth " + this.commonOptions() + "account list ";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue