File: Rantfile

package info (click to toggle)
rcov 0.7.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 336 kB
  • ctags: 471
  • sloc: ruby: 4,780; ansic: 439; makefile: 13
file content (76 lines) | stat: -rw-r--r-- 2,294 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# 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: