Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…ant support.

darcs-hash:20060528190909-0786a-414d65765df39e40769d88a584ac04a88691811e.gz
  • Loading branch information...
commit 1e2f13a1f415126cb4dae6ef25e1af7cd22d200d 1 parent 3040994
@mfp mfp authored
Showing with 73 additions and 4 deletions.
  1. +3 −2 README.API
  2. +68 −0 README.rant
  3. +2 −2 Rakefile
View
5 README.API
@@ -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
-README.rake[link:files/README_rake.html].
+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.
View
68 README.rant
@@ -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
+follows:
+
+ 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
+<tt>rcov</tt>:
+
+ 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
View
4 Rakefile
@@ -66,14 +66,14 @@ task :test => [:test_rcovrt, :test_pure_ruby]
desc "Generate rdoc documentation for the rcov library"
Rake::RDocTask.new("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.API')
rdoc.rdoc_files.include('README.rake')
+ rdoc.rdoc_files.include('README.rant')
rdoc.rdoc_files.include('lib/**/*.rb')
}
-
task :default => :test
# vim: set sw=2 ft=ruby:
Please sign in to comment.
Something went wrong with that request. Please try again.