From 5b9a899bdb7c69d96bc928264d1c38dfc7f8cc93 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Tue, 11 Mar 2014 21:43:32 -0700 Subject: [PATCH] Refactor banner display --- lib/sidekiq.rb | 14 ++++++++++++++ lib/sidekiq/banner.rb | 37 ------------------------------------- lib/sidekiq/cli.rb | 16 ++++------------ 3 files changed, 18 insertions(+), 49 deletions(-) delete mode 100644 lib/sidekiq/banner.rb diff --git a/lib/sidekiq.rb b/lib/sidekiq.rb index 9e72de97..bfc36177 100644 --- a/lib/sidekiq.rb +++ b/lib/sidekiq.rb @@ -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' diff --git a/lib/sidekiq/banner.rb b/lib/sidekiq/banner.rb deleted file mode 100644 index f1468f21..00000000 --- a/lib/sidekiq/banner.rb +++ /dev/null @@ -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 diff --git a/lib/sidekiq/cli.rb b/lib/sidekiq/cli.rb index 1fa8ef30..f55879f9 100644 --- a/lib/sidekiq/cli.rb +++ b/lib/sidekiq/cli.rb @@ -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