mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-20 01:18:52 +00:00
cleanup code from linter feedback
This commit is contained in:
parent
65f6827b05
commit
fbe3f302b2
@ -58,7 +58,7 @@ run () {
|
|||||||
this.client.mainCommand(address, function(cmd) {
|
this.client.mainCommand(address, function(cmd) {
|
||||||
shelljs.exec(cmd, {async : true});
|
shelljs.exec(cmd, {async : true});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
initChainAndGetAddress() {
|
initChainAndGetAddress() {
|
||||||
let address = null, result;
|
let address = null, result;
|
||||||
|
@ -102,7 +102,7 @@ class Compiler {
|
|||||||
], function (err, result) {
|
], function (err, result) {
|
||||||
cb(err, result);
|
cb(err, result);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Compiler;
|
module.exports = Compiler;
|
||||||
|
@ -162,7 +162,7 @@ class Deploy {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Deploy;
|
module.exports = Deploy;
|
||||||
|
@ -8,7 +8,7 @@ let DeployManager = require('../contracts/deploy_manager.js');
|
|||||||
let ABIGenerator = require('../contracts/abi.js');
|
let ABIGenerator = require('../contracts/abi.js');
|
||||||
let ServicesMonitor = require('./services_monitor.js');
|
let ServicesMonitor = require('./services_monitor.js');
|
||||||
let Pipeline = require('../pipeline/pipeline.js');
|
let Pipeline = require('../pipeline/pipeline.js');
|
||||||
let Serve = require('../pipeline/server.js');
|
let Server = require('../pipeline/server.js');
|
||||||
let Watch = require('../pipeline/watch.js');
|
let Watch = require('../pipeline/watch.js');
|
||||||
let version = require('../../package.json');
|
let version = require('../../package.json');
|
||||||
|
|
||||||
@ -19,9 +19,8 @@ class Engine {
|
|||||||
this.interceptLogs = options.interceptLogs;
|
this.interceptLogs = options.interceptLogs;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Engine.prototype.init = function (_options) {
|
init(_options) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let options = _options || {};
|
let options = _options || {};
|
||||||
this.events = new Events();
|
this.events = new Events();
|
||||||
@ -34,9 +33,9 @@ Engine.prototype.init = function (_options) {
|
|||||||
this.servicesMonitor.addCheck('embarkVersion', function (cb) {
|
this.servicesMonitor.addCheck('embarkVersion', function (cb) {
|
||||||
return cb({name: 'Embark ' + self.version, status: 'green'});
|
return cb({name: 'Embark ' + self.version, status: 'green'});
|
||||||
}, 0);
|
}, 0);
|
||||||
};
|
}
|
||||||
|
|
||||||
Engine.prototype.startMonitor = function () {
|
startMonitor() {
|
||||||
let self = this;
|
let self = this;
|
||||||
if (this.plugins) {
|
if (this.plugins) {
|
||||||
let servicePlugins = this.plugins.getPluginsFor('serviceChecks');
|
let servicePlugins = this.plugins.getPluginsFor('serviceChecks');
|
||||||
@ -47,9 +46,9 @@ Engine.prototype.startMonitor = function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.servicesMonitor.startMonitor();
|
this.servicesMonitor.startMonitor();
|
||||||
};
|
}
|
||||||
|
|
||||||
Engine.prototype.startService = function (serviceName, _options) {
|
startService(serviceName, _options) {
|
||||||
let options = _options || {};
|
let options = _options || {};
|
||||||
|
|
||||||
let services = {
|
let services = {
|
||||||
@ -71,9 +70,9 @@ Engine.prototype.startService = function (serviceName, _options) {
|
|||||||
// need to be careful with circular references due to passing the web3 object
|
// need to be careful with circular references due to passing the web3 object
|
||||||
//this.logger.trace("calling: " + serviceName + "(" + JSON.stringify(options) + ")");
|
//this.logger.trace("calling: " + serviceName + "(" + JSON.stringify(options) + ")");
|
||||||
return service.apply(this, [options]);
|
return service.apply(this, [options]);
|
||||||
};
|
}
|
||||||
|
|
||||||
Engine.prototype.pipelineService = function (options) {
|
pipelineService(options) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.logger.setStatus("Building Assets");
|
this.logger.setStatus("Building Assets");
|
||||||
let pipeline = new Pipeline({
|
let pipeline = new Pipeline({
|
||||||
@ -97,9 +96,9 @@ Engine.prototype.pipelineService = function (options) {
|
|||||||
// self.events.emit('outputDone');
|
// self.events.emit('outputDone');
|
||||||
// }
|
// }
|
||||||
//});
|
//});
|
||||||
};
|
}
|
||||||
|
|
||||||
Engine.prototype.abiService = function (options) {
|
abiService(options) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let generateABICode = function (contractsManager) {
|
let generateABICode = function (contractsManager) {
|
||||||
let abiGenerator = new ABIGenerator({
|
let abiGenerator = new ABIGenerator({
|
||||||
@ -119,9 +118,9 @@ Engine.prototype.abiService = function (options) {
|
|||||||
};
|
};
|
||||||
this.events.on('contractsDeployed', generateABICode);
|
this.events.on('contractsDeployed', generateABICode);
|
||||||
this.events.on('blockchainDisabled', generateABICode);
|
this.events.on('blockchainDisabled', generateABICode);
|
||||||
};
|
}
|
||||||
|
|
||||||
Engine.prototype.deploymentService = function (options) {
|
deploymentService(options) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.deployManager = new DeployManager({
|
this.deployManager = new DeployManager({
|
||||||
web3: options.web3 || self.web3,
|
web3: options.web3 || self.web3,
|
||||||
@ -141,15 +140,15 @@ Engine.prototype.deploymentService = function (options) {
|
|||||||
});
|
});
|
||||||
//}
|
//}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
Engine.prototype.fileWatchService = function (options) {
|
fileWatchService(options) {
|
||||||
this.logger.setStatus("Watching for changes");
|
this.logger.setStatus("Watching for changes");
|
||||||
let watch = new Watch({logger: this.logger, events: this.events});
|
let watch = new Watch({logger: this.logger, events: this.events});
|
||||||
watch.start();
|
watch.start();
|
||||||
};
|
}
|
||||||
|
|
||||||
Engine.prototype.webServerService = function (options) {
|
webServerService(options) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let webServerConfig = this.config.webServerConfig;
|
let webServerConfig = this.config.webServerConfig;
|
||||||
if (!webServerConfig.enabled) {
|
if (!webServerConfig.enabled) {
|
||||||
@ -173,9 +172,9 @@ Engine.prototype.webServerService = function (options) {
|
|||||||
|
|
||||||
server.start(function () {
|
server.start(function () {
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
Engine.prototype.ipfsService = function (options) {
|
ipfsService(options) {
|
||||||
let self = this;
|
let self = this;
|
||||||
self.servicesMonitor.addCheck('IPFS', function (cb) {
|
self.servicesMonitor.addCheck('IPFS', function (cb) {
|
||||||
utils.checkIsAvailable('http://localhost:5001', function (available) {
|
utils.checkIsAvailable('http://localhost:5001', function (available) {
|
||||||
@ -213,9 +212,9 @@ Engine.prototype.ipfsService = function (options) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
Engine.prototype.web3Service = function (options) {
|
web3Service(options) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.web3 = options.web3;
|
this.web3 = options.web3;
|
||||||
if (this.web3 === undefined) {
|
if (this.web3 === undefined) {
|
||||||
@ -244,7 +243,7 @@ Engine.prototype.web3Service = function (options) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = Engine;
|
module.exports = Engine;
|
||||||
|
@ -13,7 +13,6 @@ class ServicesMonitor {
|
|||||||
this.working = false;
|
this.working = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
|
||||||
|
|
||||||
ServicesMonitor.prototype.initCheck = function (checkName) {
|
ServicesMonitor.prototype.initCheck = function (checkName) {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
@ -20,17 +20,17 @@ let getSimulator = function () {
|
|||||||
|
|
||||||
class Test {
|
class Test {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
let opts = options === undefined ? {} : options;
|
this.opts = options === undefined ? {} : options;
|
||||||
opts.logLevel = opts.hasOwnProperty('logLevel') ? opts.logLevel : 'debug';
|
this.opts.logLevel = this.opts.hasOwnProperty('logLevel') ? this.opts.logLevel : 'debug';
|
||||||
opts.simulatorOptions = opts.hasOwnProperty('simulatorOptions') ? opts.simulatorOptions : {};
|
this.opts.simulatorOptions = this.opts.hasOwnProperty('simulatorOptions') ? this.opts.simulatorOptions : {};
|
||||||
let sim = getSimulator();
|
this.sim = getSimulator();
|
||||||
}
|
}
|
||||||
|
|
||||||
newWebThree() {
|
newWebThree() {
|
||||||
try {
|
try {
|
||||||
let Web3 = require('web3');
|
let Web3 = require('web3');
|
||||||
let web3 = new Web3();
|
let web3 = new Web3();
|
||||||
web3.setProvider(sim.provider(opts.simulatorOptions));
|
web3.setProvider(this.sim.provider(this.opts.simulatorOptions));
|
||||||
return web3;
|
return web3;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e);
|
throw new Error(e);
|
||||||
|
@ -104,7 +104,7 @@ class Embark {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
engine.deployManager.deployContracts(function () {
|
engine.deployManager.deployContracts(function (err) {
|
||||||
engine.startService("fileWatcher");
|
engine.startService("fileWatcher");
|
||||||
if (options.runWebserver) {
|
if (options.runWebserver) {
|
||||||
engine.startService("webServer", {
|
engine.startService("webServer", {
|
||||||
@ -166,12 +166,12 @@ class Embark {
|
|||||||
// needed due to child processes
|
// needed due to child processes
|
||||||
process.exit();
|
process.exit();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
this.initTests = function () {
|
this.initTests = function () {
|
||||||
let Test = require('./core/test.js');
|
let Test = require('./core/test.js');
|
||||||
return new Test(options);
|
return new Test(options);
|
||||||
}
|
};
|
||||||
|
|
||||||
// TODO: should deploy if it hasn't already
|
// TODO: should deploy if it hasn't already
|
||||||
this.upload = function (platform) {
|
this.upload = function (platform) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user