<commit_before>/* jshint node: true */
'use strict';

var readConfig = require('./lib/config');

module.exports = {
  name: 'ember-cli-bugsnag',

  contentFor: function(type, config) {
    var content = '';
    var bugsnagConfig;
    var envArray;

    if (type === 'head' && config.environment !== 'test') {
      // returns `null` if `.bugsnag` does not exist
      bugsnagConfig = readConfig();

      if (!bugsnagConfig) {
        console.warn('`.bugsnag` config file does not exist, using `config/environment` instead.');
        bugsnagConfig = config.bugsnag;
      }

      envArray = bugsnagConfig.notifyReleaseStages ? bugsnagConfig.notifyReleaseStages : [];

      content = [
        '<script ',
        'src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-2.min.js" ',
        'data-appversion="' + config.currentRevision + '" ',
        'data-apikey="' + bugsnagConfig.apiKey + '">',
        '</script>',
        '<script>',
        'Bugsnag.releaseStage = "' + config.environment + '";',
        'Bugsnag.notifyReleaseStages = ["' + envArray.join('","') + '"];',
        '</script>'
      ];
    }

    return content;
  }
};<commit_msg>Handles the case when `.bugsnag` and `config.bugsnag` are not defined<commit_after>/* jshint node: true */
'use strict';

var readConfig = require('./lib/config');

module.exports = {
  name: 'ember-cli-bugsnag',

  contentFor: function(type, config) {
    var content = '';
    var bugsnagConfig;
    var envArray;

    if (type === 'head' && config.environment !== 'test') {
      // returns `null` if `.bugsnag` does not exist
      bugsnagConfig = readConfig();

      if (!bugsnagConfig) {
        console.warn('`.bugsnag` config file does not exist, using `config/environment` instead.');

        if (!config.bugsnag) {
          console.warn('`config.bugsnag` is not defined, skipping...');
          return '';
        }

        bugsnagConfig = config.bugsnag;
      }

      envArray = bugsnagConfig.notifyReleaseStages ? bugsnagConfig.notifyReleaseStages : [];

      content = [
        '<script ',
        'src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-2.min.js" ',
        'data-appversion="' + config.currentRevision + '" ',
        'data-apikey="' + bugsnagConfig.apiKey + '">',
        '</script>',
        '<script>',
        'Bugsnag.releaseStage = "' + config.environment + '";',
        'Bugsnag.notifyReleaseStages = ["' + envArray.join('","') + '"];',
        '</script>'
      ];
    }

    return content;
  }
};
{'fraction_non_alphanumeric': 0.1724415793714746, 'fraction_numerical': 0.0040290088638195, 'mean_word_length': 2.552217453505007, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5459878', 'n_tokens_mistral': 809, 'n_tokens_neox': 797, 'n_words': 151}