Skip to content

Instantly share code, notes, and snippets.

@jeffremer
Created November 14, 2012 18:08
Show Gist options
  • Save jeffremer/4073733 to your computer and use it in GitHub Desktop.
Save jeffremer/4073733 to your computer and use it in GitHub Desktop.
Did you run the tests?

This gives you an annoying little prompt that makes you enter "yes" before pushing.

  1. Install the dependencies: gem install highline colored
  2. Add didyou.rb to your PATH and make it executable chmod a+x didyou.rb.
  3. Add the git wrapper function in your shell startup file and reload your shell.
#!/usr/bin/env ruby
require 'highline/import'
require 'colored'
command = ARGV.join(' ')
input = ask "Did you run unit tests before trying to #{command}? "
if input.downcase == 'yes'
puts "Alright, let's rock this casserole!".green
system command
else
puts "You should probably run the unit tests then...".red
end
git()
{
if [ "$1" = "push" ]
then
command didyou.rb git push
else
command git "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment