Class: Quredis::CLI

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

Instance Method Summary collapse

Instance Method Details

#destroy(queue_name) ⇒ Object



28
29
30
# File 'lib/quredis/cli.rb', line 28

def destroy(queue_name)
  Quredis::Admin.new(options).destroy_queue(queue_name)
end

#lsObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/quredis/cli.rb', line 13

def ls
  table = Quredis::Admin.new(options).queues[:items].map do |q|
    [q['name'], 
    "#{q['ingress']} (#{q['ingress_count']})", 
    "#{q['transit']} (#{q['transit_count']})",
    "#{q['escape']} (#{q['escape_count']})"]
  end
  table.unshift ["Name", "Ingress", "Transit", "Escape"]

  Thor::Base.shell.new.print_table(table, :indent => 2, :truncate => true)
end

#purge(queue_name, queue_type) ⇒ Object



35
36
37
# File 'lib/quredis/cli.rb', line 35

def purge(queue_name, queue_type)
  Quredis::Admin.new(options).purge(queue_name, queue_type)
end

#retry(queue_name, queue_type) ⇒ Object



42
43
44
# File 'lib/quredis/cli.rb', line 42

def retry(queue_name, queue_type)
  Quredis::Admin.new(options).retry(queue_name, queue_type)
end

#versionObject



60
61
62
# File 'lib/quredis/cli.rb', line 60

def version
  puts "Quredis #{Quredis::VERSION}"
end

#webObject



52
53
54
55
56
57
# File 'lib/quredis/cli.rb', line 52

def web
  [:redis_host, :redis_port, :bind, :port, :server].each do |option|
    Quredis::Web.set(option, options[option]) if options[option]
  end
  Quredis::Web.run!
end