cleanup code from linter feedback

This commit is contained in:
Todd Baur 2017-03-30 20:38:14 +09:00
parent 65f6827b05
commit fbe3f302b2
7 changed files with 237 additions and 239 deletions

View File

@ -58,7 +58,7 @@ run () {
this.client.mainCommand(address, function(cmd) {
shelljs.exec(cmd, {async : true});
});
};
}
initChainAndGetAddress() {
let address = null, result;

View File

@ -102,7 +102,7 @@ class Compiler {
], function (err, result) {
cb(err, result);
});
};
}
}
module.exports = Compiler;

View File

@ -162,7 +162,7 @@ class Deploy {
}
);
};
}
}
module.exports = Deploy;

View File

@ -8,7 +8,7 @@ let DeployManager = require('../contracts/deploy_manager.js');
let ABIGenerator = require('../contracts/abi.js');
let ServicesMonitor = require('./services_monitor.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 version = require('../../package.json');
@ -19,9 +19,8 @@ class Engine {
this.interceptLogs = options.interceptLogs;
this.version = version;
}
}
Engine.prototype.init = function (_options) {
init(_options) {
let self = this;
let options = _options || {};
this.events = new Events();
@ -34,9 +33,9 @@ Engine.prototype.init = function (_options) {
this.servicesMonitor.addCheck('embarkVersion', function (cb) {
return cb({name: 'Embark ' + self.version, status: 'green'});
}, 0);
};
}
Engine.prototype.startMonitor = function () {
startMonitor() {
let self = this;
if (this.plugins) {
let servicePlugins = this.plugins.getPluginsFor('serviceChecks');
@ -47,9 +46,9 @@ Engine.prototype.startMonitor = function () {
});
}
this.servicesMonitor.startMonitor();
};
}
Engine.prototype.startService = function (serviceName, _options) {
startService(serviceName, _options) {
let options = _options || {};
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
//this.logger.trace("calling: " + serviceName + "(" + JSON.stringify(options) + ")");
return service.apply(this, [options]);
};
}
Engine.prototype.pipelineService = function (options) {
pipelineService(options) {
let self = this;
this.logger.setStatus("Building Assets");
let pipeline = new Pipeline({
@ -97,9 +96,9 @@ Engine.prototype.pipelineService = function (options) {
// self.events.emit('outputDone');
// }
//});
};
}
Engine.prototype.abiService = function (options) {
abiService(options) {
let self = this;
let generateABICode = function (contractsManager) {
let abiGenerator = new ABIGenerator({
@ -119,9 +118,9 @@ Engine.prototype.abiService = function (options) {
};
this.events.on('contractsDeployed', generateABICode);
this.events.on('blockchainDisabled', generateABICode);
};
}
Engine.prototype.deploymentService = function (options) {
deploymentService(options) {
let self = this;
this.deployManager = new DeployManager({
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");
let watch = new Watch({logger: this.logger, events: this.events});
watch.start();
};
}
Engine.prototype.webServerService = function (options) {
webServerService(options) {
let self = this;
let webServerConfig = this.config.webServerConfig;
if (!webServerConfig.enabled) {
@ -173,9 +172,9 @@ Engine.prototype.webServerService = function (options) {
server.start(function () {
});
};
}
Engine.prototype.ipfsService = function (options) {
ipfsService(options) {
let self = this;
self.servicesMonitor.addCheck('IPFS', function (cb) {
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;
this.web3 = options.web3;
if (this.web3 === undefined) {
@ -244,7 +243,7 @@ Engine.prototype.web3Service = function (options) {
}
});
});
};
}
}
module.exports = Engine;

View File

@ -13,7 +13,6 @@ class ServicesMonitor {
this.working = false;
}
}
;
ServicesMonitor.prototype.initCheck = function (checkName) {
let self = this;

View File

@ -20,17 +20,17 @@ let getSimulator = function () {
class Test {
constructor(options) {
let opts = options === undefined ? {} : options;
opts.logLevel = opts.hasOwnProperty('logLevel') ? opts.logLevel : 'debug';
opts.simulatorOptions = opts.hasOwnProperty('simulatorOptions') ? opts.simulatorOptions : {};
let sim = getSimulator();
this.opts = options === undefined ? {} : options;
this.opts.logLevel = this.opts.hasOwnProperty('logLevel') ? this.opts.logLevel : 'debug';
this.opts.simulatorOptions = this.opts.hasOwnProperty('simulatorOptions') ? this.opts.simulatorOptions : {};
this.sim = getSimulator();
}
newWebThree() {
try {
let Web3 = require('web3');
let web3 = new Web3();
web3.setProvider(sim.provider(opts.simulatorOptions));
web3.setProvider(this.sim.provider(this.opts.simulatorOptions));
return web3;
} catch (e) {
throw new Error(e);

View File

@ -104,7 +104,7 @@ class Embark {
});
});
engine.deployManager.deployContracts(function () {
engine.deployManager.deployContracts(function (err) {
engine.startService("fileWatcher");
if (options.runWebserver) {
engine.startService("webServer", {
@ -166,12 +166,12 @@ class Embark {
// needed due to child processes
process.exit();
});
}
};
this.initTests = function () {
let Test = require('./core/test.js');
return new Test(options);
}
};
// TODO: should deploy if it hasn't already
this.upload = function (platform) {