Browse files

Rakefile, README.API, README.rant: added RDoc documentation for the R…

…ant support.

  • Loading branch information...
1 parent 3040994 commit 1e2f13a1f415126cb4dae6ef25e1af7cd22d200d @mfp mfp committed May 28, 2006
Showing with 73 additions and 4 deletions.
  1. +3 −2 README.API
  2. +68 −0 README.rant
  3. +2 −2 Rakefile
@@ -10,8 +10,9 @@ If you want to use the command line tool, the output from
rcov -h
is self-explicative.
-If you want to automate the execution of +rcov+ via Rake, take a look at
+If you want to automate the execution of +rcov+ via Rake or Rant, take a look at
+README.rake[link:files/README_rake.html] or
+README.rant[link:files/README_rant.html], respectively.
If you want to use the associated library, read on.
@@ -0,0 +1,68 @@
+== Code coverage analysis automation with Rant
+Since 0.5.0, <tt>rcov</tt> features a <tt>Rcov</tt> generator for eant
+which can be used to automate test coverage analysis. Basic usage is as
+ require 'rcov/rant'
+ desc "Create a cross-referenced code coverage report."
+ gen Rcov do |g|
+ g.test_files = sys['test/test*.rb']
+ end
+This will create by default a task named <tt>rcov</tt>.
+=== Passing command line options to <tt>rcov</tt>
+You can provide a description, change the name of the generated tasks (the
+one used to generate the report(s) and the clobber_ one) and pass options to
+ desc "Create cross-referenced code coverage report."
+ gen Rcov, :coverage do |g|
+ g.test_files = sys['test/test*.rb']
+ g.rcov_opts << "--threshold 80" << "--callsites"
+ end
+That will generate a <tt>coverage</tt> task.
+You can specify a different destination directory, which comes handy if you
+have several rcov tasks:
+ desc "Analyze code coverage for the FileStatistics class."
+ gen Rcov, :rcov_sourcefile do |g|
+ g.libs << "ext/rcovrt"
+ g.test_files = sys['test/test_FileStatistics.rb']
+ g.rcov_opts << "--test-unit-only"
+ g.output_dir = "coverage.sourcefile"
+ end
+ desc "Analyze code coverage for CodeCoverageAnalyzer."
+ gen Rcov, :rcov_ccanalyzer do |g|
+ g.libs << "ext/rcovrt"
+ g.test_files = sys['test/test_CodeCoverageAnalyzer.rb']
+ g.rcov_opts << "--test-unit-only"
+ g.output_dir = "coverage.ccanalyzer"
+ end
+=== Options specified passed to the generator
+The +Rcov+ generator recognizes the following options:
++libs+: directories to be added to the <tt>$LOAD_PATH</tt>
++rcov_opts+: array of options to be passed to rcov
++test_files+: files to execute
++test_dirs+: directories where to look for test files automatically
++pattern+: pattern for automatic discovery of unit tests to be executed
++output_dir+: directory where to leave the generated reports
++test_files+ overrides the combination of +test_dirs+ and +pattern+.
+=== Options passed through the <tt>rake</tt> command line
+You can override the options defined in the Rcov tasks by specifying them
+using environment variables at the time rant is executed.
+ RCOVPATH=/my/modified/rcov rant rcov # use the specified rcov executable
+ RCOVOPTS="--no-callsites -x foo" rant rcov # pass those options to rcov
@@ -66,14 +66,14 @@ task :test => [:test_rcovrt, :test_pure_ruby]
desc "Generate rdoc documentation for the rcov library""rdoc") { |rdoc|
rdoc.rdoc_dir = 'doc'
- rdoc.title = "rcov task for rake"
+ rdoc.title = "rcov"
rdoc.options << "--line-numbers" << "--inline-source"
+ rdoc.rdoc_files.include('README.rant')
task :default => :test
# vim: set sw=2 ft=ruby:

0 comments on commit 1e2f13a

Please sign in to comment.