<commit_before>var path = require('path');
var fs = require('fs');
var semver = require('semver');
var User = require('./user').User;
var version = require('./version');
var log = require("./logger")._system;

'use strict';

module.exports = {
  Plugin: Plugin
}

/**
 * Homebridge Plugin.
 *
 * Allows for discovering and loading installed Homebridge plugins.
 */

function Plugin(pluginPath) {
  this.pluginPath = pluginPath; // like "/usr/local/lib/node_modules/homebridge-lockitron"
  this.initializer; // exported function from the plugin that initializes it
}

Plugin.prototype.name = function() {
  return path.basename(this.pluginPath);
}

Plugin.prototype.load = function(options) {
  options = options || {};

  // does this plugin exist at all?
  if (!fs.existsSync(this.pluginPath)) {
    throw new Error("Plugin " + this.pluginPath + " was not found. Make sure the module '" + this.pluginPath + "' is installed.");
  }

  // attempt to load package.json
  var pjson = Plugin.loadPackageJSON(this.pluginPath);

  // 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'.");
  }

  var versionRequired = pjson.engines.homebridge;

  // make sure the version is satisfied by the currently running version of HomeBridge
  if (!semver.satisfies(version, versionRequired)) {
    throw new Error("Plugin " + this.pluginPath + " requires a HomeBridge version of " + versionRequired + " which does not satisfy the current HomeBridge version of " + version + ". You may need to upgrade your installation of HomeBridge.");
  }

  var nodeVersionRequired = pjson.engines.node;<commit_msg>Fixed typo in `peerDependencies` check<commit_after>var path = require('path');
var fs = require('fs');
var semver = require('semver');
var User = require('./user').User;
var version = require('./version');
var log = require("./logger")._system;

'use strict';

module.exports = {
  Plugin: Plugin
}

/**
 * Homebridge Plugin.
 *
 * Allows for discovering and loading installed Homebridge plugins.
 */

function Plugin(pluginPath) {
  this.pluginPath = pluginPath; // like "/usr/local/lib/node_modules/homebridge-lockitron"
  this.initializer; // exported function from the plugin that initializes it
}

Plugin.prototype.name = function() {
  return path.basename(this.pluginPath);
}

Plugin.prototype.load = function(options) {
  options = options || {};

  // does this plugin exist at all?
  if (!fs.existsSync(this.pluginPath)) {
    throw new Error("Plugin " + this.pluginPath + " was not found. Make sure the module '" + this.pluginPath + "' is installed.");
  }

  // attempt to load package.json
  var pjson = Plugin.loadPackageJSON(this.pluginPath);

  // very temporary fix for first wave of plugins
  if (pjson.peerDependencies && (!pjson.engines || !pjson.engines.homebridge)) {
    var engines = pjson.engines || {}
    engines.homebridge = pjson.peerDependencies.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'.");
  }

  var versionRequired = pjson.engines.homebridge;

  // make sure the version is satisfied by the currently running version of HomeBridge
  if (!semver.satisfies(version, versionRequired)) {
    throw new Error("Plugin " + this.pluginPath + " requires a HomeBridge version of " + versionRequired + " which does not satisfy the current HomeBridge version of " + version + ". You may need to upgrade your installation of HomeBridge.");
  }

  var nodeVersionRequired = pjson.engines.node;
{'fraction_non_alphanumeric': 0.12397718819737169, 'fraction_numerical': 0.0, 'mean_word_length': 3.949693251533742, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1916579', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1147, 'n_words': 355}