mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
First pass at README update.
This commit is contained in:
@@ -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'.");
|
||||
|
||||
Reference in New Issue
Block a user