module SidekiqTTY

Constants

VERSION

Public Instance Methods

configure() click to toggle source
# File lib/sidekiq_tty.rb, line 40
def configure
  Sidekiq.configure_server do |config|
    config.logger = nil
  end
end
run() click to toggle source
# File lib/sidekiq_tty.rb, line 12
def run
  configure

  box = TTY::Box.frame(
    width: TTY::Screen.width,
    height: TTY::Screen.height,
    title: { top_left: 'Scheduled Jobs', bottom_right: 'v1.0' }
  ) do
    ss = Sidekiq::ScheduledSet.new
    jobs = ss.map { |job|
      [
        job.at,
        job.queue,
        job.item['class'],
        job.args.join(', ')
      ]
    }.reverse

    table = TTY::Table.new(
      ['When', 'Queue', 'Job', 'Arguments'],
      jobs
    )
    table.render(:unicode)
  end

  print box
end