Skip to content
Browse files

Add example watchr file

  • Loading branch information...
1 parent e6870f1 commit d865d4399f5636c4c9828469640fe1e29706adc5 @vinbarnes committed Jul 26, 2010
Showing with 22 additions and 0 deletions.
  1. +22 −0 test/my.watchr.example
View
22 test/my.watchr.example
@@ -0,0 +1,22 @@
+puts "\n--- watchr initialized ---\n\n"
+
+def cmd() 'ruby '; end
+
+def run_spec(spec)
+ puts "Running #{spec}"
+ system(cmd + spec)
+ puts
+end
+
+watch('^test\/.*_test\.rb') {|md| run_spec(md[0]) }
+watch('^lib/(.*)\.rb') {|md| run_spec("test/#{md[1]}_test.rb") }
+
+# Ctrl-\
+Signal.trap('QUIT') do
+ puts "\n--- Running all tests ---\n"
+ run_all_specs
+ puts
+end
+
+# Ctrl-C
+Signal.trap('INT') { abort("\n") }

0 comments on commit d865d43

Please sign in to comment.
Something went wrong with that request. Please try again.