Report abuse


			
#!/usr/bin/env ruby
#
# An example hook script that is called after a successful
# commit is made.
#
# To enable this hook, make this file executable.

require 'rubygems'
require 'tinder'

config = {
  :room => 'CAMPFIRE_ROOM',
  :user => 'CAMPFIRE_EMAIL',
  :pass => 'CAMPFIRE_PASSWORD',
  :repo => 'Repo Name',
  :path => '/git/repo.git',
  # See http://www.kernel.org/pub/software/scm/git/docs/git-log.html for %flags
  :msg  => 'Commit %h by %an (%ar) -- %s'
}

campfire = Tinder::Campfire.new(config[:room])
campfire.login config[:user], config[:pass]
room = campfire.rooms.first

commits = `cd #{config[:path]} && git log -#{ARGV.size} --pretty=format:"#{config[:msg]}"`

commits.each_line do |commit|
  room.speak "#{config[:repo]}: #{commit}"
end