mirror of https://github.com/embarklabs/embark.git
use --dev when in development
This commit is contained in:
parent
edbc77afca
commit
46e1ccd81b
|
@ -55,7 +55,12 @@ var Blockchain = function(options) {
|
|||
|
||||
Blockchain.prototype.runCommand = function(cmd, options) {
|
||||
console.log(("running: " + cmd.underline).green);
|
||||
return shelljs.exec(cmd, options);
|
||||
return shelljs.exec(cmd, options, (err, stdout, _stderr) => {
|
||||
if (err && this.env === 'development' && stdout.indexOf('Failed to unlock developer account') > 0) {
|
||||
console.warn('\nDevelopment blockchain changed to use the --dev option.'.yellow);
|
||||
console.warn('You will need to change your data directory in blockchain.json (datadir)'.yellow);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Blockchain.prototype.run = function() {
|
||||
|
@ -69,7 +74,10 @@ Blockchain.prototype.run = function() {
|
|||
console.log(("could not find " + this.config.geth_bin + " command; is " + this.client.name + " installed or in the PATH?").green);
|
||||
return;
|
||||
}
|
||||
var address = this.initChainAndGetAddress();
|
||||
let address = '';
|
||||
if (self.env !== "development") {
|
||||
address = this.initChainAndGetAddress();
|
||||
}
|
||||
this.client.mainCommand(address, function(cmd) {
|
||||
self.runCommand(cmd, {async: true});
|
||||
});
|
||||
|
|
|
@ -123,6 +123,7 @@ class GethCommands {
|
|||
let config = this.config;
|
||||
let rpc_api = (this.config.rpcApi || ['eth', 'web3', 'net']);
|
||||
let ws_api = (this.config.wsApi || ['eth', 'web3', 'net']);
|
||||
const isDev = self.env === 'development';
|
||||
|
||||
async.series([
|
||||
function commonOptions(callback) {
|
||||
|
@ -188,7 +189,7 @@ class GethCommands {
|
|||
} else {
|
||||
accountAddress = address;
|
||||
}
|
||||
if (accountAddress) {
|
||||
if (accountAddress && !isDev) {
|
||||
return callback(null, "--unlock=" + accountAddress);
|
||||
}
|
||||
callback(null, "");
|
||||
|
@ -200,10 +201,16 @@ class GethCommands {
|
|||
callback(null, "");
|
||||
},
|
||||
function mineWhenNeeded(callback) {
|
||||
if (config.mineWhenNeeded) {
|
||||
if (config.mineWhenNeeded && !isDev) {
|
||||
return callback(null, "js .embark/" + self.env + "/js/mine.js");
|
||||
}
|
||||
callback(null, "");
|
||||
},
|
||||
function isDev(callback) {
|
||||
if (isDev) {
|
||||
return callback(null, '--dev');
|
||||
}
|
||||
callback(null, '');
|
||||
}
|
||||
], function (err, results) {
|
||||
if (err) {
|
||||
|
|
Loading…
Reference in New Issue