<commit_before>require 'rubygems'
require 'botfly'
require 'fileutils'
require 'yaml'

config = YAML::load(ARGF.read) if ARGF

bot = Botfly.login(config["jid"],config["pass"]) do
  on.message.body(/^blame/) do |a|
    match = @body.match(/^blame (.*):(.*)$/)
    file = match[1]
    line = match[2].to_i

    project = "/Users/burke/src/jsgithistory"
    
    result=nil
    FileUtils.cd(project) do
      result = `git blame -p -L#{line},#{line} #{file}`
    end
    
    author = result.lines.find{|e|e=~/^author /}.sub(/author /,'').strip
    time   = Time.at(result.lines.find{|e|e=~/^author-time /}.sub(/author-time /,'').to_i)
    commit = result.lines.first.split(' ').first.strip
    
    reply "#{author}, #{time}, #{commit}"
  end
end

Thread.stop;loop
<commit_msg>better example<commit_after>require 'rubygems'
require 'botfly'
require 'fileutils'
require 'yaml'

config = YAML::load(ARGF.read) if ARGF

bot = Botfly.login(config["jid"],config["pass"]) do
  on.message.body(/^blame/) do |a|
    match = @body.match(/^blame (.*):(.*)$/)
    file = match[1]
    line = match[2].to_i

    project = "/Users/burke/src/jsgithistory"
    
    result=nil
    FileUtils.cd(project) do
      result = `git blame -p -L#{line},#{line} #{file}`
    end

    author = result.scan(/author (.*)\n/).first
    time   = Time.at(result.scan(/author-time (.*)\n/).first.to_i)
    commit = result.lines.first.split(' ').first.strip
    
    reply "#{author}, #{time}, #{commit}"
  end
end

Thread.stop;loop

{'fraction_non_alphanumeric': 0.20427236315086783, 'fraction_numerical': 0.0026702269692923898, 'mean_word_length': 3.1638888888888888, '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': '7163615', 'n_tokens_mistral': 572, 'n_tokens_neox': 563, 'n_words': 107}