Skip to content

Instantly share code, notes, and snippets.

@mipearson
Created February 3, 2011 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mipearson/809060 to your computer and use it in GitHub Desktop.
Save mipearson/809060 to your computer and use it in GitHub Desktop.
Chatty hudson blamer
#!/usr/bin/env ruby
require 'fileutils'
def last_committer
@last_committer ||= `git log --format="%an" -1`.strip
end
INSULTS = %{
%s is a bad programmer and
%s probably doesn't really know Ruby and
%s should stick to Visual Basic because they
I am going to have a cry because %s
Go home, %s, you
Oh no! %s
%s should git revert because they
}.strip.split("\n")
SAY_LOCK = '/tmp/say'
def insult blame
sprintf INSULTS[rand(INSULTS.length)], blame
end
def have_a_sook_about_it blame, task
return if File.exist? SAY_LOCK
begin
system "touch #{SAY_LOCK}"
system "say -v Alex '#{insult blame} broke the #{task} build!'"
ensure
FileUtils.rm_f SAY_LOCK
end
end
task = ARGV[0] or raise "Syntax: ci.rb TASK"
commands = %{
... snip ...
}.strip.split("\n")
commands.each do |command|
puts "*** Running: #{command}"
system command
if $? != 0
puts "*** ERROR: Command '#{command}' returned status code #{$?}"
have_a_sook_about_it last_committer, task if last_committer
Kernel.exit 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment