|
|
@ -272,11 +272,7 @@ var fs = require('fs'),
|
|
|
|
|
|
|
|
|
|
|
|
async.filter(dirs, function(dir, callback){
|
|
|
|
async.filter(dirs, function(dir, callback){
|
|
|
|
fs.stat(dir, function(err, stats){
|
|
|
|
fs.stat(dir, function(err, stats){
|
|
|
|
if (err) {
|
|
|
|
callback(!err && stats.isDirectory());
|
|
|
|
return callback(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
callback(stats.isDirectory());
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, function(plugins){
|
|
|
|
}, function(plugins){
|
|
|
|
next(null, plugins);
|
|
|
|
next(null, plugins);
|
|
|
@ -287,25 +283,11 @@ var fs = require('fs'),
|
|
|
|
var plugins = [];
|
|
|
|
var plugins = [];
|
|
|
|
|
|
|
|
|
|
|
|
async.each(files, function(file, next) {
|
|
|
|
async.each(files, function(file, next) {
|
|
|
|
var configPath;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async.waterfall([
|
|
|
|
async.waterfall([
|
|
|
|
function(next) {
|
|
|
|
function(next) {
|
|
|
|
Plugins.loadPluginInfo(file, next);
|
|
|
|
Plugins.loadPluginInfo(file, next);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
function(pluginData, next) {
|
|
|
|
function(pluginData, next) {
|
|
|
|
var packageName = path.basename(file);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!pluginData) {
|
|
|
|
|
|
|
|
winston.warn("Plugin `" + packageName + "` is corrupted or invalid. Please check either package.json or plugin.json for errors.");
|
|
|
|
|
|
|
|
return next(null, {
|
|
|
|
|
|
|
|
id: packageName,
|
|
|
|
|
|
|
|
installed: true,
|
|
|
|
|
|
|
|
error: true,
|
|
|
|
|
|
|
|
active: null
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Plugins.isActive(pluginData.name, function(err, active) {
|
|
|
|
Plugins.isActive(pluginData.name, function(err, active) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
return next(new Error('no-active-state'));
|
|
|
|
return next(new Error('no-active-state'));
|
|
|
@ -319,12 +301,12 @@ var fs = require('fs'),
|
|
|
|
next(null, pluginData);
|
|
|
|
next(null, pluginData);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
], function(err, config) {
|
|
|
|
], function(err, pluginData) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
return next(); // Silently fail
|
|
|
|
return next(); // Silently fail
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
plugins.push(config);
|
|
|
|
plugins.push(pluginData);
|
|
|
|
next();
|
|
|
|
next();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, function(err) {
|
|
|
|
}, function(err) {
|
|
|
|