From 97b9ba983ca0cac315366d2c808b4c82c5149fa1 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 9 Oct 2014 17:31:47 -0400 Subject: [PATCH] read both --- src/plugins.js | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/plugins.js b/src/plugins.js index 237f0ddbb7..b749be7451 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -649,7 +649,7 @@ var fs = require('fs'), pluginMap[plugin.name].active = plugin.active; pluginMap[plugin.name].version = plugin.version; - getVersion(plugin.name, function(err, version) { + getVersion(plugin.id, function(err, version) { pluginMap[plugin.name].latest = version; pluginMap[plugin.name].outdated = version !== pluginMap[plugin.name].version; next(); @@ -737,28 +737,38 @@ var fs = require('fs'), async.waterfall([ function(next) { - fs.readFile(path.join(file, 'package.json'), next); + async.parallel({ + packageJSON: function(next) { + fs.readFile(path.join(file, 'package.json'), next); + }, + pluginJSON: function(next) { + fs.readFile(path.join(file, 'plugin.json'), next); + } + }, next); }, - function(configJSON, next) { - var config; + function(results, next) { + var packageInfo, pluginInfo; try { - config = JSON.parse(configJSON); + packageInfo = JSON.parse(results.packageJSON); + pluginInfo = JSON.parse(results.pluginJSON); } catch (err) { winston.warn("Plugin: " + file + " is corrupted or invalid. Please check plugin.json for errors."); return next(err, null); } - Plugins.isActive(config.name, function(err, active) { + Plugins.isActive(packageInfo.name, function(err, active) { if (err) { next(new Error('no-active-state')); } + delete pluginInfo.hooks; + delete pluginInfo.library; + pluginInfo.active = active; + pluginInfo.installed = true; + pluginInfo.version = packageInfo.version; - config.active = active; - config.installed = true; - - next(null, config); + next(null, pluginInfo); }); } ], function(err, config) {