# This Rantfile serves as an example of how to use the Rcov generator. # Take a look at the RDoc documentation (or README.rant) for further # information. $:.unshift "lib" if File.directory? "lib" import %w(rubytest rubydoc autoclean) require 'rcov/rant' task :default => :test # Use the specified rcov executable instead of the one in $PATH # (this way we get a sort of informal functional test). # This could also be specified from the command like, e.g. # rake rcov RCOVPATH=/path/to/myrcov ENV["RCOVPATH"] = "bin/rcov" desc "Create a cross-referenced code coverage report." gen Rcov do |g| g.libs << "ext/rcovrt" g.test_files = sys['test/test*.rb'] g.rcov_opts << "--callsites" # comment to disable cross-references end 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 desc "Run the unit tests, both rcovrt and pure-Ruby modes" task :test => [:test_rcovrt, :test_pure_ruby] desc "Run the unit tests with rcovrt." gen RubyTest, :test_rcovrt => %w[ext/rcovrt/rcovrt.so] do |g| g.libs << "ext/rcovrt" g.test_files = sys['test/test*.rb'] g.verbose = true end file "ext/rcovrt/rcovrt.so" => "ext/rcovrt/rcov.c" do sys "ruby setup.rb config" sys "ruby setup.rb setup" end desc "Run the unit tests in pure-Ruby mode." gen RubyTest, :test_pure_ruby do |g| g.libs << "ext/rcovrt" g.test_files = sys['test/turn_off_rcovrt.rb', 'test/test*.rb'] g.verbose = true end desc "Generate documentation." gen RubyDoc, :rdoc do |g| g.verbose = true g.dir = "doc" g.files = sys["README.API", "README.rake", "README.rant", "README.vim", "lib/**/*.rb"] g.opts = %w(--line-numbers --inline-source --title rcov --main README.API) end desc "Remove autogenerated files." gen AutoClean, :clean var[:clean].include %w(InstalledFiles .config coverage coverage.* ) # vim: set sw=2 ft=ruby: