Skip to content

Commit d2489f0

Browse files
authored
Merge pull request #557 from embark-framework/bug_fix/hanging-graph
Fix hanging embark graph by starting web3 service
2 parents b363873 + 01277f6 commit d2489f0

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

lib/index.js

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ require('colors');
66
// Override process.chdir so that we have a partial-implementation PWD for Windows
77
const realChdir = process.chdir;
88
process.chdir = (...args) => {
9-
if (!process.env.PWD) {
10-
process.env.PWD = process.cwd();
11-
}
12-
realChdir(...args);
9+
if (!process.env.PWD) {
10+
process.env.PWD = process.cwd();
11+
}
12+
realChdir(...args);
1313
};
1414

1515
let version = require('../package.json').version;
1616

1717
class Embark {
1818

19-
constructor (options) {
19+
constructor(options) {
2020
this.version = version;
2121
this.options = options || {};
2222
}
@@ -52,7 +52,7 @@ class Embark {
5252
this.context = options.context || [constants.contexts.simulator, constants.contexts.blockchain];
5353
let Simulator = require('./cmds/simulator.js');
5454
let simulator = new Simulator({
55-
blockchainConfig: this.config.blockchainConfig,
55+
blockchainConfig: this.config.blockchainConfig,
5656
logger: this.logger
5757
});
5858
simulator.run(options);
@@ -129,7 +129,7 @@ class Embark {
129129
engine.events.on('check:backOnline:Ethereum', function () {
130130
engine.logger.info(__('Ethereum node detected') + '..');
131131
engine.config.reloadConfig();
132-
engine.events.request('deploy:contracts', function(err) {
132+
engine.events.request('deploy:contracts', function (err) {
133133
if (err) {
134134
return;
135135
}
@@ -201,7 +201,7 @@ class Embark {
201201
callback();
202202
},
203203
function deploy(callback) {
204-
engine.events.request('deploy:contracts', function(err) {
204+
engine.events.request('deploy:contracts', function (err) {
205205
callback(err);
206206
});
207207
},
@@ -227,7 +227,7 @@ class Embark {
227227
graph(options) {
228228
this.context = options.context || [constants.contexts.graph];
229229
options.onlyCompile = true;
230-
230+
231231
const Engine = require('./core/engine.js');
232232
const engine = new Engine({
233233
env: options.env,
@@ -239,8 +239,7 @@ class Embark {
239239
});
240240
engine.init();
241241

242-
async.parallel([
243-
242+
async.waterfall([
244243
function (callback) {
245244
let pluginList = engine.plugins.listPlugins();
246245
if (pluginList.length > 0) {
@@ -251,14 +250,12 @@ class Embark {
251250
engine.startService("libraryManager");
252251
engine.startService("pipeline");
253252
engine.startService("deployment", {onlyCompile: true});
254-
253+
engine.startService("web3");
255254
engine.startService("codeGenerator");
256255

257-
engine.events.request('deploy:contracts', function(err) {
258-
callback(err);
259-
});
256+
engine.events.request('deploy:contracts', callback);
260257
}
261-
], (err, _result) => {
258+
], (err) => {
262259
if (err) {
263260
engine.logger.error(err.message);
264261
engine.logger.info(err.stack);
@@ -320,7 +317,7 @@ class Embark {
320317
engine.startService("codeGenerator");
321318
callback();
322319
},
323-
function setupStoragePlugin(callback){
320+
function setupStoragePlugin(callback) {
324321
let pluginList = engine.plugins.listPlugins();
325322
if (pluginList.length > 0) {
326323
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
@@ -344,15 +341,15 @@ class Embark {
344341
function deploy(callback) {
345342
engine.events.on('outputDone', function () {
346343
cmdPlugin.uploadCmds[0].cb()
347-
.then((success) => {
348-
callback(null, success);
349-
})
350-
.catch(callback);
344+
.then((success) => {
345+
callback(null, success);
346+
})
347+
.catch(callback);
351348
});
352349

353-
engine.events.request('deploy:contracts', function(err) {
350+
engine.events.request('deploy:contracts', function (err) {
354351
engine.logger.info(__("finished deploying").underline);
355-
if(err){
352+
if (err) {
356353
callback(err);
357354
}
358355
});

0 commit comments

Comments
 (0)