Class: Bozo::Hooks::Hipchat

Inherits:
Object
  • Object
show all
Defined in:
lib/bozo/hooks/hipchat.rb

Overview

Hooks for notifying Hipchat of the build

The following env variables are required

  • BUILD_URL

  • BUILD_NAME

with_hook :hipchat do |h|

h.token   '.....'
h.room_id 'Dev'
h.name    'Bozo'
h.notify  :failure

end

Constant Summary collapse

COLOR_MAP =
{ pending: 'gray', success: 'green', failure: 'red' }

Instance Method Summary collapse

Constructor Details

#initializeHipchat

Returns a new instance of Hipchat.



23
24
25
26
# File 'lib/bozo/hooks/hipchat.rb', line 23

def initialize
  @name = 'Bozo'
  @notify = []
end

Instance Method Details

#failed_buildObject



36
37
38
# File 'lib/bozo/hooks/hipchat.rb', line 36

def failed_build
  submit_notification(:failure, "Failed to build #{project_name}")
end

#name(name) ⇒ Object



48
49
50
# File 'lib/bozo/hooks/hipchat.rb', line 48

def name(name)
  @name = name
end

#notify(state) ⇒ Object



52
53
54
# File 'lib/bozo/hooks/hipchat.rb', line 52

def notify(state)
  @notify << state
end

#post_buildObject



32
33
34
# File 'lib/bozo/hooks/hipchat.rb', line 32

def post_build
  submit_notification(:success, "Built #{project_name}")
end

#pre_buildObject



28
29
30
# File 'lib/bozo/hooks/hipchat.rb', line 28

def pre_build
  submit_notification(:pending, "Building #{project_name}")
end

#room_id(room) ⇒ Object



44
45
46
# File 'lib/bozo/hooks/hipchat.rb', line 44

def room_id(room)
  @room = room
end

#token(token) ⇒ Object



40
41
42
# File 'lib/bozo/hooks/hipchat.rb', line 40

def token(token)
  @token = token
end