Created
May 27, 2009 11:05
-
-
Save fearoffish/118573 to your computer and use it in GitHub Desktop.
Quick hack of a script to replace autotest temporarily
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'directory_watcher' | |
puts "Watching #{Dir.pwd}/test/**/*.rb'" | |
dw = DirectoryWatcher.new "#{Dir.pwd}/test", :glob => '**/*.rb', :interval => 2 | |
dw.add_observer do |*args| | |
args.each do |event| | |
case event.type | |
when :modified | |
if event.path.split('/').last.split('.').first.match(/.*_test/) | |
puts "Re-running tests in #{event.path.split('/').last.split('.').first}" | |
system "ruby -Ilib:test '/Library/Ruby/Gems/1.8/gems/rake-0.8.5/lib/rake/rake_test_loader.rb' #{event.path}" | |
else | |
puts "Skipping non-test file" | |
end | |
end | |
end | |
end | |
dw.start | |
gets # when the user hits "enter" the script will terminate | |
dw.stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment