Sha256: 48d6b3cb318a2f3553e1a50402a200e2be6c4fa651403d32853ec63362ed5185

Contents?: true

Size: 931 Bytes

Versions: 8

Compression:

Stored size: 931 Bytes

Contents

require 'rubygems'
require 'botfly'
require 'fileutils'
require 'yaml'

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

bot = Botfly.login(config["jid"],config["pass"]) do
  blame_responder = 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
  join('bots') do
    on.message do
      reply "Hi"
    end
  end
  on.message.from(/^rkneufeld/).body(/^kb$/) do
    reply "Sure thing! You ARE the boss!"
    remove blame_responder
    reply "There, all done"
  end
end

Thread.stop;loop

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
botfly-0.3.6 example.rb
botfly-0.3.5 example.rb
botfly-0.3.4 example.rb
botfly-0.3.3 example.rb
botfly-0.3.2 example.rb
botfly-0.3.1 example.rb
botfly-0.3.0 example.rb
botfly-0.2.1 example.rb