Class: Hookie::Plugin::HipChatPlugin

Inherits:
BasePlugin show all
Defined in:
lib/hookie/plugins/hipchat_plugin.rb

Instance Attribute Summary

Attributes inherited from BasePlugin

#config

Instance Method Summary collapse

Methods inherited from BasePlugin

#config_key, #initialize, #log

Constructor Details

This class inherits a constructor from Hookie::BasePlugin

Instance Method Details

#post_receiveObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/hookie/plugins/hipchat_plugin.rb', line 28

def post_receive
  log "Sending message to HipChat ... "
  response = {}
  #log "Message: #{format_message}"
  response = speak format_message
  if response[:status]
    log "Message sent to HipChat"
  elsif response[:error]
    log "Message end failed: #{response[:error][:message]}"
  else
    log "Unknown response"
  end
end

#should_run?Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/hookie/plugins/hipchat_plugin.rb', line 14

def should_run?
  warnings = []
  if @framework.changes.empty?
    log "No changes"
    return false
  end
  warnings << "hookie.hipchat.apikey not set!" unless @config[:apikey]
  warnings << "hookie.hipchat.room not set!" unless @config[:room]

  log warnings.join(", ") unless warnings.empty?

  warnings.empty?
end

#to_sObject



10
11
12
# File 'lib/hookie/plugins/hipchat_plugin.rb', line 10

def to_s
  "HipChat Notifier"
end