Created
January 6, 2010 04:09
-
-
Save bryan-ash/270002 to your computer and use it in GitHub Desktop.
Simple watchr script for running specs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run me with: | |
# | |
# $ watchr specs.watchr.rb | |
# -------------------------------------------------- | |
# Convenience Methods | |
# -------------------------------------------------- | |
def all_specs | |
Dir['spec/**/*_spec.rb'] | |
end | |
def run(cmd) | |
puts(cmd) | |
system(cmd) | |
end | |
# -------------------------------------------------- | |
# Watchr Rules | |
# -------------------------------------------------- | |
watch('.*') { |m| run 'spec -c spec/*_spec.rb' } | |
# -------------------------------------------------- | |
# Signal Handling | |
# -------------------------------------------------- | |
# Ctrl-\ | |
Signal.trap('QUIT') do | |
puts " --- Running all specs ---\n\n" | |
run "spec -cfs #{all_specs.join(' ')}" | |
end | |
# Ctrl-C | |
Signal.trap('INT') { abort("\n") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment