-
Notifications
You must be signed in to change notification settings - Fork 73
Running Programmatically
moredip edited this page Nov 8, 2010
·
6 revisions
require 'watchr'
script = Watchr::Script.new
script.watch('foo') { puts 'bar' } # this call doesn't block
contrl = Watchr::Controller.new(script, Watchr.handler.new)
contrl.run
The Script class’s tests use it that way: https://github.com/mynyml/watchr/blob/master/test/test_script.rb
You can also look at other projects that use watchr as a lib:
- https://github.com/francois/autotestr
- https://github.com/viking/autowatchr
all = Dir['lib/*.rb'].join('|')
watch(all) { |md| }
watch('.*/abc.rb') do |md|; end
the .*
automatically expands to include subdirectories.