Class: Integrity::Notifier::Jabber
- Inherits:
-
Notifier::Base
- Object
- Notifier::Base
- Integrity::Notifier::Jabber
- Defined in:
- lib/notifier/jabber.rb
Instance Attribute Summary collapse
-
#recipients ⇒ Object
readonly
Returns the value of attribute recipients.
Class Method Summary collapse
Instance Method Summary collapse
- #deliver! ⇒ Object
-
#initialize(build, config = {}) ⇒ Jabber
constructor
A new instance of Jabber.
- #message ⇒ Object
Constructor Details
#initialize(build, config = {}) ⇒ Jabber
Returns a new instance of Jabber.
14 15 16 17 18 19 20 21 |
# File 'lib/notifier/jabber.rb', line 14 def initialize(build, config = {}) host = config["host"].blank? ? nil : config.delete("host") port = config["port"].blank? ? 5222 : config.delete("port") @server = ::Jabber::Simple.new(config.delete("user"), config.delete("pass"), nil, "Available", host, port) sleep 4 @recipients = config["recipients"].nil? ? [] : config.delete("recipients").split(/\s+/) super end |
Instance Attribute Details
#recipients ⇒ Object (readonly)
Returns the value of attribute recipients.
8 9 10 |
# File 'lib/notifier/jabber.rb', line 8 def recipients @recipients end |
Class Method Details
.to_haml ⇒ Object
10 11 12 |
# File 'lib/notifier/jabber.rb', line 10 def self.to_haml File.read File.dirname(__FILE__) / "config.haml" end |
Instance Method Details
#deliver! ⇒ Object
23 24 25 26 27 |
# File 'lib/notifier/jabber.rb', line 23 def deliver! @recipients.each do |r| @server.deliver(r, ) end end |
#message ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/notifier/jabber.rb', line 29 def @message ||= <<-content #{commit.project.name}: #{} (#{commit.committed_at} by #{commit..name}) Message: #{commit.} Link: #{commit_url} content end |