make jshint happy
This commit is contained in:
parent
b2173a1084
commit
5a77979486
|
@ -14,7 +14,7 @@ if (!exports.isClient) {
|
||||||
var util = require("util");
|
var util = require("util");
|
||||||
_ = require("underscore");
|
_ = require("underscore");
|
||||||
}else{
|
}else{
|
||||||
var $, jQuery
|
var $, jQuery;
|
||||||
$ = jQuery = require("ep_etherpad-lite/static/js/rjquery").$;
|
$ = jQuery = require("ep_etherpad-lite/static/js/rjquery").$;
|
||||||
_ = require("ep_etherpad-lite/static/js/underscore");
|
_ = require("ep_etherpad-lite/static/js/underscore");
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,15 @@ exports.ensure = function (cb) {
|
||||||
exports.update(cb);
|
exports.update(cb);
|
||||||
else
|
else
|
||||||
cb();
|
cb();
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.formatPlugins = function () {
|
exports.formatPlugins = function () {
|
||||||
return _.keys(exports.plugins).join(", ");
|
return _.keys(exports.plugins).join(", ");
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.formatParts = function () {
|
exports.formatParts = function () {
|
||||||
return _.map(exports.parts, function (part) { return part.full_name; }).join("\n");
|
return _.map(exports.parts, function (part) { return part.full_name; }).join("\n");
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.formatHooks = function () {
|
exports.formatHooks = function () {
|
||||||
var res = [];
|
var res = [];
|
||||||
|
@ -48,7 +48,7 @@ exports.formatHooks = function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return res.join("\n");
|
return res.join("\n");
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.loadFn = function (path) {
|
exports.loadFn = function (path) {
|
||||||
var x = path.split(":");
|
var x = path.split(":");
|
||||||
|
@ -57,7 +57,7 @@ exports.loadFn = function (path) {
|
||||||
fn = fn[name];
|
fn = fn[name];
|
||||||
});
|
});
|
||||||
return fn;
|
return fn;
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.extractHooks = function (parts, hook_set_name) {
|
exports.extractHooks = function (parts, hook_set_name) {
|
||||||
var hooks = {};
|
var hooks = {};
|
||||||
|
@ -74,7 +74,7 @@ exports.extractHooks = function (parts, hook_set_name) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return hooks;
|
return hooks;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
if (exports.isClient) {
|
if (exports.isClient) {
|
||||||
|
@ -89,7 +89,7 @@ if (exports.isClient) {
|
||||||
console.error("Failed to load plugin-definitions: " + err);
|
console.error("Failed to load plugin-definitions: " + err);
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
exports.update = function (cb) {
|
exports.update = function (cb) {
|
||||||
|
@ -111,7 +111,7 @@ exports.update = function (cb) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.getPackages = function (cb) {
|
exports.getPackages = function (cb) {
|
||||||
// Load list of installed NPM packages, flatten it to a list, and filter out only packages with names that
|
// Load list of installed NPM packages, flatten it to a list, and filter out only packages with names that
|
||||||
|
@ -121,25 +121,26 @@ exports.getPackages = function (cb) {
|
||||||
var packages = {};
|
var packages = {};
|
||||||
function flatten(deps) {
|
function flatten(deps) {
|
||||||
_.chain(deps).keys().each(function (name) {
|
_.chain(deps).keys().each(function (name) {
|
||||||
if (name.indexOf(exports.prefix) == 0) {
|
if (name.indexOf(exports.prefix) === 0) {
|
||||||
packages[name] = _.clone(deps[name]);
|
packages[name] = _.clone(deps[name]);
|
||||||
// Delete anything that creates loops so that the plugin
|
// Delete anything that creates loops so that the plugin
|
||||||
// list can be sent as JSON to the web client
|
// list can be sent as JSON to the web client
|
||||||
delete packages[name].dependencies;
|
delete packages[name].dependencies;
|
||||||
delete packages[name].parent;
|
delete packages[name].parent;
|
||||||
}
|
}
|
||||||
if (deps[name].dependencies !== undefined)
|
|
||||||
flatten(deps[name].dependencies);
|
if (deps[name].dependencies !== undefined) flatten(deps[name].dependencies);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var tmp = {};
|
var tmp = {};
|
||||||
tmp[data.name] = data;
|
tmp[data.name] = data;
|
||||||
flatten(tmp);
|
flatten(tmp);
|
||||||
cb(null, packages);
|
cb(null, packages);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.loadPlugin = function (packages, plugin_name, plugins, parts, cb) {
|
exports.loadPlugin = function (packages, plugin_name, plugins, parts, cb) {
|
||||||
var plugin_path = path.resolve(packages[plugin_name].path, "ep.json");
|
var plugin_path = path.resolve(packages[plugin_name].path, "ep.json");
|
||||||
fs.readFile(
|
fs.readFile(
|
||||||
plugin_path,
|
plugin_path,
|
||||||
|
@ -150,7 +151,7 @@ exports.loadPlugin = function (packages, plugin_name, plugins, parts, cb) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
var plugin = JSON.parse(data);
|
var plugin = JSON.parse(data);
|
||||||
plugin.package = packages[plugin_name];
|
plugin['package'] = packages[plugin_name];
|
||||||
plugins[plugin_name] = plugin;
|
plugins[plugin_name] = plugin;
|
||||||
_.each(plugin.parts, function (part) {
|
_.each(plugin.parts, function (part) {
|
||||||
part.plugin = plugin_name;
|
part.plugin = plugin_name;
|
||||||
|
@ -163,7 +164,7 @@ exports.loadPlugin = function (packages, plugin_name, plugins, parts, cb) {
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.partsToParentChildList = function (parts) {
|
exports.partsToParentChildList = function (parts) {
|
||||||
var res = [];
|
var res = [];
|
||||||
|
@ -179,7 +180,7 @@ exports.partsToParentChildList = function (parts) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
// Used only in Node, so no need for _
|
// Used only in Node, so no need for _
|
||||||
|
|
Loading…
Reference in New Issue