lib/autoload/kuroko2/workflow/notifier/hipchat.rb in kuroko2-0.2.3 vs lib/autoload/kuroko2/workflow/notifier/hipchat.rb in kuroko2-0.3.0

- old
+ new

@@ -11,18 +11,44 @@ @definition = instance.job_definition @hipchat = Kuroko2.config.notifiers.hipchat.api_token @message_builder = Workflow::Notifier::Concerns::ChatMessageBuilder.new(instance) end - def notify_working - # do nothing + def notify_launch + if @definition.hipchat_notify_finished? + message = build_message(level: 'SUCCESS', text: message_builder.launched_text) + message << "<br>" + message << @instance.logs.reverse.detect{ |log| log.level == 'INFO' }.try!(:message) + + send_to_hipchat(message, color: 'yellow') + end end + def notify_retrying + if @definition.hipchat_notify_finished + message = build_message(level: 'SUCCESS', text: message_builder.retrying_text) + message << "<br>" + message << @instance.logs.last(2).first.message + + send_to_hipchat(message, color: 'yellow') + end + end + + def notify_skipping + if @definition.hipchat_notify_finished + message = build_message(level: 'SUCCESS', text: message_builder.skipping_text) + message << "<br>" + message << @instance.logs.last(2).first.message + + send_to_hipchat(message, color: 'yellow') + end + end + def notify_cancellation - if @definition.notify_cancellation + if @definition.notify_cancellation || @definition.hipchat_notify_finished? message = build_message(level: 'WARNING', text: message_builder.failure_text) message << "<br>" - message << @instance.logs.last(2).first.message + message << @instance.logs.reverse.detect{ |log| log.level == 'WARN' }.try!(:message) send_to_hipchat(message, color: 'yellow') end end