Class: Backburner::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/backburner/cli.rb

Class Method Summary collapse

Class Method Details

.start(args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/backburner/cli.rb', line 6

def self.start(args)
  runner = Dante::Runner.new('backburner')
  runner.description = "Execute a backburner worker process"
  runner.with_options do |opts|
    opts.on("-r", "--require PATH", String, "The path to load as the environment.") do |req|
      options[:require] = req
    end
    opts.on("-q", "--queues PATH", String, "The specific queues to work.") do |queues|
      options[:queues] = queues
    end
    opts.on("-e", "--environment ENVIRONMENT", String, "The environment to run Backburner within") do |environment|
      options[:environment] = environment
    end
  end
  runner.execute do |opts|
    queues = (opts[:queues] ? opts[:queues].split(',') : nil) rescue nil
    load_environment(opts[:require], opts[:environment])
    Backburner.work(queues)
  end
end