Class: Guard::Play
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ Play
constructor
Initialize a Guard.
-
#reload ⇒ Object
Called when ‘reload|r|z + enter` is pressed.
-
#run_all ⇒ Object
Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…
-
#run_on_change(paths) ⇒ Object
Called on file(s) modifications that the Guard watches.
-
#run_on_deletion(paths) ⇒ Object
Called on file(s) deletions that the Guard watches.
-
#start ⇒ Object
Call once when Guard starts.
-
#stop ⇒ Object
Called when ‘stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
Constructor Details
#initialize(watchers = [], options = {}) ⇒ Play
Initialize a Guard.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/guard/play.rb', line 10 def initialize(watchers = [], = {}) super @options = { :app_path => '', :http_port => 29000, # NOT USE :jpda_port => 28000 # NOT USE }.update() @last_failed = false @app_path = @options[:app_path] @notify_title = @app_path.empty? ? "Play!" : "Play! on #{@app_path}" @cmd_auto_test_deps = "cd #{@app_path}; play auto-test --deps; cd -" @cmd_auto_test = "cd #{@app_path}; play auto-test; cd -" end |
Instance Method Details
#reload ⇒ Object
Called when ‘reload|r|z + enter` is pressed. This method should be mainly used for “reload” (really!) actions like reloading passenger/spork/bundler/…
41 42 |
# File 'lib/guard/play.rb', line 41 def reload end |
#run_all ⇒ Object
Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…
47 48 49 |
# File 'lib/guard/play.rb', line 47 def run_all run_auto_test(@cmd_auto_test_deps) end |
#run_on_change(paths) ⇒ Object
Called on file(s) modifications that the Guard watches.
54 55 56 |
# File 'lib/guard/play.rb', line 54 def run_on_change(paths) run_auto_test(@cmd_auto_test) end |
#run_on_deletion(paths) ⇒ Object
Called on file(s) deletions that the Guard watches.
61 62 63 |
# File 'lib/guard/play.rb', line 61 def run_on_deletion(paths) run_auto_test(@cmd_auto_test) end |
#start ⇒ Object
Call once when Guard starts. Please override initialize method to init stuff.
27 28 29 30 |
# File 'lib/guard/play.rb', line 27 def start UI.info "Guard::Play is waiting to run auto-test..." run_all end |
#stop ⇒ Object
Called when ‘stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
34 35 36 |
# File 'lib/guard/play.rb', line 34 def stop UI.info "Guard::Play is stoped." end |