1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Refactor banner display

This commit is contained in:
Mike Perham 2014-03-11 21:43:32 -07:00
parent 2da06dcfe7
commit 5b9a899bdb
3 changed files with 18 additions and 49 deletions

View file

@ -131,6 +131,20 @@ module Sidekiq
raise ArgumentError, "Invalid event name: #{event}" if !options[:lifecycle_events].keys.include?(event)
options[:lifecycle_events][event] << block
end
BANNER = %q{ s
ss
sss sss ss
s sss s ssss sss ____ _ _ _ _
s sssss ssss / ___|(_) __| | ___| | _(_) __ _
s sss \___ \| |/ _` |/ _ \ |/ / |/ _` |
s sssss s ___) | | (_| | __/ <| | (_| |
ss s s |____/|_|\__,_|\___|_|\_\_|\__, |
s s s |_|
s s
sss
sss }
end
require 'sidekiq/extensions/class_methods'

View file

@ -1,37 +0,0 @@
module Sidekiq
module Banner
def print_oss_banner
puts %q{ s
ss
sss sss ss
s sss s ssss sss ____ _ _ _ _
s sssss ssss / ___|(_) __| | ___| | _(_) __ _
s sss \___ \| |/ _` |/ _ \ |/ / |/ _` |
s sssss s ___) | | (_| | __/ <| | (_| |
ss s s |____/|_|\__,_|\___|_|\_\_|\__, |
s s s |_|
s s
sss
sss }
end
def print_pro_banner
puts <<-BANNER
L i L ;f
., LLL. L i L ,l GGGGG
,G @ G L . i L G Gf
@@ @ ,@@; L L LLLf iLLL L lL ; iLLLL G . GG G;GG fGGGG
.@@@f .@@@ L L L i L L L L ; L L G GG GG G G
@@@@L@@@ LLL. L. L i i L L L ; L L G G: G; G G,
@@@@@@L L L L i fLLLLL LLf ; L L GGGGG G; G G;
C@ @@@ L L L . i. :, L L: ; L L G G; G G.
C @l L L L L L L L ; L L G. G; G G
@. lLLL L LLt t ,LLL. L L ; LL L G G; GGGt
.@ . L.
..@ L
.@
@
BANNER
end
end
end

View file

@ -6,7 +6,6 @@ require 'optparse'
require 'erb'
require 'sidekiq'
require 'sidekiq/banner'
require 'sidekiq/util'
module Sidekiq
@ -19,7 +18,6 @@ module Sidekiq
class Shutdown < Interrupt; end
class CLI
include Banner
include Util
include Singleton
@ -58,16 +56,10 @@ module Sidekiq
end
# Print logo and banner for development
if environment == 'development'
if Sidekiq::NAME == 'Sidekiq Pro'
puts "\e[#{31}m"
print_pro_banner
puts "\e[0m"
else
puts "\e[#{31}m"
print_oss_banner
puts "\e[0m"
end
if environment == 'development' && $stdout.tty?
puts "\e[#{31}m"
puts Sidekiq::BANNER
puts "\e[0m"
end
redis {} # noop to connect redis and print info