relevance-rcov 0.8.3.1 → 0.8.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,127 +1,3 @@
1
- require "erb"
2
-
3
- class Document
4
-
5
- attr_accessor :local_variables
6
-
7
- def initialize(template_file, locals={})
8
- template_path = File.expand_path("#{File.dirname(__FILE__)}/../templates/#{template_file}")
9
- @template = ERB.new(File.read(template_path))
10
- @local_variables = locals
11
- @path_relativizer = Hash.new{|h,base|
12
- # TODO: Waaaahhhhh?
13
- h[base] = Pathname.new(base).cleanpath.to_s.gsub(%r{^\w:[/\\]}, "").gsub(/\./, "_").gsub(/[\\\/]/, "-") + ".html"
14
- }
15
- end
16
-
17
- def render
18
- @template.result(get_binding)
19
- end
20
-
21
- def relative_filename(path)
22
- @path_relativizer[path]
23
- end
24
-
25
- #def create_cross_refs(filename, lineno, linetext)
26
- #form = formatter
27
- #return linetext unless @callsite_analyzer && @do_callsites
28
-
29
- #ref_blocks = []
30
- #form.send(:_get_defsites, ref_blocks, filename, lineno, "Calls", linetext) do |ref|
31
- #if ref.file
32
- #where = "at #{formatter.normalize_filename(ref.file)}:#{ref.line}"
33
- #else
34
- #where = "(C extension/core)"
35
- #end
36
- #CGI.escapeHTML("%7d %s" % [ref.count, "#{ref.klass}##{ref.mid} " + where])
37
- #end
38
-
39
- #form.send(:_get_callsites, ref_blocks, filename, lineno, "Called by", linetext) do |ref|
40
- #r = "%7d %s" % [ref.count, "#{formatter.normalize_filename(ref.file||'C code')}:#{ref.line} " + "in '#{ref.klass}##{ref.mid}'"]
41
- #CGI.escapeHTML(r)
42
- #end
43
-
44
- #create_cross_reference_block(linetext, ref_blocks)
45
- #end
46
-
47
- #def create_cross_reference_block(linetext, ref_blocks)
48
- #return linetext if ref_blocks.empty?
49
- #ret = ""
50
- #@cross_ref_idx ||= 0
51
- #@known_files ||= formatter.sorted_file_pairs.map{|fname, finfo| formatter.normalize_filename(fname)}
52
- #ret << %[<a class="crossref-toggle" href="#" onclick="toggleCode('XREF-#{@cross_ref_idx+=1}'); return false;">#{linetext}</a>]
53
- #ret << %[<span class="cross-ref" id="XREF-#{@cross_ref_idx}">]
54
- #ret << "\n"
55
- #ref_blocks.each do |refs, toplabel, label_proc|
56
- #unless !toplabel || toplabel.empty?
57
- #ret << %!<span class="cross-ref-title">#{toplabel}</span>\n!
58
- #end
59
- #refs.each do |dst|
60
- #dstfile = formatter.normalize_filename(dst.file) if dst.file
61
- #dstline = dst.line
62
- #label = label_proc.call(dst)
63
- #if dst.file && @known_files.include?(dstfile)
64
- #ret << %[<a href="#{formatter.mangle_filename(dstfile)}#line#{dstline}">#{label}</a>]
65
- #else
66
- #ret << label
67
- #end
68
- #ret << "\n"
69
- #end
70
- #end
71
- #ret << "</span>"
72
- #end
73
-
74
- def line_css(line_number)
75
- case file.coverage[line_number]
76
- when true
77
- "marked"
78
- when :inferred
79
- "inferred"
80
- else
81
- "uncovered"
82
- end
83
- end
84
-
85
-
86
- #def format_lines(file)
87
- #result = ""
88
- #last = nil
89
- #end_of_span = ""
90
- #format_line = "%#{file.num_lines.to_s.size}d"
91
- #file.num_lines.times do |i|
92
- #line = file.lines[i].chomp
93
- #marked = file.coverage[i]
94
- #count = file.counts[i]
95
- #spanclass = span_class(file, marked, count)
96
- #if spanclass != last
97
- #result += end_of_span
98
- #case spanclass
99
- #when nil
100
- #end_of_span = ""
101
- #else
102
- #result += %[<span class="#{spanclass}">]
103
- #end_of_span = "</span>"
104
- #end
105
- #end
106
- #result += %[<a name="line#{i+1}"></a>] + (format_line % (i+1)) +
107
- #" " + create_cross_refs(file.name, i+1, CGI.escapeHTML(line)) + "\n"
108
- #last = spanclass
109
- #end
110
- #result += end_of_span
111
- #"<pre>#{result}</pre>"
112
- #end
113
-
114
-
115
- def method_missing(key, *args)
116
- local_variables.has_key?(key) ? local_variables[key] : super
117
- end
118
-
119
- def get_binding
120
- binding
121
- end
122
-
123
- end
124
-
125
1
  module Rcov
