Class: DamageControl::Publisher::Jabber
- Defined in:
- lib/damagecontrol/publisher/jabber.rb
Instance Attribute Summary collapse
-
#friends ⇒ Object
readonly
Returns the value of attribute friends.
-
#id_resource ⇒ Object
readonly
Returns the value of attribute id_resource.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ Jabber
constructor
A new instance of Jabber.
- #name ⇒ Object
- #publish(build) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ Jabber
Returns a new instance of Jabber.
19 20 21 22 |
# File 'lib/damagecontrol/publisher/jabber.rb', line 19 def initialize @id_resource = "[email protected]/damagecontrol" @friends = "[email protected]" end |
Instance Attribute Details
#friends ⇒ Object (readonly)
Returns the value of attribute friends.
17 18 19 |
# File 'lib/damagecontrol/publisher/jabber.rb', line 17 def friends @friends end |
#id_resource ⇒ Object (readonly)
Returns the value of attribute id_resource.
11 12 13 |
# File 'lib/damagecontrol/publisher/jabber.rb', line 11 def id_resource @id_resource end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
14 15 16 |
# File 'lib/damagecontrol/publisher/jabber.rb', line 14 def password @password end |
Instance Method Details
#name ⇒ Object
24 25 26 |
# File 'lib/damagecontrol/publisher/jabber.rb', line 24 def name "Jabber" end |
#publish(build) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/damagecontrol/publisher/jabber.rb', line 28 def publish(build) session = nil begin session = login = nil if(build.successful?) = "#{build.project.name}: #{build.} build (by #{build.changeset.developer})" else = "#{build.project.name}: #{build.changeset.developer} broke the build" end @friends.split(%r{,\s*}).each do |friend| begin session.(friend).set_subject().set_body().send rescue Exception => e Log.error "Failed to send Jabber message to #{friend}" end end ensure session.release if session end end |