Class: DispatchRider::Command
- Inherits:
-
Object
- Object
- DispatchRider::Command
- Defined in:
- lib/dispatch-rider/command.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Command
constructor
A new instance of Command.
- #run(args, &block) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Command
Returns a new instance of Command.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dispatch-rider/command.rb', line 7 def initialize( = {}) @app_home = Pathname.new(Dir.getwd) = { :log_output => true, :dir_mode => :normal, :log_dir => (@app_home + "log").to_s, :dir => (@app_home + "log").to_s, :multiple => false, :monitor => false, :identifier => 0, }.merge() end |
Instance Method Details
#run(args, &block) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dispatch-rider/command.rb', line 20 def run(args, &block) process_args(args) process_name = "dispatch_rider.#{@options[:identifier]}" Daemons.run_proc(process_name, ) do $0 = File.join([:prefix], process_name) if [:prefix] Dir.chdir(@app_home.to_s) do block.call end end end |