Class: FlowdockBuildNotifier::FlowdockNotification
- Inherits:
-
Object
- Object
- FlowdockBuildNotifier::FlowdockNotification
- Defined in:
- lib/flowdock_build_notifier.rb
Instance Attribute Summary collapse
-
#build_id ⇒ Object
readonly
Returns the value of attribute build_id.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #author_email ⇒ Object
- #build ⇒ Object
-
#initialize(build_id) ⇒ FlowdockNotification
constructor
A new instance of FlowdockNotification.
- #message ⇒ Object
- #notify ⇒ Object
- #notify_all ⇒ Object
- #notify_email ⇒ Object
Constructor Details
#initialize(build_id) ⇒ FlowdockNotification
Returns a new instance of FlowdockNotification.
13 14 15 16 |
# File 'lib/flowdock_build_notifier.rb', line 13 def initialize(build_id) @build_id = build_id @config = Configuration.load end |
Instance Attribute Details
#build_id ⇒ Object (readonly)
Returns the value of attribute build_id.
11 12 13 |
# File 'lib/flowdock_build_notifier.rb', line 11 def build_id @build_id end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/flowdock_build_notifier.rb', line 11 def config @config end |
Instance Method Details
#author_email ⇒ Object
41 42 43 |
# File 'lib/flowdock_build_notifier.rb', line 41 def `git show --format=format:%ae`.split("\n").first end |
#build ⇒ Object
37 38 39 |
# File 'lib/flowdock_build_notifier.rb', line 37 def build @build ||= BuildMetadata.new(config: config).tap { || .fetch(build_id) } end |
#message ⇒ Object
33 34 35 |
# File 'lib/flowdock_build_notifier.rb', line 33 def NotificationMessage.new(build) end |
#notify ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/flowdock_build_notifier.rb', line 18 def notify sender = FlowdockMessageSenderFactory .new(config: config) .create_sender(notify_email) sender.() notify_all if ENV['FLOWDOCK_NOTIFY_ALL_ON_FAILURE'] && build.status == "FAILURE" end |
#notify_all ⇒ Object
27 28 29 30 31 |
# File 'lib/flowdock_build_notifier.rb', line 27 def notify_all TeamRoomSender .new(config: config) .("#{} @all") end |
#notify_email ⇒ Object
45 46 47 48 |
# File 'lib/flowdock_build_notifier.rb', line 45 def notify_email return File.read('.flowdock_notify_email').strip if File.exists? '.flowdock_notify_email' end |