Module: RatDeployer::Notifier

Defined in:
lib/rat_deployer/notifier.rb

Class Method Summary collapse

Class Method Details

.notify(msg) ⇒ Object



36
37
38
39
40
# File 'lib/rat_deployer/notifier.rb', line 36

def self.notify(msg)
  return unless webhook_url
  return unless webhook_url
  self.slack_notifier.ping msg
end

.notify_deploy(title) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rat_deployer/notifier.rb', line 17

def self.notify_deploy(title)
  return unless webhook_url
  props = get_deploy_properties

  slack_notifier.post(
    text: title,
    attachments: [{
      title:  'Deploy details',
      fields: get_deploy_properties.map do |k,v|
        {
          title: k.to_s.titleize,
          value: k == :images ? v.join(' · ') : v,
          short: k != :images
       }
      end
    }]
  )
end

.notify_deploy_end ⇒ Object



12
13
14
15
# File 'lib/rat_deployer/notifier.rb', line 12

def self.notify_deploy_end
  return unless webhook_url
  notify_deploy "Ended deploy on #{ENV.fetch('RAT_ENV')}"
end

.notify_deploy_start ⇒ Object



7
8
9
10
# File 'lib/rat_deployer/notifier.rb', line 7

def self.notify_deploy_start
  return unless webhook_url
  notify_deploy "Starting deploy on #{ENV.fetch('RAT_ENV')}"
end