<commit_before>import Ember from 'ember';

const EMBER_VERSIONS = ['2.4.1', '2.3.1', '2.2.2', '2.1.2', '2.0.3', '1.13.13', '1.12.2'];
const EMBER_DATA_VERSIONS = ['2.4.0', '2.3.3', '2.2.1', '2.1.0', '2.0.1', '1.13.15'];

const VERSION_REGEX = /^\d+.\d+.\d+(-beta\.\d+)?$/;

const CDN_MAP = {
  'ember': {
    library: 'ember.js',
    fileName: 'ember.debug.js'
  },

  'ember-template-compiler': {
    library: 'ember.js',
    fileName: 'ember-template-compiler.js'
  },

  'ember-data': {
    library: 'ember-data.js',
    fileName: 'ember-data.js'
  }
};

const CHANNEL_FILENAME_MAP = {
  'ember': 'ember.debug.js',
  'ember-template-compiler': 'ember-template-compiler.js',
  'ember-data': 'ember-data.js'
};

const CHANNELS = ['release', 'beta', 'canary'];

const { computed } = Ember;

export default Ember.Service.extend({
  resolveDependencies: function(dependencies) {
    Object.keys(dependencies).forEach((name) => {
      var value = dependencies[name];

      dependencies[name] = this.resolveDependency(name, value);
    });
  },

  resolveAddons: function(addons, dependencies) {
    let addonPromises = {};
    Object.keys(addons).forEach((name) => {
      var value = addons[name];

      addonPromises[name] = this.resolveAddon(name, value);
    });

    return Ember.RSVP.hash(addonPromises).then(hash => {
      Object.keys(addons).forEach((name) => {
        let addon = hash[name];
        dependencies[name] = `https://s3.amazonaws.com/addons-test/${addon.addon_js}`
      });
    });
  },

  resolveAddon(name, value) {
    return new Ember.RSVP.Promise(function(resolve, reject) {
      let url = `https://nl1fctyzr7.execute-api.us-east-1.amazonaws.com/staging/addon?addon=${name}&addon_version=${value}&ember_version=1.13.15`;
      $.getJSON(url, function(data){
        console.log(data);
        resolve(data);
      });<commit_msg>Still have to figure out how to handle errors<commit_after>import Ember from 'ember';

const EMBER_VERSIONS = ['2.4.1', '2.3.1', '2.2.2', '2.1.2', '2.0.3', '1.13.13', '1.12.2'];
const EMBER_DATA_VERSIONS = ['2.4.0', '2.3.3', '2.2.1', '2.1.0', '2.0.1', '1.13.15'];

const VERSION_REGEX = /^\d+.\d+.\d+(-beta\.\d+)?$/;

const CDN_MAP = {
  'ember': {
    library: 'ember.js',
    fileName: 'ember.debug.js'
  },

  'ember-template-compiler': {
    library: 'ember.js',
    fileName: 'ember-template-compiler.js'
  },

  'ember-data': {
    library: 'ember-data.js',
    fileName: 'ember-data.js'
  }
};

const CHANNEL_FILENAME_MAP = {
  'ember': 'ember.debug.js',
  'ember-template-compiler': 'ember-template-compiler.js',
  'ember-data': 'ember-data.js'
};

const CHANNELS = ['release', 'beta', 'canary'];

const { computed } = Ember;

export default Ember.Service.extend({
  resolveDependencies: function(dependencies) {
    Object.keys(dependencies).forEach((name) => {
      var value = dependencies[name];

      dependencies[name] = this.resolveDependency(name, value);
    });
  },

  resolveAddons: function(addons, dependencies) {
    let addonPromises = {};
    Object.keys(addons).forEach((name) => {
      var value = addons[name];

      addonPromises[name] = this.resolveAddon(name, value);
    });

    return Ember.RSVP.hash(addonPromises).then(hash => {
      Object.keys(addons).forEach((name) => {
        let addon = hash[name];
        if(addon.status === 'build_success') {
          dependencies[name] = addon.addon_js;
        }
        else if (addon.status === 'building') {
        }
        else if (addon.status === 'build_error') {
        }
      });
    });
  },

  resolveAddon(name, value) {
    return new Ember.RSVP.Promise(function(resolve, reject) {
      let url = `https://nl1fctyzr7.execute-api.us-east-1.amazonaws.com/staging/addon?addon=${name}&addon_version=${value}&ember_version=1.13.15`;
      $.getJSON(url, function(data){
        resolve(data);
      });
{'fraction_non_alphanumeric': 0.19886069394096323, 'fraction_numerical': 0.027187985499741066, 'mean_word_length': 3.17170626349892, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 3, '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': '4535440', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1428, 'n_words': 221}