12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# 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
|