Class: Rote::RCovTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Rote::RCovTask
- Defined in:
- lib/rote/extratasks.rb
Overview
Rake task library that allows code-coverage reports to be generated using RCov (eigenclass.org/hiki.rb?rcov).
Instance Attribute Summary collapse
-
#excludes ⇒ Object
Set of glob patterns that should be excluded from the test run.
-
#failonerror ⇒ Object
If
false
, the task will emit a warning rather than failing when Rcov command fails. -
#load_paths ⇒ Object
Extra load-paths that should be appended to $: when running the test cases.
-
#no_color ⇒ Object
If true, RCov will generate colorblind-safe output.
-
#output_dir ⇒ Object
The path to which RCov should generate output [./coverage].
-
#profile ⇒ Object
Determines whether bogo-profiling is enabled [false].
-
#range ⇒ Object
The color scale range for profiling output (dB) [not used].
-
#rcov_cmd ⇒ Object
The command that runs RCov [‘rcov’].
-
#source_files ⇒ Object
A
Rake::FileList
holding Ruby source filenames that are included in the coverage report. -
#taskname ⇒ Object
readonly
The base name for the generated task [:rcov].
-
#test_files ⇒ Object
A
Rake::FileList
holding unit-test filenames and globs.
Instance Method Summary collapse
-
#initialize(name = :rcov, failonerror = true) {|_self| ... } ⇒ RCovTask
constructor
Create a new RCovTask, using the supplied block for configuration, and define tasks with the specified base-name within Rake.
Constructor Details
#initialize(name = :rcov, failonerror = true) {|_self| ... } ⇒ RCovTask
Create a new RCovTask, using the supplied block for configuration, and define tasks with the specified base-name within Rake.
Note that the named task just invokes a file task for the output directory, which is dependent on test (and source, if specified) file changes.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/rote/extratasks.rb', line 61 def initialize(name = :rcov, failonerror = true) # :yield: self if block_given? @taskname = name @rcov_cmd = 'rcov' @test_files = Rake::FileList.new @source_files = Rake::FileList.new @load_paths = [] @excludes = [] @output_dir = './coverage' @failonerror = true yield self if block_given? define(name) end |
Instance Attribute Details
#excludes ⇒ Object
Set of glob patterns that should be excluded from the test run. [none]
44 45 46 |
# File 'lib/rote/extratasks.rb', line 44 def excludes @excludes end |
#failonerror ⇒ Object
If false
, the task will emit a warning rather than failing when Rcov command fails. [true]
53 54 55 |
# File 'lib/rote/extratasks.rb', line 53 def failonerror @failonerror end |
#load_paths ⇒ Object
Extra load-paths that should be appended to $: when running the test cases. [none]
37 38 39 |
# File 'lib/rote/extratasks.rb', line 37 def load_paths @load_paths end |
#no_color ⇒ Object
If true, RCov will generate colorblind-safe output. [false]
40 41 42 |
# File 'lib/rote/extratasks.rb', line 40 def no_color @no_color end |
#output_dir ⇒ Object
The path to which RCov should generate output [./coverage]
33 34 35 |
# File 'lib/rote/extratasks.rb', line 33 def output_dir @output_dir end |
#profile ⇒ Object
Determines whether bogo-profiling is enabled [false]
47 48 49 |
# File 'lib/rote/extratasks.rb', line 47 def profile @profile end |
#range ⇒ Object
The color scale range for profiling output (dB) [not used]
50 51 52 |
# File 'lib/rote/extratasks.rb', line 50 def range @range end |
#rcov_cmd ⇒ Object
The command that runs RCov [‘rcov’]
19 20 21 |
# File 'lib/rote/extratasks.rb', line 19 def rcov_cmd @rcov_cmd end |
#source_files ⇒ Object
A Rake::FileList
holding Ruby source filenames that are included in the coverage report. This is optional - RCov finds sources by running them. However, if you do specify your files here then the coverage report will only be generated when they change.
30 31 32 |
# File 'lib/rote/extratasks.rb', line 30 def source_files @source_files end |
#taskname ⇒ Object (readonly)
The base name for the generated task [:rcov]
16 17 18 |
# File 'lib/rote/extratasks.rb', line 16 def taskname @taskname end |
#test_files ⇒ Object
A Rake::FileList
holding unit-test filenames and globs. RCov will execute these to generate the report.
23 24 25 |
# File 'lib/rote/extratasks.rb', line 23 def test_files @test_files end |