Class: Integrity::Notifier::Base
- Defined in:
- lib/integrity/notifier/base.rb
Instance Attribute Summary collapse
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
- #build_url ⇒ Object
- #commit_url ⇒ Object
- #deliver! ⇒ Object
- #full_message ⇒ Object
-
#initialize(commit, config) ⇒ Base
constructor
A new instance of Base.
- #short_message ⇒ Object
Constructor Details
#initialize(commit, config) ⇒ Base
Returns a new instance of Base.
18 19 20 21 |
# File 'lib/integrity/notifier/base.rb', line 18 def initialize(commit, config) @commit = commit @config = config end |
Instance Attribute Details
#commit ⇒ Object (readonly)
Returns the value of attribute commit.
16 17 18 |
# File 'lib/integrity/notifier/base.rb', line 16 def commit @commit end |
Class Method Details
.notify_of_build(build, config) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/integrity/notifier/base.rb', line 4 def self.notify_of_build(build, config) Integrity.log "Notifying of build #{build.commit.short_identifier} using the #{to_s} notifier" Timeout.timeout(8) { new(build.commit, config).deliver! } rescue Timeout::Error Integrity.log "#{to_s} notifier timed out" false end |
.to_haml ⇒ Object
12 13 14 |
# File 'lib/integrity/notifier/base.rb', line 12 def self.to_haml raise NotImplementedError, "you need to implement this method in your notifier" end |
Instance Method Details
#build ⇒ Object
23 24 25 26 |
# File 'lib/integrity/notifier/base.rb', line 23 def build warn "Notifier::Base#build is deprecated, use Notifier::Base#commit instead (#{caller[0]})" commit end |
#build_url ⇒ Object
57 58 59 60 |
# File 'lib/integrity/notifier/base.rb', line 57 def build_url warn "Notifier::Base#build_url is deprecated, use Notifier::Base#commit_url instead (#{caller[0]})" commit_url end |
#commit_url ⇒ Object
52 53 54 55 |
# File 'lib/integrity/notifier/base.rb', line 52 def commit_url raise if Integrity.config[:base_uri].nil? Integrity.config[:base_uri] / commit.project.permalink / "commits" / commit.identifier end |
#deliver! ⇒ Object
28 29 30 |
# File 'lib/integrity/notifier/base.rb', line 28 def deliver! raise NotImplementedError, "you need to implement this method in your notifier" end |
#full_message ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/integrity/notifier/base.rb', line 36 def <<-EOM "Build #{commit.identifier} #{commit.successful? ? "was successful" : "failed"}" Commit Message: #{commit.} Commit Date: #{commit.committed_at} Commit Author: #{commit..name} Link: #{commit_url} Build Output: #{stripped_commit_output} EOM end |
#short_message ⇒ Object
32 33 34 |
# File 'lib/integrity/notifier/base.rb', line 32 def commit.human_readable_status end |