Class: Chatopsify::CoLib

Inherits:
Object
  • Object
show all
Defined in:
lib/chatopsify/co.rb

Overview

ChatOps service libs

Class Method Summary collapse

Class Method Details

.msg_fmt(status = nil) ⇒ Object

rubocop:disable Lint/TripleQuotes, Style/StringLiterals, Layout/IndentationWidth



99
100
101
102
103
104
105
106
107
108
109
# File 'lib/chatopsify/co.rb', line 99

def msg_fmt(status = nil)
"""#{text(status)}
| TITLE | CONTENTS |
|----------:|:-------------|
| Stage | #{fetch(:stage)&.upcase!} |
| Server | #{fetch(:ip_address)}|
| Branch | #{fetch(:branch)} |
| Revision | #{fetch(:current_revision) || '<empty>'} |
| Timestamp | #{Time.now.getlocal('+07:00') || Time.now} |
"""
end

.text(status) ⇒ Object



87
88
89
90
91
92
93
94
95
96
# File 'lib/chatopsify/co.rb', line 87

def text(status)
  case status
  when :starting
    fetch(:chatops_deploy_starting_text)
  when :success
    fetch(:chatops_deploy_succeed_text)
  when :failed
    fetch(:chatops_deploy_failed_text)
  end
end