126
2
 
127
3
  class BaseFormatter # :nodoc:
@@ -72,8 +72,7 @@ module Rcov
72
72
 
73
73
  def create_index(destname)
74
74
  files = [SummaryFileInfo.new(self)] + each_file_pair_sorted.map{|k,v| v}
75
-
76
- doc = Document.new('index.html.erb', :title => 'C0 Coverage Information - RCov',
75
+ doc = Rcov::Formatters::HtmlErbTemplate.new('index.html.erb', :title => 'C0 Coverage Information - RCov',
77
76
  :generated_on => Time.now,
78
77
  :rcov => Rcov,
79
78
  :formatter => self,
@@ -85,7 +84,7 @@ module Rcov
85
84
 
86
85
 
87
86
  def create_file(destfile, fileinfo)
88
- doc = Document.new('detail.html.erb', :title => fileinfo.name,
87
+ doc = Rcov::Formatters::HtmlErbTemplate.new('detail.html.erb', :title => fileinfo.name,
89
88
  :generated_on => Time.now,
90
89
  :rcov => Rcov,
91
90
  :formatter => self,
@@ -0,0 +1,128 @@
1
+ module Rcov
2
+ module Formatters
3
+
4
+ class HtmlErbTemplate
5
+ attr_accessor :local_variables
6
+
7
+ def initialize(template_file, locals={})
8
+ require "erb"
9
+
10
+ template_path = File.expand_path("#{File.dirname(__FILE__)}/../templates/#{template_file}")
11
+ @template = ERB.new(File.read(template_path))
12
+ @local_variables = locals
13
+ @path_relativizer = Hash.new{|h,base|
14
+ # TODO: Waaaahhhhh?
15
+ h[base] = Pathname.new(base).cleanpath.to_s.gsub(%r{^\w:[/\\]}, "").gsub(/\./, "_").gsub(/[\\\/]/, "-") + ".html"
16
+ }
17
+ end
18
+
19
+ def render
20
+ @template.result(get_binding)
21
+ end
22
+
23
+ def relative_filename(path)
24
+ @path_relativizer[path]
25
+ end
26
+
27
+ #def create_cross_refs(filename, lineno, linetext)
28
+ #form = formatter
29
+ #return linetext unless @callsite_analyzer && @do_callsites
30
+
31
+ #ref_blocks = []
32
+ #form.send(:_get_defsites, ref_blocks, filename, lineno, "Calls", linetext) do |ref|
33
+ #if ref.file
34
+ #where = "at #{formatter.normalize_filename(ref.file)}:#{ref.line}"
35
+ #else
36
+ #where = "(C extension/core)"
37
+ #end
38
+ #CGI.escapeHTML("%7d %s" % [ref.count, "#{ref.klass}##{ref.mid} " + where])
39
+ #end
40
+
41
+ #form.send(:_get_callsites, ref_blocks, filename, lineno, "Called by", linetext) do |ref|
42
+ #r = "%7d %s" % [ref.count, "#{formatter.normalize_filename(ref.file||'C code')}:#{ref.line} " + "in '#{ref.klass}##{ref.mid}'"]
43
+ #CGI.escapeHTML(r)
44
+ #end
45
+
46
+ #create_cross_reference_block(linetext, ref_blocks)
47
+ #end
48
+
49
+ #def create_cross_reference_block(linetext, ref_blocks)
50
+ #return linetext if ref_blocks.empty?
51
+ #ret = ""
52
+ #@cross_ref_idx ||= 0
53
+ #@known_files ||= formatter.sorted_file_pairs.map{|fname, finfo| formatter.normalize_filename(fname)}
54
+ #ret << %[<a class="crossref-toggle" href="#" onclick="toggleCode('XREF-#{@cross_ref_idx+=1}'); return false;">#{linetext}</a>]
55
+ #ret << %[<span class="cross-ref" id="XREF-#{@cross_ref_idx}">]
56
+ #ret << "\n"
57
+ #ref_blocks.each do |refs, toplabel, label_proc|
58
+ #unless !toplabel || toplabel.empty?
59
+ #ret << %!<span class="cross-ref-title">#{toplabel}</span>\n!
60
+ #end
61
+ #refs.each do |dst|
62
+ #dstfile = formatter.normalize_filename(dst.file) if dst.file
63
+ #dstline = dst.line
64
+ #label = label_proc.call(dst)
65
+ #if dst.file && @known_files.include?(dstfile)
66
+ #ret << %[<a href="#{formatter.mangle_filename(dstfile)}#line#{dstline}">#{label}</a>]
67
+ #else
68
+ #ret << label
69
+ #end
70
+ #ret << "\n"
71
+ #end
72
+ #end
73
+ #ret << "</span>"
74
+ #end
75
+
76
+ def line_css(line_number)
77
+ case file.coverage[line_number]
78
+ when true
79
+ "marked"
80
+ when :inferred
81
+ "inferred"
82
+ else
83
+ "uncovered"
84
+ end
85
+ end
86
+
87
+
88
+ #def format_lines(file)
89
+ #result = ""
90
+ #last = nil
91
+ #end_of_span = ""
92
+ #format_line = "%#{file.num_lines.to_s.size}d"
93
+ #file.num_lines.times do |i|
94
+ #line = file.lines[i].chomp
95
+ #marked = file.coverage[i]
96
+ #count = file.counts[i]
97
+ #spanclass = span_class(file, marked, count)
98
+ #if spanclass != last
99
+ #result += end_of_span
100
+ #case spanclass
101
+ #when nil
102
+ #end_of_span = ""
103
+ #else
104
+ #result += %[<span class="#{spanclass}">]
105
+ #end_of_span = "</span>"
106
+ #end
107
+ #end
108
+ #result += %[<a name="line#{i+1}"></a>] + (format_line % (i+1)) +
109
+ #" " + create_cross_refs(file.name, i+1, CGI.escapeHTML(line)) + "\n"
110
+ #last = spanclass
111
+ #end
112
+ #result += end_of_span
113
+ #"<pre>#{result}</pre>"
114
+ #end
115
+
116
+
117
+ def method_missing(key, *args)
118
+ local_variables.has_key?(key) ? local_variables[key] : super
119
+ end
120
+
121
+ def get_binding
122
+ binding
123
+ end
124
+
125
+ end
126
+
127
+ end
128
+ end
@@ -1,3 +1,4 @@
1
+ require 'rcov/formatters/html_erb_template'
1
2
  require 'rcov/formatters/base_formatter'
2
3
  require 'rcov/formatters/text_summary'
3
4
  require 'rcov/formatters/text_report'
@@ -3,31 +3,7 @@
3
3
  <head>
4
4
  <title><%= title %></title>
5
5
  <link href="screen.css" media="screen" rel="stylesheet" type="text/css" />
6
- <script type='text/javascript'>
7
- // <![CDATA[
8
- function toggleCode( id ) {
9
- if ( document.getElementById )
10
- elem = document.getElementById( id );
11
- else if ( document.all )
12
- elem = eval( "document.all." + id );
13
- else
14
- return false;
15
-
16
- elemStyle = elem.style;
17
-
18
- if ( elemStyle.display != "block" ) {
19
- elemStyle.display = "block"
20
- } else {
21
- elemStyle.display = "none"
22
- }
23
-
24
- return true;
25
- }
26
-
27
- // Make cross-references hidden by default
28
- document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" )
29
- // ]]>
30
- </script>
6
+ <script type="text/javascript" src="rcov.js"></script>
31
7
  </head>
32
8
  <body>
33
9
  <h3><%= title %></h3>
@@ -3,31 +3,7 @@
3
3
  <head>
4
4
  <title><%= title %></title>
5
5
  <link href="screen.css" media="screen" rel="stylesheet" type="text/css" />
6
- <script type='text/javascript'>
7
- // <![CDATA[
8
- function toggleCode( id ) {
9
- if ( document.getElementById )
10
- elem = document.getElementById( id );
11
- else if ( document.all )
12
- elem = eval( "document.all." + id );
13
- else
14
- return false;
15
-
16
- elemStyle = elem.style;
17
-
18
- if ( elemStyle.display != "block" ) {
19
- elemStyle.display = "block"
20
- } else {
21
- elemStyle.display = "none"
22
- }
23
-
24
- return true;
25
- }
26
-
27
- // Make cross-references hidden by default
28
- document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" )
29
- // ]]>
30
- </script>
6
+ <script type="text/javascript" src="rcov.js"></script>
31
7
  </head>
32
8
  <body>
33
9
  <h3><%= title %></h3>
data/lib/rcov/version.rb CHANGED
@@ -3,10 +3,9 @@
3
3
  # See LEGAL and LICENSE for licensing information.
4
4
 
5
5
  module Rcov
6
- VERSION = "0.8.3.1"
7
- RELEASE_DATE = "2009-05-08"
6
+ VERSION = "0.8.3.2"
7
+ RELEASE_DATE = "2009-05-12"
8
8
  RCOVRT_ABI = [2,0,0]
9
9
  UPSTREAM_URL = "http://github.com/relevance/rcov"
10
- ROOF_POSITION = 'raised'
11
10
 
12
11
  end
data/lib/rcov.rb CHANGED
@@ -1006,6 +1006,4 @@ class CallSiteAnalyzer < DifferentialAnalyzer
1006
1006
 
1007
1007
  end
1008
1008
 
1009
- end # Rcov
1010
-
1011
- # vi: set sw=2:
1009
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relevance-rcov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3.1
4
+ version: 0.8.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Relevance
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain:
13
- date: 2009-05-08 00:00:00 -07:00
13
+ date: 2009-05-12 00:00:00 -07:00
14
14
  default_executable: rcov
15
15
  dependencies: []
16
16
 
@@ -29,11 +29,11 @@ files:
29
29
  - lib/rcov.rb
30
30
  - lib/rcov/lowlevel.rb
31
31
  - lib/rcov/version.rb
32
- - lib/rcov/report.rb
33
32
  - lib/rcov/rcovtask.rb
34
33
  - lib/rcov/formatters.rb
35
34
  - lib/rcov/formatters/base_formatter.rb
36
35
  - lib/rcov/formatters/full_text_report.rb
36
+ - lib/rcov/formatters/html_erb_template.rb
37
37
  - lib/rcov/formatters/html_coverage.rb
38
38
  - lib/rcov/formatters/text_coverage_diff.rb
39
39
  - lib/rcov/formatters/text_report.rb
@@ -70,7 +70,6 @@ files:
70
70
  - editor-extensions/rcov.el
71
71
  - setup.rb
72
72
  - BLURB
73
- - CHANGES
74
73
  has_rdoc: true
75
74
  homepage: http://github.com/relevance/rcov
76
75
  post_install_message:
data/CHANGES DELETED
@@ -1,177 +0,0 @@
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/lib/rcov/report.rb DELETED
@@ -1,8 +0,0 @@
1
- # rcov Copyright (c) 2004-2006 Mauricio Fernandez <mfp@acm.org>
2
- # See LEGAL and LICENSE for additional licensing information.
3
-
4
- require 'pathname'
5
-
6
- module Rcov
7
-
8
- end