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 :root directory to find the executable. Defaults to ” :command Command to execute. Default to ‘bin/delayed_job’
19 20 21 22 23 |
# File 'lib/guard/delayed.rb', line 19 def initialize( = {}) super @options = @options[:command] = 'bin/delayed_job' unless @options[:command] 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 |
# File 'lib/guard/delayed.rb', line 46 def reload restart end |
#run_all ⇒ Object
Called on Ctrl-/ signal This method should be principally used for long action like running all specs/tests/…
52 53 54 |
# File 'lib/guard/delayed.rb', line 52 def run_all restart end |
#run_on_changes(paths) ⇒ Object
Called on file(s) modifications
57 58 59 |
# File 'lib/guard/delayed.rb', line 57 def run_on_changes(paths) restart end |
#start ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/guard/delayed.rb', line 25 def start run_cmd("stop") parameters = "start" parameters << " --min-priority #{@options[:min_priority]}" if @options[:min_priority] parameters << " --max-priority #{@options[:max_priority]}" if @options[:max_priority] parameters << " --number_of_workers=#{@options[:number_of_workers]}" if @options[:number_of_workers] parameters << " --pid-dir=#{@options[:pid_dir]}" if @options[:pid_dir] parameters << " --identifier=#{@options[:identifier]}" if @options[:identifier] parameters << " --monitor" if @options[:monitor] parameters << " --sleep-delay #{@options[:sleep_delay]}" if @options[:sleep_delay] parameters << " --prefix #{@options[:prefix]} " if @options[:prefix] run_cmd(parameters) end |
#stop ⇒ Object
Called on Ctrl-C signal (when Guard quits)
40 41 42 |
# File 'lib/guard/delayed.rb', line 40 def stop run_cmd("stop") end |