Class: GroongaQueryLog::Command::RunRegressionTest::MailNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-query-log/command/run-regression-test.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ MailNotifier

Returns a new instance of MailNotifier.



682
683
684
685
# File 'lib/groonga-query-log/command/run-regression-test.rb', line 682

def initialize(options)
  @options = options
  @path = @options[:path] || "results"
end

Instance Method Details

#notify_finished(success, elapsed_time) ⇒ Object



694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
# File 'lib/groonga-query-log/command/run-regression-test.rb', line 694

def notify_finished(success, elapsed_time)
  return unless @options[:mail_to]

  output = StringIO.new
  formetter = FormatRegressionTestLogs.new(output: output)
  formetter.run([@path])
  formatted_log = output.string

  if success
    subject = @options[:mail_subject_on_success]
  else
    subject = @options[:mail_subject_on_failure]
  end
  content = format_elapsed_time(elapsed_time)
  content << "Report:\n"
  content << formatted_log
  send_mail(subject, content)
end

#notify_startedObject



687
688
689
690
691
692
# File 'lib/groonga-query-log/command/run-regression-test.rb', line 687

def notify_started
  return unless @options[:mail_to]

  subject = @options[:mail_subject_on_start]
  send_mail(subject, "")
end