Module: PDQTest::Emoji
- Defined in:
- lib/pdqtest/emoji.rb
Constant Summary collapse
- EMOJIS =
windows can only output emojii characters in powershell ISE but ISE causes PDK to crash, so we need special lame emoji’s for our windows users
{ :windows => { :pass => ":-)", :fail => "●~*", :overall_pass => "=D", :overall_fail => "><(((*>", :slow => "(-_-)zzz", :shame => "(-_-)", }, :linux => { :pass => "😬", :fail => "💣", :overall_pass => "😎", :overall_fail => "💩", :slow => "🐌", } }
- @@disable =
false
Class Method Summary collapse
- .disable(disable) ⇒ Object
- .emoji(key) ⇒ Object
-
.emoji_message(key, message, level = ::Logger::INFO) ⇒ Object
Print a message prefixed with optional emoji to the STDOUT logger.
-
.emoji_status(status, emoji_pass, emoji_fail, label) ⇒ Object
print cool emoji based on status.
-
.final_status(status) ⇒ Object
Overall program exit status.
-
.partial_status(status, label) ⇒ Object
partial status when lots to do.
Class Method Details
.disable(disable) ⇒ Object
27 28 29 |
# File 'lib/pdqtest/emoji.rb', line 27 def self.disable(disable) @@disable = disable end |
.emoji(key) ⇒ Object
31 32 33 |
# File 'lib/pdqtest/emoji.rb', line 31 def self.emoji(key) EMOJIS[Util.host_platform][key] || raise("missing emoji #{key}") end |
.emoji_message(key, message, level = ::Logger::INFO) ⇒ Object
Print a message prefixed with optional emoji to the STDOUT logger
36 37 38 39 40 41 |
# File 'lib/pdqtest/emoji.rb', line 36 def self.(key, , level=::Logger::INFO) if ! @@disable = "#{} #{emoji(key)}" end $logger.add(level) { } end |
.emoji_status(status, emoji_pass, emoji_fail, label) ⇒ Object
print cool emoji based on status
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/pdqtest/emoji.rb', line 44 def self.emoji_status(status, emoji_pass, emoji_fail, label) lable_string = "#{label}: " if ! @@disable if status # cool bananas $logger.info lable_string + emoji_pass else # boom! crappy code $logger.error lable_string + emoji_fail end end end |
.final_status(status) ⇒ Object
Overall program exit status
63 64 65 |
# File 'lib/pdqtest/emoji.rb', line 63 def self.final_status(status) emoji_status(status, emoji(:overall_pass), emoji(:overall_fail), 'Overall') end |
.partial_status(status, label) ⇒ Object
partial status when lots to do
58 59 60 |
# File 'lib/pdqtest/emoji.rb', line 58 def self.partial_status(status, label) emoji_status(status, emoji(:pass), emoji(:fail), label) end |