Class: Autoproj::Reporter
- Inherits:
-
Autobuild::Reporter
- Object
- Autobuild::Reporter
- Autoproj::Reporter
- Defined in:
- lib/autoproj/reporter.rb
Overview
Subclass of Autobuild::Reporter, used to display a message when the build finishes/fails.
Instance Method Summary collapse
Instance Method Details
#elapsed_time ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/autoproj/reporter.rb', line 69 def elapsed_time return unless @timer_start secs = Time.now - @timer_start return if secs < 1 [[60, "sec"], [60, "min"], [24, "hour"], [1000, "day"]].map do |count, name| if secs > 0 secs, n = secs.divmod(count) next if (val = n.to_i) == 0 "#{val} #{val > 1 ? "#{name}s" : name}" end end.compact.reverse.join(" ") end |
#error(error) ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/autoproj/reporter.rb', line 54 def error(error) error_lines = error.to_s.split("\n") Autoproj.not_silent do Autoproj.("Command failed", :bold, :red, STDERR) Autoproj.(error_lines.shift.to_s, :bold, :red, STDERR) error_lines.each do |line| Autoproj. line, STDERR end end end |
#reset_timer ⇒ Object
65 66 67 |
# File 'lib/autoproj/reporter.rb', line 65 def reset_timer @timer_start = Time.now end |