mirror of https://github.com/embarklabs/embark.git
update to fix tests
This commit is contained in:
parent
69bb03d56d
commit
a38428f762
|
@ -99,7 +99,7 @@ class Engine {
|
|||
|
||||
processManagerService(_options) {
|
||||
const ProcessManager = require('../processes/processManager.js');
|
||||
const processManager = new ProcessManager({
|
||||
this.processManager = new ProcessManager({
|
||||
events: this.events,
|
||||
logger: this.logger,
|
||||
plugins: this.plugins
|
||||
|
|
|
@ -6,7 +6,6 @@ const BlockchainProcessLauncher = require('./blockchainProcessLauncher');
|
|||
class BlockchainModule {
|
||||
|
||||
constructor(embark, options) {
|
||||
const self = this;
|
||||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
this.blockchainConfig = embark.config.blockchainConfig;
|
||||
|
@ -41,14 +40,12 @@ class BlockchainModule {
|
|||
cb = noLogs;
|
||||
noLogs = false;
|
||||
}
|
||||
const NO_NODE_ERROR = Error("error connecting to blockchain node");
|
||||
const self = this;
|
||||
|
||||
async.waterfall([
|
||||
// check if web3 is set
|
||||
//
|
||||
function checkWeb3State(next) {
|
||||
console.dir("checkWeb3State");
|
||||
self.events.request("blockchain:web3:isReady", (connected) => {
|
||||
console.dir("---> checking web3 state");
|
||||
console.dir(connected.toString());
|
||||
|
@ -56,44 +53,20 @@ class BlockchainModule {
|
|||
return next(connected);
|
||||
}
|
||||
next();
|
||||
})
|
||||
});
|
||||
},
|
||||
//function checkInstance(next) {
|
||||
// if (!self.web3) {
|
||||
// return next(Error("no web3 instance found"));
|
||||
// }
|
||||
// next();
|
||||
//},
|
||||
//function checkProvider(next) {
|
||||
// if (self.web3.currentProvider === undefined) {
|
||||
// return next(NO_NODE_ERROR);
|
||||
// }
|
||||
// next();
|
||||
//},
|
||||
function pingEndpoint(next) {
|
||||
console.dir("pingEndpoint");
|
||||
if (!self.contractsConfig || !self.contractsConfig.deployment || !self.contractsConfig.deployment.host) {
|
||||
return next();
|
||||
}
|
||||
const {host, port, type, protocol} = self.contractsConfig.deployment;
|
||||
console.dir("||||| pinging: ");
|
||||
console.dir(self.contractsConfig.deployment);
|
||||
utils.pingEndpoint(host, port, type, protocol, self.blockchainConfig.wsOrigins.split(',')[0], next);
|
||||
}
|
||||
], function (err, result) {
|
||||
console.dir("------");
|
||||
console.dir(result);
|
||||
console.dir("------");
|
||||
], function (err, _result) {
|
||||
if (err === true || err === undefined) {
|
||||
return cb(true);
|
||||
}
|
||||
return cb(false);
|
||||
|
||||
//if (!noLogs && err === NO_NODE_ERROR) {
|
||||
// self.logger.error(("Couldn't connect to an Ethereum node are you sure it's on?").red);
|
||||
// self.logger.info("make sure you have an Ethereum node or simulator running. e.g 'embark blockchain'".magenta);
|
||||
//}
|
||||
//cb(err);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ const {canonicalHost} = require('../../utils/host');
|
|||
let References = {
|
||||
ipfs: 'https://ipfs.io/docs/install/',
|
||||
swarm: 'http://swarm-guide.readthedocs.io/en/latest/installation.html'
|
||||
}
|
||||
};
|
||||
|
||||
class StorageProcessesLauncher {
|
||||
constructor(options) {
|
||||
|
|
|
@ -8,29 +8,25 @@ class ProcessManager {
|
|||
this.processes = {};
|
||||
|
||||
self.events.setCommandHandler('processes:register', (name, cb) => {
|
||||
console.dir("=====> registering " + name);
|
||||
this.processes[name] = {
|
||||
state: 'unstarted',
|
||||
cb: cb
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
self.events.setCommandHandler('processes:launch', (name, cb) => {
|
||||
let process = self.processes[name];
|
||||
// TODO: should make distinction between starting and running
|
||||
if (process.state != 'unstarted') {
|
||||
console.dir("=====> already started " + name);
|
||||
return cb();
|
||||
}
|
||||
console.dir("=====> launching " + name);
|
||||
process.state = 'starting';
|
||||
//let pry = require('pryjs');
|
||||
//eval(pry.it);
|
||||
process.cb.apply(process.cb, [() => {
|
||||
process.state = 'running';
|
||||
console.dir("=====> launched " + name);
|
||||
cb();
|
||||
}]);
|
||||
process.cb.apply(process.cb, [
|
||||
() => {
|
||||
process.state = 'running';
|
||||
cb();
|
||||
}
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*globals describe, it*/
|
||||
const Blockchain = require('../lib/cmds/blockchain/blockchain');
|
||||
const Blockchain = require('../lib/modules/blockchain_process/blockchain.js');
|
||||
const constants = require('../lib/constants.json');
|
||||
const {defaultHost} = require('../lib/utils/host');
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*globals describe, it*/
|
||||
let ContractsManager = require('../lib/contracts/contracts.js');
|
||||
let Compiler = require('../lib/contracts/compiler.js');
|
||||
let Compiler = require('../lib/modules/compiler/');
|
||||
let Logger = require('../lib/core/logger.js');
|
||||
let File = require('../lib/core/file.js');
|
||||
let TestLogger = require('../lib/tests/test_logger.js');
|
||||
|
@ -37,11 +37,11 @@ describe('embark.Contracts', function() {
|
|||
});
|
||||
plugins.loadInternalPlugin('solidity', {ipc: ipcObject});
|
||||
|
||||
let compiler = new Compiler({plugins: plugins, logger: plugins.logger});
|
||||
let events = new Events();
|
||||
events.setCommandHandler("compiler:contracts", function(contractFiles, cb) {
|
||||
compiler.compile_contracts(contractFiles, cb);
|
||||
});
|
||||
let compiler = new Compiler({events: events, logger: plugins.logger}, {plugins: plugins});
|
||||
//events.setCommandHandler("compiler:contracts", function(contractFiles, cb) {
|
||||
// compiler.compile_contracts(contractFiles, cb);
|
||||
//});
|
||||
|
||||
events.setCommandHandler("config:contractsConfig", function(cb) {
|
||||
cb(contractsConfig);
|
||||
|
@ -146,11 +146,8 @@ describe('embark.Contracts', function() {
|
|||
});
|
||||
plugins.loadInternalPlugin('solidity', {ipc: ipcObject});
|
||||
|
||||
let compiler = new Compiler({plugins: plugins, logger: plugins.logger});
|
||||
let events = new Events();
|
||||
events.setCommandHandler("compiler:contracts", function(contractFiles, cb) {
|
||||
compiler.compile_contracts(contractFiles, cb);
|
||||
});
|
||||
let compiler = new Compiler({events: events, logger: plugins.logger}, {plugins: plugins});
|
||||
|
||||
events.setCommandHandler("config:contractsConfig", function(cb) {
|
||||
cb(contractsConfig);
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
const assert = require('assert');
|
||||
const sinon = require('sinon');
|
||||
const TestLogger = require('../lib/tests/test_logger');
|
||||
const ProcessLauncher = require('../lib/process/processLauncher');
|
||||
const path = require('path');
|
||||
const ProcessLauncher = require('../lib/processes/processLauncher');
|
||||
|
||||
describe('ProcessWrapper', () => {
|
||||
let processLauncher;
|
||||
|
|
Loading…
Reference in New Issue