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.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/dispatch-rider/command.rb', line 8 def initialize( = {}) @app_home = Pathname.new(Dir.getwd) @options = { :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
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dispatch-rider/command.rb', line 21 def run(args, &block) process_args(args) process_name = "dispatch_rider.#{@options[:identifier]}" Daemons.run_proc(process_name, @options) do $0 = File.join(@options[:prefix], process_name) if @options[:prefix] Dir.chdir(@app_home.to_s) do block.call end end end |