Class: DamageControl::Publisher::Growl
- Defined in:
- lib/damagecontrol/publisher/growl.rb
Constant Summary collapse
- NOTIFICATION_TYPES =
["Build Successful", "Build Failed"]
Instance Attribute Summary collapse
-
#hosts ⇒ Object
readonly
Returns the value of attribute hosts.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ Growl
constructor
A new instance of Growl.
- #name ⇒ Object
- #publish(build) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ Growl
Returns a new instance of Growl.
14 15 16 |
# File 'lib/damagecontrol/publisher/growl.rb', line 14 def initialize @hosts = "localhost" end |
Instance Attribute Details
#hosts ⇒ Object (readonly)
Returns the value of attribute hosts.
12 13 14 |
# File 'lib/damagecontrol/publisher/growl.rb', line 12 def hosts @hosts end |
Instance Method Details
#name ⇒ Object
18 19 20 |
# File 'lib/damagecontrol/publisher/growl.rb', line 18 def name "Growl" end |
#publish(build) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/damagecontrol/publisher/growl.rb', line 22 def publish(build) = nil index = nil if(build.successful?) = "#{build.} build (by #{build.changeset.developer})" index = 0 else = "#{build.changeset.developer} broke the build" index = 1 end @hosts.split(%r{,\s*}).each do |host| begin g = ::Growl.new(host, "DamageControl (#{build.project.name})", NOTIFICATION_TYPES) # A bug in Ruby-Growl (or Growl) prevents the message from being sticky. g.notify(NOTIFICATION_TYPES[index], build.project.name, , 0, true) rescue Exception => e Log.info("Growl publisher failed to notify #{host}: #{e.}") end end end |