First pass at README update.

This commit is contained in:
Nick Farina
2015-11-02 15:30:29 -08:00
parent 15cc98217b
commit 52d3a9a96e
5 changed files with 80 additions and 95 deletions

View File

@@ -17,7 +17,7 @@ module.exports = {
*/
function Plugin(pluginPath) {
this.pluginPath = pluginPath; // like "/usr/local/lib/node_modules/plugin-lockitron"
this.pluginPath = pluginPath; // like "/usr/local/lib/node_modules/homebridge-lockitron"
this.initializer; // exported function from the plugin that initializes it
}
@@ -35,7 +35,19 @@ Plugin.prototype.load = function(options) {
// attempt to load package.json
var pjson = Plugin.loadPackageJSON(this.pluginPath);
// make sure the name is prefixed with 'homebridge-'
if (!pjson.name || pjson.name.indexOf('homebridge-') != 0) {
throw new Error("Plugin " + this.pluginPath + " does not have a package name that begins with 'homebridge-'.");
}
// very temporary fix for first wave of plugins
if (pjson.peerDepdendencies && (!pjson.engines || !pjson.engines.homebridge)) {
var engines = pjson.engines || {}
engines.homebridge = pjson.peerDepdendencies.homebridge;
pjson.engines = engines;
}
// pluck out the HomeBridge version requirement
if (!pjson.engines || !pjson.engines.homebridge) {
throw new Error("Plugin " + this.pluginPath + " does not contain the 'homebridge' package in 'engines'.");