Module: Autocuke::Handler
- Defined in:
- lib/autocuke/handler.rb
Instance Method Summary collapse
-
#file_deleted ⇒ Object
Triggered after a file has been deleted.
-
#file_modified ⇒ Object
Triggered after a file has been modified.
-
#file_moved ⇒ Object
Triggered after a file has been moved.
-
#unbind ⇒ Object
Stop EM if the file doesn’t exist.
Instance Method Details
#file_deleted ⇒ Object
Triggered after a file has been deleted. In text editors, the file is deleted and recreated rather than modified. If so, we’ll start watching the new file and trigger ‘file_modified`
22 23 24 25 26 27 28 29 |
# File 'lib/autocuke/handler.rb', line 22 def file_deleted if File.exists?(path) file_modified runtime.watch(path) else stop! end end |
#file_modified ⇒ Object
Triggered after a file has been modified
5 6 7 8 9 10 11 12 |
# File 'lib/autocuke/handler.rb', line 5 def file_modified return if runtime.current_file runtime.current_file = path local = path.sub(/.*#{runtime..root}\/?/, '') cmd = "cd #{runtime.root}; bundle exec cucumber -p autocuke #{local}" puts "#{local} modified - re-cuking it." run_with_defer cmd end |
#file_moved ⇒ Object
Triggered after a file has been moved
15 16 17 |
# File 'lib/autocuke/handler.rb', line 15 def file_moved stop! unless File.exists?(path) end |
#unbind ⇒ Object
Stop EM if the file doesn’t exist
32 33 34 |
# File 'lib/autocuke/handler.rb', line 32 def unbind stop! unless File.exists?(path) end |