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



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

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 | #{TZInfo::Timezone.get('Asia/Ho_Chi_Minh')&.now || Time.now} |
"""
end

.text(status) ⇒ Object



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

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