<commit_before>var Hook = require('hook.io').Hook,
    util = require('util'),
    async = require('async'),
    GitHubApi = require('github'),
    request = require('request');

/**
* @@TODO
*
* - incorporate hook.io-markdown and remove markdown code
* - README
* - abstract the readme-finder portion so it can find any file in a repo and return the raw version
* - make attaching the readme an optional piece of functionality
*/


var GithubHook = exports.GithubHook = function GithubHook(options) {

  var self = this;
  Hook.call(this, options);

  this.configReady = false;

  self.on('hook::ready', function () {
    if (!!options.configFilePath && options.configFilePath.length) {
      self.config.use('file', { file: options.configFilePath });
      self.config.load(function (err, contents) {
        if (err) {
          // @@TODO
          throw new Error(err);
        }

        self.configReady = true;
        
        // call it now
        self.getAllItems();

        // and call it later
        self.on('getAllItems', self.getAllItems.bind(self));
        self.on('*::getAllItems', self.getAllItems.bind(self));
      });
    }
  });
};

//
// Inherit from `hookio.Hook`
//
util.inherits(GithubHook, Hook);

GithubHook.prototype.findReadme = function (user, repo, cb) {
  var self = this;
  async.waterfall(
    [ self.findMasterBranchSHA.bind(this, user, repo),<commit_msg>Should still attempt to move forward even though there's no config file specified<commit_after>var Hook = require('hook.io').Hook,
    util = require('util'),
    async = require('async'),
    GitHubApi = require('github'),
    request = require('request');

/**
* @@TODO
*
* - incorporate hook.io-markdown and remove markdown code
* - README
* - abstract the readme-finder portion so it can find any file in a repo and return the raw version
* - make attaching the readme an optional piece of functionality
*/


var GithubHook = exports.GithubHook = function GithubHook(options) {

  var self = this;
  Hook.call(this, options);

  this.configReady = false;

  self.on('hook::ready', function () {
    self.config.use('file', { file: options.configFilePath || './config.json' });
    self.config.load(function (err, contents) {
      if (err) {
        // @@TODO
        throw new Error(err);
      }

      self.configReady = true;
      
      // call it now
      self.getAllItems();

      // and call it later
      self.on('getAllItems', self.getAllItems.bind(self));
      self.on('*::getAllItems', self.getAllItems.bind(self));
    });
  });
};

//
// Inherit from `hookio.Hook`
//
util.inherits(GithubHook, Hook);

GithubHook.prototype.findReadme = function (user, repo, cb) {
  var self = this;
  async.waterfall(
    [ self.findMasterBranchSHA.bind(this, user, repo),
{'fraction_non_alphanumeric': 0.14311463590483056, 'fraction_numerical': 0.0, 'mean_word_length': 2.958630527817404, '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': '860493', 'n_tokens_mistral': 866, 'n_tokens_neox': 846, 'n_words': 221}