spicycode-rcov 0.8.1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/BLURB ADDED
@@ -0,0 +1,149 @@
1
+
2
+ Source code, additional information, screenshots... available at
3
+ http://eigenclass.org/hiki/rcov
4
+
5
+ If you're on win32, you can also find a pre-built rcovrt.so (which makes
6
+ code coverage analysis >100 times faster) in the above-mentioned pages.
7
+
8
+ Overview
9
+ ========
10
+ rcov is a code coverage tool for Ruby. It is commonly used for viewing overall
11
+ test coverage of target code. It features:
12
+ * fast execution: 20-300 times faster than previous tools
13
+ * multiple analysis modes: standard, bogo-profile, "intentional testing",
14
+ dependency analysis...
15
+ * detection of uncovered code introduced since the last run ("differential
16
+ code coverage")
17
+ * fairly accurate coverage information through code linkage inference using
18
+ simple heuristics
19
+ * cross-referenced XHTML and several kinds of text reports
20
+ * support for easy automation with Rake and Rant
21
+ * colorblind-friendliness
22
+
23
+ How do I use it?
24
+ ================
25
+
26
+ In the common scenario, your tests are under test/ and the target code
27
+ (whose coverage you want) is in lib/. In that case, all you have to do is
28
+ use rcov to run the tests (instead of testrb), and a number of XHTML files
29
+ with the code coverage information will be generated, e.g.
30
+
31
+ rcov -Ilib test/*.rb
32
+
33
+ will execute all the .rb files under test/ and generate the code coverage
34
+ report for the target code (i.e. for the files in lib/) under coverage/. The
35
+ target code needs not be under lib/; rcov will detect is as long as it is
36
+ require()d by the tests. rcov is smart enough to ignore "uninteresting"
37
+ files: the tests themselves, files installed in Ruby's standard locations,
38
+ etc. See rcov --help for the list of regexps rcov matches filenames
39
+ against.
40
+
41
+ rcov can also be used from Rake; see readme_for_rake or the RDoc documentation
42
+ for more information.
43
+
44
+ rcov can output information in several formats, and perform different kinds
45
+ of analyses in addition to plain code coverage. See rcov --help for a
46
+ description of the available options.
47
+
48
+ Sample output
49
+ =============
50
+
51
+ See http://eigenclass.org/hiki.rb?rcov (once again) for screenshots.
52
+
53
+ The text report (also used by default in RcovTasks) resembles
54
+
55
+
56
+ +-----------------------------------------------------+-------+-------+--------+
57
+ | File | Lines | LOC | COV |
58
+ +-----------------------------------------------------+-------+-------+--------+
59
+ |lib/rcov.rb | 572 | 358 | 91.3% |
60
+ +-----------------------------------------------------+-------+-------+--------+
61
+ |Total | 572 | 358 | 91.3% |
62
+ +-----------------------------------------------------+-------+-------+--------+
63
+ 91.3% 1 file(s) 572 Lines 358 LOC
64
+
65
+
66
+
67
+ The (undecorated) textual output with execution count information looks like this:
68
+
69
+ $ rcov --no-html --text-counts b.rb
70
+ ================================================================================
71
+ ./b.rb
72
+ ================================================================================
73
+ | 2
74
+ a, b, c = (1..3).to_a | 2
75
+ 10.times do | 1
76
+ a += 1 | 10
77
+ 20.times do |i| | 10
78
+ b += i | 200
79
+ b.times do | 200
80
+ c += (j = (b-a).abs) > 0 ? j : 0 | 738800
81
+ end | 0
82
+ end | 0
83
+ end | 0
84
+
85
+
86
+ rcov can detect when you've added code that was not covered by your unit
87
+ tests:
88
+
89
+ $ rcov --text-coverage-diff --no-color test/*.rb
90
+ Started
91
+ .......................................
92
+ Finished in 1.163085 seconds.
93
+
94
+ 39 tests, 415 assertions, 0 failures, 0 errors
95
+
96
+ ================================================================================
97
+ !!!!! Uncovered code introduced in lib/rcov.rb
98
+
99
+ ### lib/rcov.rb:207
100
+
101
+ def precompute_coverage(comments_run_by_default = true)
102
+ changed = false
103
+ lastidx = lines.size - 1
104
+ if (!is_code?(lastidx) || /^__END__$/ =~ @lines[-1]) && !@coverage[lastidx]
105
+ !! # mark the last block of comments
106
+ !! @coverage[lastidx] ||= :inferred
107
+ !! (lastidx-1).downto(0) do |i|
108
+ !! break if is_code?(i)
109
+ !! @coverage[i] ||= :inferred
110
+ !! end
111
+ !! end
112
+ (0...lines.size).each do |i|
113
+ next if @coverage[i]
114
+ line = @lines[i]
115
+
116
+
117
+
118
+ License
119
+ -------
120
+ rcov is released under the terms of Ruby's license.
121
+ rcov includes xx 0.1.0, which is subject to the following conditions:
122
+
123
+ ePark Labs Public License version 1
124
+ Copyright (c) 2005, ePark Labs, Inc. and contributors
125
+ All rights reserved.
126
+
127
+ Redistribution and use in source and binary forms, with or without modification,
128
+ are permitted provided that the following conditions are met:
129
+
130
+ 1. Redistributions of source code must retain the above copyright notice, this
131
+ list of conditions and the following disclaimer.
132
+ 2. Redistributions in binary form must reproduce the above copyright notice,
133
+ this list of conditions and the following disclaimer in the documentation
134
+ and/or other materials provided with the distribution.
135
+ 3. Neither the name of ePark Labs nor the names of its contributors may be
136
+ used to endorse or promote products derived from this software without
137
+ specific prior written permission.
138
+
139
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
140
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
141
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
142
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
143
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
144
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
145
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
146
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
147
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
148
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
149
+
data/CHANGES ADDED
@@ -0,0 +1,177 @@
1
+
2
+ User-visible changes.
3
+
4
+ Since 0.8.1.1 (2007-11-20)
5
+ ==========================
6
+ Bugfixes
7
+ --------
8
+ * REXML from 1.8.6-p11[01] is more broken than anticipated; more invasive
9
+ workarounds. Tested on 1.8.6-p110 and 1.8.5. Note that code using REXML to
10
+ generate XML will behave differently under rcov in 1.8.6-p11[01] (to begin
11
+ with, it won't crash in REXML::Document#write).
12
+
13
+ Since 0.8.1 (2007-11-19)
14
+ ========================
15
+ Bugfixes
16
+ --------
17
+ * REXML workaround incorrectly applied to 1.8.6 < p110
18
+ * --spec-only should work with RSpec trunk and detect when it cannot work
19
+
20
+ Since 0.8.0 (2007-02-28)
21
+ ========================
22
+ Features
23
+ --------
24
+ * you can use an existent data file to generate coverage reports without
25
+ having to execute your code again
26
+ * --spec-only: only consider cover code executed inside a spec
27
+ (tested with RSpec 1.0.5, 1.0.8)
28
+ * --charset can be used to specify the charset in the Content-Type declaration
29
+
30
+ Bugfixes
31
+ --------
32
+ * workaround for bugs in Safari, IE (self-closing anchors break colorization)
33
+ * workaround for bugs in REXML shipped with 1.8.6-p110
34
+ * rethrow exceptions generated by traced scripts
35
+ * compatibility with Ruby < 1.8.5
36
+
37
+ Since 0.7.0 (2006-08-04)
38
+ ========================
39
+ Features
40
+ --------
41
+ * --annotate mode, which dumps annotated source code which can be used to
42
+ follow the control flow (very useful when reading third-party code)
43
+ * --gcc option to display uncovered lines in GCC error format
44
+ * superior Emacs support: running rcov, jumping to uncovered code, navigate
45
+ through cross-referenced annotated code
46
+ * --[no-]validator-links
47
+
48
+ Bugfixes
49
+ --------
50
+ * differential code coverage reports work with filenames containing special
51
+ characters
52
+ * fixed recent segfaults happening with rspec
53
+ * more care name mangling
54
+
55
+ Minor enhancements
56
+ ------------------
57
+ * relevant summary values are identified using separate CSS classes
58
+ (microformat-style)
59
+
60
+ Since 0.6.0 (2006-06-12)
61
+ ========================
62
+ Features
63
+ --------
64
+ * coverage/callsite data from multiple runs can be aggregated (--aggregate)
65
+
66
+ Bugfixes
67
+ --------
68
+ * the SCRIPT_LINES__ workaround works better
69
+ * fixed silly bug in coverage data acquisition (line after the correct one
70
+ marked in some situations)
71
+ * avoid problems with repeated path separators in default ignore list, based
72
+ on rbconfig's data
73
+
74
+
75
+ Minor enhancements
76
+ ------------------
77
+
78
+ Since 0.5.0 (2006-05-30)
79
+ ========================
80
+ Features
81
+ --------
82
+ * differential coverage report: --text-coverage-diff (-D) and --save
83
+ Tells you when you've added new code that was not covered by the tests and
84
+ when code that used to be covered isn't anymore. Integration with vim
85
+ (contributions for other editors/IDEs welcome).
86
+ * fully cross-referenced reports, indicating where methods are called from
87
+ and which methods were called for each line (--xrefs)
88
+ * cross-referenced report generation is now over 4 times faster for
89
+ applications with deep call stacks (such as Rails apps)
90
+
91
+ Bugfixes
92
+ --------
93
+ * comments at EOF are marked now
94
+ * better handling of multiline hashes/arrays
95
+ * better handling of end/}: support chained method calls and more expressions
96
+ on the same line
97
+ * better handling of heredocs with interpolation
98
+
99
+ Minor enhancements
100
+ ------------------
101
+ * more readable --text-coverage
102
+ * set whether comments are "run" by default instead of attaching them to
103
+ the following block of code (--[no-]comments)
104
+ * --report-cov-bug can be used to report bugs in the coverage analysis
105
+
106
+ Since 0.4.0 (2006-05-22)
107
+ ========================
108
+ Features
109
+ --------
110
+ * ability to create cross-referenced reports, indicating where methods are
111
+ called from (--callsites)
112
+ * more refinements in the heuristics: now several kinds of multi-line quoted
113
+ strings are handled properly
114
+ * --include-file to specify files not to be ignored in the report(s)
115
+ * implemented a task generator for Rant
116
+
117
+ Bugfixes
118
+ --------
119
+ * corrected the LOC counts in the XHTML summaries
120
+ * pure-Ruby tracing module works again; was broken in 0.4.0
121
+ * RcovTask#ruby_opts fixed; they were being passed to rcov instead of ruby
122
+ * solved the DOCTYPE issue (it'd get put at the end of the file under some
123
+ Ruby versions)
124
+
125
+ Minor enhancements
126
+ ------------------
127
+ * slightly more readable XHTML reports, esp. for IE
128
+ * text reports fit in 79 columns so they look OK with cmd.exe
129
+ * try to guide the user when all files were considered "uninteresting" by rcov
130
+ * the output_dir is preserved in RcovTasks when the user specifies --profile
131
+ via the RCOVOPTS env. var.
132
+
133
+ Since 0.3.0 (2006-05-05)
134
+ ========================
135
+
136
+ Features
137
+ --------
138
+ * easy automation via Rake using the bundled Rcov::RcovTask
139
+ * better heuristics: supports heredocs at last, including variants your editor
140
+ is probably unable to handle, and =begin/=end comments
141
+ * --rails option to ignore files under vendor/, enviroment/ and config/
142
+ * parts of the runtime exposed and documented for external use
143
+ * new color scheme, with alternating shades of the base colors
144
+ * -w to set $VERBOSE=true (turns on warnings)
145
+ * --text-report and --text-summary
146
+ * --sort and --sort-reverse for the summaries and reports
147
+ * --threshold and --only-uncovered
148
+ * --replace-progname
149
+
150
+ Backwards incompatible changes
151
+ ------------------------------
152
+ * renamed --text to --text-counts and --rich-text to --text-coverage: they
153
+ were misnamed to begin with
154
+ * changed the meaning of -t and -T (--text-summary and --text-report)
155
+ * $0 is not changed by default for each loaded file anymore; the old
156
+ behavior (modulo a small bugfix) can be reproduced with --replace-progname
157
+
158
+ Since 0.2.0 (2006-02-25)
159
+ ========================
160
+
161
+ Features
162
+ --------
163
+ * --exclude-only
164
+ * consolidate multiple references to the same underlying .rb file
165
+ (much needed for Rails)
166
+ * --test-unit-only
167
+
168
+ Fixes
169
+ -----
170
+ * consider and/op operators
171
+ * honor --no-color in (rich) text mode
172
+ * output valid XHTML indices
173
+
174
+ Since 0.1.0
175
+ ===========
176
+ Tons. Better output, MUCH faster (two orders of magnitude), better command
177
+ line...
data/LEGAL ADDED
@@ -0,0 +1,36 @@
1
+
2
+ LEGAL NOTICE
3
+ ------------
4
+
5
+ rcov itself is subject to the terms specified in LICENSE.
6
+
7
+ rcov includes xx-0.1.0, which can be redistributed and used under the
8
+ following conditions:
9
+
10
+
11
+ ePark Labs Public License version 1
12
+ Copyright (c) 2005, ePark Labs, Inc. and contributors
13
+ All rights reserved.
14
+
15
+ Redistribution and use in source and binary forms, with or without modification,
16
+ are permitted provided that the following conditions are met:
17
+
18
+ 1. Redistributions of source code must retain the above copyright notice, this
19
+ list of conditions and the following disclaimer.
20
+ 2. Redistributions in binary form must reproduce the above copyright notice,
21
+ this list of conditions and the following disclaimer in the documentation
22
+ and/or other materials provided with the distribution.
23
+ 3. Neither the name of ePark Labs nor the names of its contributors may be
24
+ used to endorse or promote products derived from this software without
25
+ specific prior written permission.
26
+
27
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
28
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
31
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
34
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/LICENSE ADDED
@@ -0,0 +1,56 @@
1
+ rcov is copyrighted free software by Mauricio Fernandez <mfp@acm.org>.
2
+ You can redistribute it and/or modify it under either the terms of the GPL
3
+ (see the file GPL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a) distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b) accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c) give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d) make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
data/Rakefile ADDED
@@ -0,0 +1,193 @@
1
+ # This Rakefile serves as an example of how to use Rcov::RcovTask.
2
+ # Take a look at the RDoc documentation (or readme_for_rake) for further
3
+ # information.
4
+
5
+ $:.unshift "lib" if File.directory? "lib"
6
+ require 'rcov/rcovtask'
7
+ require 'rake/testtask'
8
+ require 'rake/rdoctask'
9
+ require 'rake/gempackagetask'
10
+ require 'rake/clean'
11
+
12
+ # Use the specified rcov executable instead of the one in $PATH
13
+ # (this way we get a sort of informal functional test).
14
+ # This could also be specified from the command like, e.g.
15
+ # rake rcov RCOVPATH=/path/to/myrcov
16
+ ENV["RCOVPATH"] = "bin/rcov"
17
+
18
+ # The following task is largely equivalent to:
19
+ # Rcov::RcovTask.new
20
+ # (really!)
21
+ desc "Create a cross-referenced code coverage report."
22
+ Rcov::RcovTask.new do |t|
23
+ t.test_files = FileList['test/*_test.rb']
24
+ t.ruby_opts << "-Ilib:ext/rcovrt" # in order to use this rcov
25
+ t.rcov_opts << "--xrefs" # comment to disable cross-references
26
+ t.verbose = true
27
+ end
28
+
29
+ desc "Analyze code coverage for the FileStatistics class."
30
+ Rcov::RcovTask.new(:rcov_sourcefile) do |t|
31
+ t.test_files = FileList['test/file_statistics_test.rb']
32
+ t.verbose = true
33
+ t.rcov_opts << "--test-unit-only"
34
+ t.ruby_opts << "-Ilib:ext/rcovrt" # in order to use this rcov
35
+ t.output_dir = "coverage.sourcefile"
36
+ end
37
+
38
+ Rcov::RcovTask.new(:rcov_ccanalyzer) do |t|
39
+ t.test_files = FileList['test/code_coverage_analyzer_test.rb']
40
+ t.verbose = true
41
+ t.rcov_opts << "--test-unit-only"
42
+ t.ruby_opts << "-Ilib:ext/rcovrt" # in order to use this rcov
43
+ t.output_dir = "coverage.ccanalyzer"
44
+ end
45
+
46
+ desc "Run the unit tests with rcovrt."
47
+ if RUBY_PLATFORM == 'java'
48
+ Rake::TestTask.new(:test_rcovrt => ["lib/rcovrt.jar"]) do |t|
49
+ t.libs << "lib"
50
+ t.test_files = FileList['test/*_test.rb']
51
+ t.verbose = true
52
+ end
53
+ else
54
+ Rake::TestTask.new(:test_rcovrt => ["ext/rcovrt/rcovrt.so"]) do |t|
55
+ t.libs << "ext/rcovrt"
56
+ t.test_files = FileList['test/*_test.rb']
57
+ t.verbose = true
58
+ end
59
+ end
60
+
61
+ file "ext/rcovrt/rcovrt.so" => FileList["ext/rcovrt/*.c"] do
62
+ ruby "setup.rb config"
63
+ ruby "setup.rb setup"
64
+ end
65
+
66
+ desc "Run the unit tests in pure-Ruby mode ."
67
+ Rake::TestTask.new(:test_pure_ruby) do |t|
68
+ t.libs << "ext/rcovrt"
69
+ t.test_files = FileList['test/turn_off_rcovrt.rb', 'test/*_test.rb']
70
+ t.verbose = true
71
+ end
72
+
73
+ desc "Run the unit tests"
74
+ task :test => [:test_rcovrt]
75
+ #, :test_pure_ruby] disabled since 1.8.5 broke them
76
+
77
+ desc "Generate rdoc documentation for the rcov library"
78
+ Rake::RDocTask.new("rdoc") { |rdoc|
79
+ rdoc.rdoc_dir = 'doc'
80
+ rdoc.title = "rcov"
81
+ rdoc.options << "--line-numbers" << "--inline-source"
82
+ rdoc.rdoc_files.include('readme_for_api')
83
+ rdoc.rdoc_files.include('readme_for_rake')
84
+ rdoc.rdoc_files.include('readme_for_rant')
85
+ rdoc.rdoc_files.include('readme_for_vim')
86
+ rdoc.rdoc_files.include('lib/**/*.rb')
87
+ }
88
+
89
+ task :default => :test
90
+
91
+ desc "install by setup.rb"
92
+ task :install do
93
+ sh "sudo ruby setup.rb install"
94
+ end
95
+
96
+
97
+ PKG_FILES = ["bin/rcov", "lib/rcov.rb", "lib/rcov/lowlevel.rb", "lib/rcov/xx.rb", "lib/rcov/version.rb", "lib/rcov/rant.rb", "lib/rcov/report.rb", "lib/rcov/rcovtask.rb", "ext/rcovrt/extconf.rb", "ext/rcovrt/rcovrt.c", "ext/rcovrt/callsite.c", "LEGAL", "LICENSE", "Rakefile", "Rantfile", "readme_for_rake", "readme_for_rant", "readme_for_vim", "readme_for_emacs", "readme_for_vim", "readme_for_api", "THANKS", "test/functional_test.rb", "test/file_statistics_test.rb", "test/assets/sample_03.rb", "test/assets/sample_05-new.rb", "test/code_coverage_analyzer_test.rb", "test/assets/sample_04.rb", "test/assets/sample_02.rb", "test/assets/sample_05-old.rb", "test/assets/sample_01.rb", "test/turn_off_rcovrt.rb", "test/call_site_analyzer_test.rb", "test/assets/sample_05.rb", "rcov.vim", "rcov.el", "setup.rb", "BLURB", "CHANGES"]
98
+
99
+ # gem management tasks Use these to build the java code before creating the gem package
100
+ # this code can also be used to generate the MRI gem. But I left the gemspec file in too.
101
+ spec = Gem::Specification.new do |s|
102
+ s.name = %q{rcov}
103
+ s.version = "0.8.1.3.0"
104
+
105
+ s.required_rubygems_version = nil if s.respond_to? :required_rubygems_version=
106
+ s.authors = ["Mauricio Fernandez"]
107
+ s.cert_chain = nil
108
+ s.date = %q{2007-11-21}
109
+ s.default_executable = %q{rcov}
110
+ s.description = %q{rcov is a code coverage tool for Ruby. It is commonly used for viewing overall test unit coverage of target code. It features fast execution (20-300 times faster than previous tools), multiple analysis modes, XHTML and several kinds of text reports, easy automation with Rake via a RcovTask, fairly accurate coverage information through code linkage inference using simple heuristics, colorblind-friendliness...}
111
+ s.email = %q{mfp@acm.org}
112
+ s.executables = ["rcov"]
113
+ s.extensions = ["ext/rcovrt/extconf.rb"]
114
+ s.platform = Gem::Platform::RUBY
115
+ s.extra_rdoc_files = ["readme_for_api", "readme_for_rake", "readme_for_rant", "readme_for_vim"]
116
+ s.files = PKG_FILES
117
+ s.has_rdoc = true
118
+ s.homepage = %q{http://eigenclass.org/hiki.rb?rcov}
119
+ s.rdoc_options = ["--main", "readme_for_api", "--title", "rcov code coverage tool"]
120
+ s.require_paths = ["lib"]
121
+ s.required_ruby_version = Gem::Requirement.new("> 0.0.0")
122
+ s.rubygems_version = %q{1.2.0}
123
+ s.summary = %q{Code coverage analysis tool for Ruby}
124
+ s.test_files = ["test/functional_test.rb", "test/file_statistics_test.rb", "test/code_coverage_analyzer_test.rb", "test/call_site_analyzer_test.rb"]
125
+
126
+ if s.respond_to? :specification_version then
127
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
128
+ s.specification_version = 1
129
+
130
+ if current_version >= 3 then
131
+ else
132
+ end
133
+ else
134
+ end
135
+ end
136
+
137
+ #tasks added in to support generating the JRuby gem.
138
+ if RUBY_PLATFORM == 'java'
139
+ spec.platform = "jruby"
140
+ spec.extensions = []
141
+ #add the jruby extension to the file list
142
+ PKG_FILES << "lib/rcovrt.jar"
143
+
144
+ def java_classpath_arg
145
+ begin
146
+ require 'java'
147
+ classpath = java.lang.System.getProperty('java.class.path')
148
+ rescue LoadError
149
+ end
150
+
151
+ if classpath.empty?
152
+ classpath = FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
153
+ end
154
+
155
+ classpath ? "-cp #{classpath}" : ""
156
+ end
157
+
158
+
159
+ CLEAN.include ["ext/java/classes", "lib/rcovrt.jar", "pkg"]
160
+
161
+ def compile_java
162
+ mkdir_p "ext/java/classes"
163
+ sh "javac -g -target 1.5 -source 1.5 -d ext/java/classes #{java_classpath_arg} #{FileList['ext/java/src/**/*.java'].join(' ')}"
164
+ end
165
+
166
+ def make_jar
167
+ require 'fileutils'
168
+ lib = File.join(File.dirname(__FILE__), 'lib')
169
+ FileUtils.mkdir(lib) unless File.exists? lib
170
+ sh "jar cf lib/rcovrt.jar -C ext/java/classes/ ."
171
+ end
172
+
173
+ file 'lib/rcovrt.jar' => FileList["ext/java/src/*.java"] do
174
+ compile_java
175
+ make_jar
176
+ end
177
+
178
+ desc "compile the java extension and put it into the lib directory"
179
+ task :java_compile => ["lib/rcovrt.jar"]
180
+
181
+ end
182
+
183
+ Rake::GemPackageTask.new(spec) do |p|
184
+ p.need_tar = true
185
+ p.gem_spec = spec
186
+ end
187
+
188
+ #extend the gem task to include the java_compile
189
+ if RUBY_PLATFORM == 'java'
190
+ Rake::Task["pkg"].enhance(["java_compile"])
191
+ end
192
+
193
+ # vim: set sw=2 ft=ruby:
data/Rantfile ADDED
@@ -0,0 +1,76 @@
1
+ # This Rantfile serves as an example of how to use the Rcov generator.
2
+ # Take a look at the RDoc documentation (or readme_for_rant) for further
3
+ # information.
4
+
5
+ $:.unshift "lib" if File.directory? "lib"
6
+
7
+ import %w(rubytest rubydoc autoclean)
8
+ require 'rcov/rant'
9
+
10
+ task :default => :test
11
+
12
+ # Use the specified rcov executable instead of the one in $PATH
13
+ # (this way we get a sort of informal functional test).
14
+ # This could also be specified from the command like, e.g.
15
+ # rake rcov RCOVPATH=/path/to/myrcov
16
+ ENV["RCOVPATH"] = "bin/rcov"
17
+
18
+ desc "Create a cross-referenced code coverage report."
19
+ gen Rcov do |g|
20
+ g.libs << "ext/rcovrt"
21
+ g.test_files = sys['test/test*.rb']
22
+ g.rcov_opts << "--callsites" # comment to disable cross-references
23
+ end
24
+
25
+ desc "Analyze code coverage for the FileStatistics class."
26
+ gen Rcov, :rcov_sourcefile do |g|
27
+ g.libs << "ext/rcovrt"
28
+ g.test_files = sys['test/test_FileStatistics.rb']
29
+ g.rcov_opts << "--test-unit-only"
30
+ g.output_dir = "coverage.sourcefile"
31
+ end
32
+
33
+ desc "Analyze code coverage for CodeCoverageAnalyzer."
34
+ gen Rcov, :rcov_ccanalyzer do |g|
35
+ g.libs << "ext/rcovrt"
36
+ g.test_files = sys['test/test_CodeCoverageAnalyzer.rb']
37
+ g.rcov_opts << "--test-unit-only"
38
+ g.output_dir = "coverage.ccanalyzer"
39
+ end
40
+
41
+ desc "Run the unit tests, both rcovrt and pure-Ruby modes"
42
+ task :test => [:test_rcovrt, :test_pure_ruby]
43
+
44
+ desc "Run the unit tests with rcovrt."
45
+ gen RubyTest, :test_rcovrt => %w[ext/rcovrt/rcovrt.so] do |g|
46
+ g.libs << "ext/rcovrt"
47
+ g.test_files = sys['test/test*.rb']
48
+ g.verbose = true
49
+ end
50
+
51
+ file "ext/rcovrt/rcovrt.so" => "ext/rcovrt/rcov.c" do
52
+ sys "ruby setup.rb config"
53
+ sys "ruby setup.rb setup"
54
+ end
55
+
56
+ desc "Run the unit tests in pure-Ruby mode."
57
+ gen RubyTest, :test_pure_ruby do |g|
58
+ g.libs << "ext/rcovrt"
59
+ g.test_files = sys['test/turn_off_rcovrt.rb', 'test/test*.rb']
60
+ g.verbose = true
61
+ end
62
+
63
+ desc "Generate documentation."
64
+ gen RubyDoc, :rdoc do |g|
65
+ g.verbose = true
66
+ g.dir = "doc"
67
+ g.files = sys["readme_for_api", "readme_for_rake", "readme_for_rant", "readme_for_vim",
68
+ "lib/**/*.rb"]
69
+ g.opts = %w(--line-numbers --inline-source --title rcov --main readme_for_api)
70
+ end
71
+
72
+ desc "Remove autogenerated files."
73
+ gen AutoClean, :clean
74
+ var[:clean].include %w(InstalledFiles .config coverage coverage.* )
75
+
76
+ # vim: set sw=2 ft=ruby: