forked from mynyml/watchr
-
Notifications
You must be signed in to change notification settings - Fork 2
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: http://github.com/mynyml/watchr/blob/master/test/test_script.rb
You can also look at other projects that use watchr as a lib:
all = Dir['lib/*.rb'].join('|')
watch(all) { |md| }
watch('.*/abc.rb') do |md|; end
the .*
automatically expands to include subdirectories.