Class: Integrity::Notifier::Growl
- Inherits:
-
Notifier::Base
- Object
- Notifier::Base
- Integrity::Notifier::Growl
- Defined in:
- lib/notifier/growl.rb
Class Method Summary collapse
Instance Method Summary collapse
- #deliver! ⇒ Object
- #growl_type ⇒ Object
-
#initialize(build, config = {}) ⇒ Growl
constructor
A new instance of Growl.
- #message ⇒ Object
Constructor Details
#initialize(build, config = {}) ⇒ Growl
Returns a new instance of Growl.
9 10 11 12 13 14 15 |
# File 'lib/notifier/growl.rb', line 9 def initialize(build, config = {}) @addresses = config['addresses'].nil? ? [] : config.delete('addresses').split(/,\s+?|\s+/) @growls = @addresses.map do |address| ::Growl.new address, "Integrity", ["Build Successful", "Build Failed"] end super end |
Class Method Details
.to_haml ⇒ Object
17 18 19 |
# File 'lib/notifier/growl.rb', line 17 def self.to_haml File.read File.dirname(__FILE__) / "config.haml" end |
Instance Method Details
#deliver! ⇒ Object
21 22 23 24 25 |
# File 'lib/notifier/growl.rb', line 21 def deliver! @growls.each do |g| g.notify growl_type, "#{commit.project.name}: #{growl_type}", end end |
#growl_type ⇒ Object
27 28 29 |
# File 'lib/notifier/growl.rb', line 27 def growl_type "Build #{commit.successful? ? 'Successful' : 'Failed'}" end |
#message ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/notifier/growl.rb', line 31 def @message ||= begin <<-MSG.gsub!(/^ {12}/, '') Author: #{commit..name} #{commit.} MSG end end |