Created
April 18, 2011 07:17
-
-
Save thirdreplicator/924934 to your computer and use it in GitHub Desktop.
Handy directory watcher for running tests in the background.
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
require 'directory_watcher' | |
# gem 'directory_watcher.rb' | |
# gem 'rev' | |
#command = 'rspec --drb --color spec' | |
command = "cucumber --drb -f html -o tmp/cuke.html -f progress -o tmp/progress.txt features" | |
dw = DirectoryWatcher.new '.', :pre_load => true, :scanner => :rev | |
dw.glob = '**/*.{rb,feature,haml,erb}' | |
dw.reset true | |
dw.interval = 1.0 | |
dw.stable = 1.0 | |
system(command) | |
dw.add_observer do |*args| | |
args.each do |event| | |
#puts event if event.to_s =~ /stable/ | |
system(command) if event.to_s =~ /stable/ | |
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