Skip to content

Instantly share code, notes, and snippets.

@textarcana
Forked from erithmetic/autounit
Created September 9, 2010 03:00
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 textarcana/571285 to your computer and use it in GitHub Desktop.
Save textarcana/571285 to your computer and use it in GitHub Desktop.
# Prereqs:
# * Ruby
# * gem install watchr
# Usage:
# copy autounit to php project directory
# run watchr autounit
watch('test/.*Test\.php') do |md|
puts "\e[H\e[2J" #clear console
system("phpunit #{md[0]}")
end
watch('lib/(.*)\.php') do |md| # runs test/Class/* whenever lib/class.php is changed
puts "\e[H\e[2J" #clear console
testpath = md[1].sub(/./) { |s| s.upcase }
system("phpunit test/#{testpath}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment