<commit_before>var BufferedProcess = require('atom').BufferedProcess;
var StatusMessage = require('./status-message')

module.exports = {
  timeout : null,

  installPackages: function(packageListName) {
      var packageList;
      switch (packageListName) {
        case 'PHP':
          var packageList = ['linter-php', 'language-php','php-getters-setters', 'linter-phpmd', 'linter-phpcs']
        break;
        case 'Javascript':
          var packageList = ['turbo-javascript']
        break;
      }
      var that = this;
      packageList.forEach(function(package) {
          that.installPackage(package);
      });
  },

  loadPackageList: function(packageListName) {
      var gistID;
      switch (packageListName) {
        case 'PHP':
          gistID = '4157065edd53fdd3daca';
        break;
        case 'Javascript':
          gistID = 'da9b00c4ddf35d9648b4';
        break;
      }

      this.loadPackageListFromGIst(gistID);
  },

  loadPackageListFromGIst: function(gistID) {
    var request = require('request');
    var requestOptions = {
      url: 'https://api.github.com/gists/' + gistID,
      headers: {
        'User-Agent': 'Trudko'
      }
    }

    var that = this;
    request(requestOptions, function (error, response, body) {
      if (!error && response.statusCode == 200) {
        var responseObject = JSON.parse(body);
        var packageList = responseObject.files['gistfile1.txt'].content;
        packageList = packageList.split(',');
        var availablePackages = atom.packages.getAvailablePackageNames()
        packageList = packageList.filter(function(package ) {
          return availablePackages.indexOf(package) < 0;
        });
        var PackageListPackagesView  = require('./package-list-packages-view');
        var view = new PackageListPackagesView(packageList);
      }
    });
  },

  installPackageList: function(packageList) {
    var that = this;
    packageList.forEach(function(package) {
      that.installPackage(package);
    });
  },

  installPackage: function(packageName) {
      var args, command, exit, stderr, stdout;
      this.displayMessage("" + packageName + " installed!", 1500);
      command = atom.packages.getApmPath();
      args = ['install', packageName];
      var that = this;
      stdout = function(output) {};
      stderr = function(output) {};<commit_msg>Added error message if gist doesn't exists.<commit_after>var BufferedProcess = require('atom').BufferedProcess;
var StatusMessage = require('./status-message')

module.exports = {
  timeout : null,

  installPackages: function(packageListName) {
      var packageList;
      switch (packageListName) {
        case 'PHP':
          var packageList = ['linter-php', 'language-php','php-getters-setters', 'linter-phpmd', 'linter-phpcs']
        break;
        case 'Javascript':
          var packageList = ['turbo-javascript']
        break;
      }
      var that = this;
      packageList.forEach(function(package) {
          that.installPackage(package);
      });
  },

  loadPackageList: function(packageListName) {
      var gistID;
      switch (packageListName) {
        case 'PHP':
          gistID = '4157065edd53fdd3daca';
        break;
        case 'Javascript':
          gistID = 'da9b00c4ddf35d9648b4';
        break;
      }

      this.loadPackageListFromGIst(gistID);
  },

  loadPackageListFromGIst: function(gistID) {
    var request = require('request');
    var requestOptions = {
      url: 'https://api.github.com/gists/' + gistID,
      headers: {
        'User-Agent': 'Trudko'
      }
    }

    var that = this;
    request(requestOptions, function (error, response, body) {
      if (!error && response.statusCode == 200) {
        var responseObject = JSON.parse(body);
        var packageList = responseObject.files['gistfile1.txt'].content;
        packageList = packageList.split(',');
        var availablePackages = atom.packages.getAvailablePackageNames()
        packageList = packageList.filter(function(package ) {
          return availablePackages.indexOf(package) < 0;
        });
        var PackageListPackagesView  = require('./package-list-packages-view');
        var view = new PackageListPackagesView(packageList);
      } else if (response.statusCode == 404) {
          that.displayMessage('Gist with id ' + gistID + ' was not found!')
      }
    });
  },

  installPackageList: function(packageList) {
    var that = this;
    packageList.forEach(function(package) {
      that.installPackage(package);
    });
  },

  installPackage: function(packageName) {
      var args, command, exit, stderr, stdout;
      this.displayMessage("" + packageName + " installed!", 1500);
      command = atom.packages.getApmPath();
      args = ['install', packageName];
      var that = this;
      stdout = function(output) {};
      stderr = function(output) {};
{'fraction_non_alphanumeric': 0.1266213712168005, 'fraction_numerical': 0.012970969734403953, 'mean_word_length': 2.7027439024390243, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2038040', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1409, 'n_words': 279}