Class: Integrity::Notifier::Growl

Inherits:
Notifier::Base
  • Object
show all
Defined in:
lib/notifier/growl.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(build, config = {}) ⇒ Growl

Returns a new instance of Growl.



9
10
11
12
13
14
15
16
# File 'lib/notifier/growl.rb', line 9

def initialize(build, config = {})
  @growl = Growl.new "localhost", "Integrity", ["Integrity build notification"]
  @addresses = config[:addresses].nil? ? [] : config.delete(:addresses).split(/,|\s+/)
  @growl = @addresses.map do |address|
    Growl.new address, "Integrity", ["Integrity build notification"]
  end
  super
end

Class Method Details

.to_hamlObject



18
19
20
# File 'lib/notifier/growl.rb', line 18

def self.to_haml
  File.read File.dirname(__FILE__) / "config.haml"
end

Instance Method Details

#deliver!Object



22
23
24
25
26
# File 'lib/notifier/growl.rb', line 22

def deliver!
  @growl.each do |g|
    g.notify "Integrity build notification", short_message, message
  end
end

#messageObject



28
29
30
31
32
33
34
# File 'lib/notifier/growl.rb', line 28

def message
  @message ||= <<-content
  #{build.project.name}: #{short_message} (at #{build.commited_at} by #{build.commit_author.name})
  Commit Message: '#{build.commit_message}'          
  Link: #{build_url}
content
end