<commit_before>'use strict'

/**
 * Dependencies
 */
const Injector = require('./Injector')
const Registry = require('./Registry')

/**
 * Host
 *
 * This is the main class of the program. The constructor initializes an
 * injector and registry for the application. The bootstrap method uses the
 * registry to find, load, validate and initialize plugins. The run method
 * starts the application.
 *
 * Example:
 *
 *    // host application
 *    module.exports = require('sunstone').bootstrap({})
 *
 *    // extending application
 *    require('my-app').run()
 */
class Host {

  /**
   * Constructor
   */
  constructor (options) {
    let injector = new Injector()
    let registry = new Registry(options)

    this.options = options
    this.injector = injector
    this.registry = registry
  }

  /**
   * Bootstrap
   */
  static bootstrap (options) {
    let host = Host(options)

    host.registry
      .glob()
      .require()
      .resolve()
      .prioritize()
      .initialize()

    return host
  }

  /**
   * Run
   */
  run () {
    this.injector.get('main')
    this.registry
      .filter({ enabled: true })
      .start()
  }

}

/**
 * Exports
 */
module.exports = Host<commit_msg>fix(host): pass injector to registry; use new keyword in bootstrap()<commit_after>'use strict'

/**
 * Dependencies
 */
const Injector = require('./Injector')
const Registry = require('./Registry')

/**
 * Host
 *
 * This is the main class of the program. The constructor initializes an
 * injector and registry for the application. The bootstrap method uses the
 * registry to find, load, validate and initialize plugins. The run method
 * starts the application.
 *
 * Example:
 *
 *    // host application
 *    module.exports = require('sunstone').bootstrap({})
 *
 *    // extending application
 *    require('my-app').run()
 */
class Host {

  /**
   * Constructor
   */
  constructor (options) {
    let injector = new Injector()
    let registry = new Registry(options, injector)

    this.options = options
    this.injector = injector
    this.registry = registry
  }

  /**
   * Bootstrap
   */
  static bootstrap (options) {
    let host = new Host(options)

    host.registry
      .glob()
      .require()
      .resolve()
      .prioritize()
      .initialize()

    return host
  }

  /**
   * Run
   */
  run () {
    this.injector.get('main')
    this.registry
      // TODO
      //.filter({ enabled: true })
      .filter()
      .start()
  }

}

/**
 * Exports
 */
module.exports = Host
{'fraction_non_alphanumeric': 0.13370473537604458, 'fraction_numerical': 0.0, 'mean_word_length': 2.3972972972972975, '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': '5477307', 'n_tokens_mistral': 757, 'n_tokens_neox': 733, 'n_words': 212}