Module: Deploy::Output
- Included in:
- Runner
- Defined in:
- lib/deploy/output.rb
Instance Method Summary collapse
- #announce(attachments) ⇒ Object
- #colorize(color_code, message) ⇒ Object
- #green(message) ⇒ Object
- #notifier(message, attachments) ⇒ Object
- #pink(message) ⇒ Object
- #red(message) ⇒ Object
- #shout(message) ⇒ Object
- #yellow(message) ⇒ Object
Instance Method Details
#announce(attachments) ⇒ Object
4 5 6 7 |
# File 'lib/deploy/output.rb', line 4 def announce() shout("#{[:title]} - #{[:text]}") notifier('', ) end |
#colorize(color_code, message) ⇒ Object
47 48 49 |
# File 'lib/deploy/output.rb', line 47 def colorize(color_code, ) "\e[#{color_code}m#{}\e[0m" end |
#green(message) ⇒ Object
35 36 37 |
# File 'lib/deploy/output.rb', line 35 def green() colorize(32, ) end |
#notifier(message, attachments) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/deploy/output.rb', line 9 def notifier(, ) if ENV['SLACK_WEBHOOK'] @notifier ||= Slack::Notifier.new(ENV['SLACK_WEBHOOK']) @notifier.ping(, { attachments: [] }) else shout 'You can send deployment notifications if you set the SLACK_WEBHOOK environment variable.' end end |
#pink(message) ⇒ Object
43 44 45 |
# File 'lib/deploy/output.rb', line 43 def pink() colorize(35, ) end |
#red(message) ⇒ Object
31 32 33 |
# File 'lib/deploy/output.rb', line 31 def red() colorize(31, ) end |
#shout(message) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/deploy/output.rb', line 20 def shout() = .size if < 77 # lines are always 80 characters stars = '*' * (77 - ) puts(red("+ ") + "#{} #{red(stars)}") else puts(red('+ ') + ) end end |
#yellow(message) ⇒ Object
39 40 41 |
# File 'lib/deploy/output.rb', line 39 def yellow() colorize(33, ) end |