mirror of https://github.com/embarklabs/embark.git
conflict in en.json
This commit is contained in:
parent
7f45b6724a
commit
e69b8bab56
|
@ -94,6 +94,7 @@ class Cmd {
|
||||||
.command('build [environment]')
|
.command('build [environment]')
|
||||||
.option('--contracts', 'only compile contracts into Embark wrappers')
|
.option('--contracts', 'only compile contracts into Embark wrappers')
|
||||||
.option('--logfile [logfile]', __('filename to output logs (default: none)'))
|
.option('--logfile [logfile]', __('filename to output logs (default: none)'))
|
||||||
|
.option('-c, --client [client]', __('Use a specific ethereum client or simulator (supported: %s)', 'geth, testrpc'))
|
||||||
.option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug')
|
.option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug')
|
||||||
.option('--locale [locale]', __('language to use (default: en)'))
|
.option('--locale [locale]', __('language to use (default: en)'))
|
||||||
.description(__('deploy and build dapp at ') + 'dist/ (default: development)')
|
.description(__('deploy and build dapp at ') + 'dist/ (default: development)')
|
||||||
|
@ -103,6 +104,7 @@ class Cmd {
|
||||||
_options.logFile = _options.logfile; // fix casing
|
_options.logFile = _options.logfile; // fix casing
|
||||||
_options.logLevel = _options.loglevel; // fix casing
|
_options.logLevel = _options.loglevel; // fix casing
|
||||||
_options.onlyCompile = _options.contracts;
|
_options.onlyCompile = _options.contracts;
|
||||||
|
_options.client = _options.client || 'geth';
|
||||||
embark.build(_options);
|
embark.build(_options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
"blockchain": {
|
"blockchain": {
|
||||||
"blockchainReady": "blockchainReady",
|
"blockchainReady": "blockchainReady",
|
||||||
"init": "init",
|
"init": "init",
|
||||||
"initiated": "initiated"
|
"initiated": "initiated",
|
||||||
|
"engineReady": "engineReady"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ const ProcessLauncher = require('../process/processLauncher');
|
||||||
const utils = require('../utils/utils');
|
const utils = require('../utils/utils');
|
||||||
const constants = require('../constants');
|
const constants = require('../constants');
|
||||||
|
|
||||||
|
const STARTING_BLOCKCHAIN = 'startBlockchain';
|
||||||
|
|
||||||
class Engine {
|
class Engine {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.env = options.env;
|
this.env = options.env;
|
||||||
|
@ -254,7 +256,7 @@ class Engine {
|
||||||
});
|
});
|
||||||
if (!options.web3) {
|
if (!options.web3) {
|
||||||
// Web3 object might have been modified
|
// Web3 object might have been modified
|
||||||
self.events.once('engine-ready', () => {
|
self.onReady(() => {
|
||||||
self.deployManager.web3 = self.web3;
|
self.deployManager.web3 = self.web3;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -311,6 +313,77 @@ class Engine {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onReady(callback) {
|
||||||
|
if (this.isReady) {
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
this.events.once(constants.blockchain.engineReady, () => {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
checkWeb3Status(web3Endpoint, callback) {
|
||||||
|
const self = this;
|
||||||
|
const NO_NODE = 'noNode';
|
||||||
|
const noNodeObj = {name: __("No Blockchain node found"), status: 'off'};
|
||||||
|
async.waterfall([
|
||||||
|
function checkCurrentProvider(next) {
|
||||||
|
if (self.web3.currentProvider === undefined) {
|
||||||
|
return next(NO_NODE);
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
},
|
||||||
|
function pingWeb3Endpoint(next) {
|
||||||
|
// FIXME: this is needed currently because the provider (MetaMask/provider-engine) doesn't callback when there is no node
|
||||||
|
request.get(web3Endpoint, function (err, _response, _body) {
|
||||||
|
if (err) {
|
||||||
|
return next(NO_NODE);
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function checkAccount(next) {
|
||||||
|
self.web3.eth.getAccounts(function(err, _accounts) {
|
||||||
|
if (err) {
|
||||||
|
return next(NO_NODE);
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function getWeb3ClientVersion(next) {
|
||||||
|
// TODO: web3_clientVersion method is currently not implemented in web3.js 1.0
|
||||||
|
self.web3._requestManager.send({method: 'web3_clientVersion', params: []}, (err, version) => {
|
||||||
|
if (err) {
|
||||||
|
return next({name: __("Ethereum node (version unknown)"), status: 'on'});
|
||||||
|
}
|
||||||
|
if (version.indexOf("/") < 0) {
|
||||||
|
return next({name: version, status: 'on'});
|
||||||
|
}
|
||||||
|
let nodeName = version.split("/")[0];
|
||||||
|
let versionNumber = version.split("/")[1].split("-")[0];
|
||||||
|
let name = nodeName + " " + versionNumber + " (Ethereum)";
|
||||||
|
|
||||||
|
return next({name: name, status: 'on'});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
], (msg) => {
|
||||||
|
if (msg === NO_NODE) {
|
||||||
|
if (self.isRunningBlockchain) {
|
||||||
|
return callback(noNodeObj);
|
||||||
|
}
|
||||||
|
// Start blockchain node ourselves
|
||||||
|
self.stopWeb3Service();
|
||||||
|
self.startBlockchainNode();
|
||||||
|
return callback(STARTING_BLOCKCHAIN);
|
||||||
|
}
|
||||||
|
if (!self.isReady) {
|
||||||
|
self.isReady = true;
|
||||||
|
self.events.emit(constants.blockchain.engineReady);
|
||||||
|
}
|
||||||
|
callback(msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
web3Service(options) {
|
web3Service(options) {
|
||||||
this.blockchain = new Blockchain({
|
this.blockchain = new Blockchain({
|
||||||
contractsConfig: this.config.contractsConfig,
|
contractsConfig: this.config.contractsConfig,
|
||||||
|
|
|
@ -151,7 +151,7 @@ class Embark {
|
||||||
engine.logger.info(__("Ready").underline);
|
engine.logger.info(__("Ready").underline);
|
||||||
engine.events.emit("status", __("Ready").green);
|
engine.events.emit("status", __("Ready").green);
|
||||||
});
|
});
|
||||||
engine.events.once('engine-ready', function () {
|
engine.onReady(() => {
|
||||||
engine.deployManager.deployContracts(function (err) {
|
engine.deployManager.deployContracts(function (err) {
|
||||||
engine.startService("fileWatcher");
|
engine.startService("fileWatcher");
|
||||||
if (options.runWebserver) {
|
if (options.runWebserver) {
|
||||||
|
@ -184,6 +184,8 @@ class Embark {
|
||||||
|
|
||||||
let engine = new Engine({
|
let engine = new Engine({
|
||||||
env: options.env,
|
env: options.env,
|
||||||
|
client: options.client,
|
||||||
|
locale: options.locale,
|
||||||
isDev: this.isDev(options.env),
|
isDev: this.isDev(options.env),
|
||||||
version: this.version,
|
version: this.version,
|
||||||
embarkConfig: 'embark.json',
|
embarkConfig: 'embark.json',
|
||||||
|
@ -217,7 +219,7 @@ class Embark {
|
||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
function deploy(callback) {
|
function deploy(callback) {
|
||||||
engine.events.once('engine-ready', function () {
|
engine.onReady(() => {
|
||||||
engine.deployManager.deployContracts(function (err) {
|
engine.deployManager.deployContracts(function (err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue