mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-12 06:44:37 +00:00
Merge pull request #402 from embark-framework/patch/dev_fix
Patch/dev fix
This commit is contained in:
commit
b4345ca2d4
@ -50,12 +50,26 @@ var Blockchain = function(options) {
|
|||||||
this.config.datadir = fs.embarkPath(".embark/development/datadir");
|
this.config.datadir = fs.embarkPath(".embark/development/datadir");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.client = new options.client({config: this.config, env: this.env});
|
if (this.blockchainConfig.isDev) {
|
||||||
|
this.isDev = true;
|
||||||
|
} else if (this.blockchainConfig.isDev === false) {
|
||||||
|
this.isDev = false;
|
||||||
|
} else {
|
||||||
|
this.isDev = this.env === 'development';
|
||||||
|
}
|
||||||
|
|
||||||
|
this.client = new options.client({config: this.config, env: this.env, isDev: this.isDev});
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockchain.prototype.runCommand = function(cmd, options) {
|
Blockchain.prototype.runCommand = function(cmd, options) {
|
||||||
console.log(("running: " + cmd.underline).green);
|
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 has changed to use the --dev option.'.yellow);
|
||||||
|
console.warn('You can reset your workspace to fix the problem with'.yellow + ' embark reset'.cyan);
|
||||||
|
console.warn('Otherwise, you can change your data directory in blockchain.json (datadir)'.yellow);
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockchain.prototype.run = function() {
|
Blockchain.prototype.run = function() {
|
||||||
@ -69,7 +83,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);
|
console.log(("could not find " + this.config.geth_bin + " command; is " + this.client.name + " installed or in the PATH?").green);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var address = this.initChainAndGetAddress();
|
let address = '';
|
||||||
|
if (!this.isDev) {
|
||||||
|
address = this.initChainAndGetAddress();
|
||||||
|
}
|
||||||
this.client.mainCommand(address, function(cmd) {
|
this.client.mainCommand(address, function(cmd) {
|
||||||
self.runCommand(cmd, {async: true});
|
self.runCommand(cmd, {async: true});
|
||||||
});
|
});
|
||||||
|
@ -5,6 +5,7 @@ class GethCommands {
|
|||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.config = options && options.hasOwnProperty('config') ? options.config : {};
|
this.config = options && options.hasOwnProperty('config') ? options.config : {};
|
||||||
this.env = options && options.hasOwnProperty('env') ? options.env : 'development';
|
this.env = options && options.hasOwnProperty('env') ? options.env : 'development';
|
||||||
|
this.isDev = options && options.hasOwnProperty('isDev') ? options.isDev : (this.env === 'development');
|
||||||
this.name = "Go-Ethereum (https://github.com/ethereum/go-ethereum)";
|
this.name = "Go-Ethereum (https://github.com/ethereum/go-ethereum)";
|
||||||
this.geth_bin = this.config.geth_bin || "geth";
|
this.geth_bin = this.config.geth_bin || "geth";
|
||||||
}
|
}
|
||||||
@ -188,7 +189,7 @@ class GethCommands {
|
|||||||
} else {
|
} else {
|
||||||
accountAddress = address;
|
accountAddress = address;
|
||||||
}
|
}
|
||||||
if (accountAddress) {
|
if (accountAddress && !self.isDev) {
|
||||||
return callback(null, "--unlock=" + accountAddress);
|
return callback(null, "--unlock=" + accountAddress);
|
||||||
}
|
}
|
||||||
callback(null, "");
|
callback(null, "");
|
||||||
@ -200,10 +201,16 @@ class GethCommands {
|
|||||||
callback(null, "");
|
callback(null, "");
|
||||||
},
|
},
|
||||||
function mineWhenNeeded(callback) {
|
function mineWhenNeeded(callback) {
|
||||||
if (config.mineWhenNeeded) {
|
if (config.mineWhenNeeded && !self.isDev) {
|
||||||
return callback(null, "js .embark/" + self.env + "/js/mine.js");
|
return callback(null, "js .embark/" + self.env + "/js/mine.js");
|
||||||
}
|
}
|
||||||
callback(null, "");
|
callback(null, "");
|
||||||
|
},
|
||||||
|
function isDev(callback) {
|
||||||
|
if (self.isDev) {
|
||||||
|
return callback(null, '--dev');
|
||||||
|
}
|
||||||
|
callback(null, '');
|
||||||
}
|
}
|
||||||
], function (err, results) {
|
], function (err, results) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "embark",
|
"name": "embark",
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -6056,9 +6056,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
"version": "2.2.4",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.0.tgz",
|
||||||
"integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==",
|
"integrity": "sha512-jWC2Eg+Np4bxah7llu1IrUNSJQxtLz/J+pOjTM0nFpJXGAaV18XBWhUn031Q1tAA/TJtA1jgwnOe9S2PQa4Lbg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "5.1.2",
|
"safe-buffer": "5.1.2",
|
||||||
"yallist": "3.0.2"
|
"yallist": "3.0.2"
|
||||||
@ -6076,7 +6076,7 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"chownr": "1.0.1",
|
"chownr": "1.0.1",
|
||||||
"fs-minipass": "1.2.5",
|
"fs-minipass": "1.2.5",
|
||||||
"minipass": "2.2.4",
|
"minipass": "2.3.0",
|
||||||
"minizlib": "1.1.0",
|
"minizlib": "1.1.0",
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"safe-buffer": "5.1.2",
|
"safe-buffer": "5.1.2",
|
||||||
@ -6974,6 +6974,7 @@
|
|||||||
"version": "1.0.35",
|
"version": "1.0.35",
|
||||||
"resolved": "https://registry.npmjs.org/node-webcrypto-ossl/-/node-webcrypto-ossl-1.0.35.tgz",
|
"resolved": "https://registry.npmjs.org/node-webcrypto-ossl/-/node-webcrypto-ossl-1.0.35.tgz",
|
||||||
"integrity": "sha1-FCJVeb0J9dY7CtbO4LqAD4xqBg0=",
|
"integrity": "sha1-FCJVeb0J9dY7CtbO4LqAD4xqBg0=",
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"nan": "2.9.2",
|
"nan": "2.9.2",
|
||||||
@ -11337,6 +11338,7 @@
|
|||||||
"version": "0.1.19",
|
"version": "0.1.19",
|
||||||
"resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-0.1.19.tgz",
|
"resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-0.1.19.tgz",
|
||||||
"integrity": "sha1-8CTjoCu8oW3tRtJpaMQlNaORJNw=",
|
"integrity": "sha1-8CTjoCu8oW3tRtJpaMQlNaORJNw=",
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "1.9.0"
|
"tslib": "1.9.0"
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "config/development/genesis.json",
|
"genesisBlock": "config/development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
"isDev": true,
|
||||||
"mineWhenNeeded": true,
|
"mineWhenNeeded": true,
|
||||||
"nodiscover": true,
|
"nodiscover": true,
|
||||||
"maxpeers": 0,
|
"maxpeers": 0,
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "config/development/genesis.json",
|
"genesisBlock": "config/development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
"isDev": true,
|
||||||
"mineWhenNeeded": true,
|
"mineWhenNeeded": true,
|
||||||
"nodiscover": true,
|
"nodiscover": true,
|
||||||
"maxpeers": 0,
|
"maxpeers": 0,
|
||||||
|
File diff suppressed because one or more lines are too long
@ -22,6 +22,7 @@ describe('embark.Config', function () {
|
|||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "config/development/genesis.json",
|
"genesisBlock": "config/development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
"isDev": true,
|
||||||
"mineWhenNeeded": true,
|
"mineWhenNeeded": true,
|
||||||
"nodiscover": true,
|
"nodiscover": true,
|
||||||
"rpcHost": "localhost",
|
"rpcHost": "localhost",
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "config/development/genesis.json",
|
"genesisBlock": "config/development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
"isDev": true,
|
||||||
"mineWhenNeeded": true,
|
"mineWhenNeeded": true,
|
||||||
"nodiscover": true,
|
"nodiscover": true,
|
||||||
"rpcHost": "localhost",
|
"rpcHost": "localhost",
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "development/genesis.json",
|
"genesisBlock": "development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
"isDev": true,
|
||||||
"mineWhenNeeded": true,
|
"mineWhenNeeded": true,
|
||||||
"nodiscover": true,
|
"nodiscover": true,
|
||||||
"maxpeers": 0,
|
"maxpeers": 0,
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "config/development/genesis.json",
|
"genesisBlock": "config/development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
"isDev": true,
|
||||||
"mineWhenNeeded": true,
|
"mineWhenNeeded": true,
|
||||||
"nodiscover": true,
|
"nodiscover": true,
|
||||||
"maxpeers": 0,
|
"maxpeers": 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user