<commit_before>'use strict';

module.exports = {
  name: 'live-reload-middleware',

  contentFor: function(type) {
    var liveReloadPort = process.env.EMBER_CLI_INJECT_LIVE_RELOAD_PORT;

    if (liveReloadPort && type === 'head') {
      return '<script src="http://localhost:' + liveReloadPort + '/livereload.js?snipver=1" type="text/javascript"></script>';
    }
  },

  serverMiddleware: function(config) {
    var app = config.app;
    var options = config.options;

    if (options.liveReload !== true) { return; }

    if (this.shouldUseMiddleware()) {
      var livereloadMiddleware = require('connect-livereload');

      app.use(livereloadMiddleware({
        port: options.liveReloadPort
      }));
    } else {
      process.env.EMBER_CLI_INJECT_LIVE_RELOAD_PORT = options.liveReloadPort;
    }
  },

  shouldUseMiddleware: function() {
    var version = this.project.emberCLIVersion();
    var portions = version.split('.');

    if (portions[0] > 0) {
      return false;
    } else if (portions[1] > 0) {
      return false;
    } else if (portions[2] > 46) {
      return false;
    } else {<commit_msg>Ensure that the emberCLIversion is detected properly.<commit_after>'use strict';

module.exports = {
  name: 'live-reload-middleware',

  contentFor: function(type) {
    var liveReloadPort = process.env.EMBER_CLI_INJECT_LIVE_RELOAD_PORT;

    if (liveReloadPort && type === 'head') {
      return '<script src="http://localhost:' + liveReloadPort + '/livereload.js?snipver=1" type="text/javascript"></script>';
    }
  },

  serverMiddleware: function(config) {
    var app = config.app;
    var options = config.options;

    if (options.liveReload !== true) { return; }

    if (this.shouldUseMiddleware()) {
      var livereloadMiddleware = require('connect-livereload');

      app.use(livereloadMiddleware({
        port: options.liveReloadPort
      }));
    } else {
      process.env.EMBER_CLI_INJECT_LIVE_RELOAD_PORT = options.liveReloadPort;
    }
  },

  shouldUseMiddleware: function() {
    var version = this.project.emberCLIVersion();
    var portions = version.split('.');
    portions = portions.map(function(portion) {
      return Number(portion.split('-')[0]);
    });

    if (portions[0] > 0) {
      return false;
    } else if (portions[1] > 0) {
      return false;
    } else if (portions[2] > 46) {
      return false;
    } else {
{'fraction_non_alphanumeric': 0.1417157275021026, 'fraction_numerical': 0.007148864592094197, 'mean_word_length': 3.188380281690141, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '3445227', 'n_tokens_mistral': 788, 'n_tokens_neox': 769, 'n_words': 148}