mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 14:24:24 +00:00
changes from the code review
This commit is contained in:
parent
2782acf438
commit
fe0bbc3559
@ -127,6 +127,7 @@ class EmbarkController {
|
||||
engine.startService("codeGenerator");
|
||||
engine.startService("namingSystem");
|
||||
engine.startService("console");
|
||||
engine.startService("pluginCommand");
|
||||
|
||||
engine.events.on('check:backOnline:Ethereum', function () {
|
||||
engine.logger.info(__('Ethereum node detected') + '..');
|
||||
|
@ -132,7 +132,7 @@ class Engine {
|
||||
}
|
||||
|
||||
pluginCommandService() {
|
||||
this.registerModule('plugin_cmd', {embarkConfigFile: this.embarkConfig, packageFile: 'package.json'});
|
||||
this.registerModule('plugin_cmd', {embarkConfigFile: this.embarkConfig, embarkConfig: this.config.embarkConfig, packageFile: 'package.json'});
|
||||
}
|
||||
|
||||
namingSystem(_options) {
|
||||
|
@ -5,7 +5,7 @@ class PluginCommand {
|
||||
constructor(embark, config) {
|
||||
this.embark = embark;
|
||||
this.config = config;
|
||||
this.embarkConfig = fs.readJSONSync(this.config.embarkConfigFile);
|
||||
this.embarkConfig = this.config.embarkConfig;
|
||||
this.registerCommand();
|
||||
}
|
||||
registerCommand() {
|
||||
@ -20,16 +20,8 @@ class PluginCommand {
|
||||
if(cmdArray.length < 3 || cmdArray[1] !== 'install' || typeof cmdArray[2] === 'undefined') {
|
||||
return callback('invalid use of plugin command. Please use plugin install <package>');
|
||||
}
|
||||
let npmInstall = ['npm', 'install'];
|
||||
if (cmdArray[2] === '--save') {
|
||||
if(typeof cmdArray[3] === 'undefined') {
|
||||
return callback('package argument missing');
|
||||
}
|
||||
} else {
|
||||
npmInstall.push('--save');
|
||||
}
|
||||
let npmInstall = ['npm', 'install', '--save'];
|
||||
npmInstall = npmInstall.concat(cmdArray.slice(2));
|
||||
|
||||
async.waterfall([
|
||||
function npmInstallAsync(cb) {
|
||||
utils.runCmd(npmInstall.join(' '), {silent: false, exitOnError: false}, (err) => {
|
||||
@ -50,10 +42,9 @@ class PluginCommand {
|
||||
}
|
||||
], (err) => {
|
||||
if(err) {
|
||||
callback(err);
|
||||
} else {
|
||||
callback(null, 'npm package successfully installed as a plugin');
|
||||
return callback(err);
|
||||
}
|
||||
callback(null, 'npm package successfully installed as a plugin');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -143,10 +143,12 @@ function runCmd(cmd, options, callback) {
|
||||
return callback(result, null);
|
||||
}
|
||||
if (options.exitOnError) {
|
||||
exit();
|
||||
return exit();
|
||||
}
|
||||
}
|
||||
callback(null, result);
|
||||
if(typeof callback === 'function') {
|
||||
return callback(null, result);
|
||||
}
|
||||
}
|
||||
|
||||
function cd(folder) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user