Class: Mutant::Reporter::CLI
- Inherits:
-
Mutant::Reporter
- Object
- Mutant::Reporter
- Mutant::Reporter::CLI
- Defined in:
- lib/mutant/reporter/cli.rb,
lib/mutant/reporter/cli/tput.rb,
lib/mutant/reporter/cli/format.rb,
lib/mutant/reporter/cli/printer.rb
Overview
Reporter that reports in human readable format
Defined Under Namespace
Classes: Format, Printer, Tput
Class Method Summary collapse
-
.build(output) ⇒ Reporter::CLI
private
Build reporter.
Instance Method Summary collapse
-
#delay ⇒ Float
private
Return report delay in seconds.
-
#progress(status) ⇒ self
private
Report progress object.
-
#report(env) ⇒ self
private
Report env.
-
#start(env) ⇒ self
private
Report start.
-
#warn(message) ⇒ self
private
Report warning.
Class Method Details
.build(output) ⇒ Reporter::CLI
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build reporter
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mutant/reporter/cli.rb', line 15 def self.build(output) tput = Tput.detect tty = output.respond_to?(:tty?) && output.tty? format = if !Mutant.ci? && tty && tput Format::Framed.new(tty: tty, tput: tput) else Format::Progressive.new(tty: tty) end new(output, format) end |
Instance Method Details
#delay ⇒ Float
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return report delay in seconds
TODO: Move this to a callback registration
Reporters other than CLI that might exist in future
may only need the final report. So providing a noop callback
registration makes more sense for these.
As only CLI reporters exist currently I do not really care right now.
65 66 67 |
# File 'lib/mutant/reporter/cli.rb', line 65 def delay format.delay end |
#progress(status) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Report progress object
47 48 49 50 |
# File 'lib/mutant/reporter/cli.rb', line 47 def progress(status) write(format.progress(status)) self end |
#report(env) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Report env
90 91 92 93 |
# File 'lib/mutant/reporter/cli.rb', line 90 def report(env) Printer::EnvResult.run(output, env) self end |
#start(env) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Report start
34 35 36 37 |
# File 'lib/mutant/reporter/cli.rb', line 34 def start(env) write(format.start(env)) self end |
#warn(message) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Report warning
77 78 79 80 |
# File 'lib/mutant/reporter/cli.rb', line 77 def warn() output.puts() self end |