Method: Quebert::CommandLineRunner.dispatch

Defined in:
lib/quebert/command_line_runner.rb

.dispatch(args = ARGV) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/quebert/command_line_runner.rb', line 42

def self.dispatch(args = ARGV)
  runner = new(args)
  params = runner.options

  if dir = params[:chdir]
    Dir.chdir dir
  end

  if pid_file = params[:pid]
    Support::PidFile.new(pid_file).write!
  end

  if log_path = params[:log]
    Quebert.config.log_file_path = log_path
  end

  if config = params[:config] || auto_config
    require config
  end

  worker = Worker.new
  worker.queues = params[:queues] if params[:queues]
  worker.start
end