Skip to content

Instantly share code, notes, and snippets.

@acidlabs-snippets
Created October 3, 2012 18:42
Show Gist options
  • Save acidlabs-snippets/3828928 to your computer and use it in GitHub Desktop.
Save acidlabs-snippets/3828928 to your computer and use it in GitHub Desktop.
#GIT #Hook #tests
#!/usr/bin/env ruby
#
tests = [
{:name => "RSPEC", :command => "rake spec"},
{:name => "JASMINE", :command => "jasmine-headless-webkit --color"}
]
tests.each do |test|
puts "\e[33mEXECUTING #{test[:name]} TESTS\e[0m"
test[:result] = system test[:command]
end
all_ok = tests.none? {|test| not test[:result]}
if all_ok
puts "\e[32mAll systems green! proceeding with the commit...\e[0m"
else
puts "\e[31mSome tests are failing! Fix 'em before you commit again.\e[0m"
end
exit all_ok ? 0 : 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment