Class: Guard::Delayed
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Delayed
- Defined in:
- lib/guard/delayed.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Delayed
constructor
Allowable options are: :environment defaults to ‘test’ :min_priority e.g.
-
#reload ⇒ Object
Called on Ctrl-Z signal This method should be mainly used for “reload” (really!) actions like reloading passenger/spork/bundler/…
-
#run_all ⇒ Object
Called on Ctrl-/ signal This method should be principally used for long action like running all specs/tests/…
-
#run_on_changes(paths) ⇒ Object
Called on file(s) modifications.
- #start ⇒ Object
-
#stop ⇒ Object
Called on Ctrl-C signal (when Guard quits).
Constructor Details
#initialize(options = {}) ⇒ Delayed
Allowable options are: :environment defaults to ‘test’ :min_priority e.g. 2 :max_priority e.g. 10 :number_of_workers e.g. 2 :pid_dir e.g. tmp/pids Specifies an alternate directory in which to store the process ids. :identifier A numeric identifier for the worker. :monitor Start monitor process. :sleep-delay N Amount of time to sleep in seconds when no jobs are found :prefix NAME String to be prefixed to worker process names
18 19 20 21 |
# File 'lib/guard/delayed.rb', line 18 def initialize( = {}) = super end |
Instance Method Details
#reload ⇒ Object
Called on Ctrl-Z signal This method should be mainly used for “reload” (really!) actions like reloading passenger/spork/bundler/…
46 47 48 49 |
# File 'lib/guard/delayed.rb', line 46 def reload UI.info "Restarting delayed_job..." restart end |
#run_all ⇒ Object
Called on Ctrl-/ signal This method should be principally used for long action like running all specs/tests/…
53 54 55 |
# File 'lib/guard/delayed.rb', line 53 def run_all restart end |
#run_on_changes(paths) ⇒ Object
Called on file(s) modifications
58 59 60 |
# File 'lib/guard/delayed.rb', line 58 def run_on_changes(paths) restart end |
#start ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/guard/delayed.rb', line 23 def start run_cmd("stop") UI.info "Starting up delayed_job..." parameters = "start" parameters << " --min-priority #{@options[:min_priority]}" if [:min_priority] parameters << " --max-priority #{@options[:max_priority]}" if [:max_priority] parameters << " --number_of_workers=#{@options[:number_of_workers]}" if [:number_of_workers] parameters << " --pid-dir=#{@options[:pid_dir]}" if [:pid_dir] parameters << " --identifier=#{@options[:identifier]}" if [:identifier] parameters << " --monitor" if [:monitor] parameters << " --sleep-delay #{@options[:sleep_delay]}" if [:sleep_delay] parameters << " --prefix #{@options[:prefix]} " if [:prefix] run_cmd(parameters) end |
#stop ⇒ Object
Called on Ctrl-C signal (when Guard quits)
39 40 41 42 |
# File 'lib/guard/delayed.rb', line 39 def stop UI.info "Stopping delayed_job..." run_cmd("stop") end |