simplecov-rcov 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest ADDED
@@ -0,0 +1,14 @@
1
+ Manifest
2
+ README.rdoc
3
+ Rakefile
4
+ lib/simplecov-rcov.rb
5
+ test/fixtures/app/controllers/sample_controller.rb
6
+ test/fixtures/app/models/user.rb
7
+ test/fixtures/file_tr.html
8
+ test/fixtures/index_created.html
9
+ test/fixtures/index_rcov.html
10
+ test/fixtures/sample.rb
11
+ test/fixtures/totals_tr.html
12
+ test/helper.rb
13
+ test/simplecov-rcov_test.rb
14
+ views/index.erb.html
data/README.rdoc ADDED
@@ -0,0 +1,26 @@
1
+ = SimpleCov CSV Formatter gem
2
+
3
+ Is a Rcov style formatter for the ruby 1.9+ coverage gem: {SimpleCov}[http://github.com/colszowka/simplecov]
4
+
5
+ This formatter only generate one general index.html.
6
+
7
+ The target of this formatter is to cheat on Hudson so I can use the {Ruby metrics plugin}[http://github.com/hudson/rubymetrics-plugin]
8
+
9
+ == Install
10
+
11
+ $ [sudo] gem install simplecov_rcov
12
+
13
+ == Usage
14
+
15
+ require 'simplecov_csv'
16
+ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
17
+
18
+ == TODO
19
+
20
+ The actual version generates only one simple */rcov/index.html* file.
21
+
22
+ == Credits
23
+
24
+ Author:: Fernando Guillen: http://fernandoguillen.info
25
+ Copyright:: Copyright (c) 2010 Fernando Guillen
26
+ License:: Released under the MIT license.
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('simplecov-rcov', '0.1.0') do |p|
6
+ p.description = "Rcov style formatter for SimpleCov"
7
+ p.url = "http://github.com/fguillen/simplecov-rcov"
8
+ p.author = "Fernando Guillen http://fernandoguillen.info"
9
+ p.email = "fguillen.mail@gmail.com"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ p.runtime_dependencies = ['simplecov']
13
+ end
@@ -0,0 +1,30 @@
1
+ class SimpleCov::Formatter::RcovFormatter
2
+ PATH_RESULT = "/rcov/index.html"
3
+
4
+ def format( result )
5
+ @files = result.files
6
+
7
+ @total_lines = result.files.map { |e| e.lines.count }.inject(:+)
8
+ @total_lines_code = result.files.map { |e| e.covered_lines.count + e.missed_lines.count }.inject(:+)
9
+ @total_coverage = result.covered_percent
10
+
11
+ template = ERB.new( File.read( "#{File.dirname(__FILE__)}/../views/index.erb.html" ) )
12
+ rcov_result = template.result( binding )
13
+
14
+ FileUtils.mkdir_p( File.dirname( SimpleCov::Formatter::RcovFormatter.path_result ) )
15
+
16
+ File.open( SimpleCov::Formatter::RcovFormatter.path_result, "w" ) do |file_result|
17
+ file_result.write rcov_result
18
+ end
19
+
20
+ puts "Coverage report Rcov style generated for #{result.command_name} to #{SimpleCov::Formatter::RcovFormatter.path_result}"
21
+
22
+ return rcov_result
23
+ end
24
+
25
+ private
26
+
27
+ def self.path_result
28
+ File.join( SimpleCov.coverage_path, SimpleCov::Formatter::RcovFormatter::PATH_RESULT )
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{simplecov-rcov}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Fernando Guillen http://fernandoguillen.info"]
9
+ s.date = %q{2010-10-19}
10
+ s.description = %q{Rcov style formatter for SimpleCov}
11
+ s.email = %q{fguillen.mail@gmail.com}
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/simplecov-rcov.rb"]
13
+ s.files = ["Manifest", "README.rdoc", "Rakefile", "lib/simplecov-rcov.rb", "test/fixtures/app/controllers/sample_controller.rb", "test/fixtures/app/models/user.rb", "test/fixtures/file_tr.html", "test/fixtures/index_created.html", "test/fixtures/index_rcov.html", "test/fixtures/sample.rb", "test/fixtures/totals_tr.html", "test/helper.rb", "test/simplecov-rcov_test.rb", "views/index.erb.html", "simplecov-rcov.gemspec"]
14
+ s.homepage = %q{http://github.com/fguillen/simplecov-rcov}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Simplecov-rcov", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{simplecov-rcov}
18
+ s.rubygems_version = %q{1.3.7}
19
+ s.summary = %q{Rcov style formatter for SimpleCov}
20
+ s.test_files = ["test/simplecov-rcov_test.rb"]
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 3
25
+
26
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
+ s.add_runtime_dependency(%q<simplecov>, [">= 0"])
28
+ else
29
+ s.add_dependency(%q<simplecov>, [">= 0"])
30
+ end
31
+ else
32
+ s.add_dependency(%q<simplecov>, [">= 0"])
33
+ end
34
+ end
@@ -0,0 +1,10 @@
1
+ # Foo class
2
+ class Foo
3
+ def initialize
4
+ @foo = 'baz'
5
+ end
6
+
7
+ def bar
8
+ @foo
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # Foo class
2
+ class Foo
3
+ def initialize
4
+ @foo = 'baz'
5
+ end
6
+
7
+ def bar
8
+ @foo
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ fixtures/app/controllers/sample_controller.rb</td>
2
+ <td class='right_align'><tt>10</tt></td>
3
+ <td class='right_align'><tt>5</tt></td>
4
+ <td class="left_align"><tt class=''>60.00%</tt></td>
5
+ <td class="left_align"><tt class=''>60.00%</tt></td>
6
+ </tr>
@@ -0,0 +1,61 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
5
+ <title>SimpleCov - RCov style</title>
6
+ </head>
7
+ <body>
8
+ <h1>SimpleCov - RCov style</h1>
9
+
10
+ <div class="report_table_wrapper">
11
+ <table class='report' id='report_table'>
12
+ <thead>
13
+ <tr>
14
+ <th class="left_align">Name</th>
15
+ <th class="right_align">Total Lines</th>
16
+ <th class="right_align">Lines of Code</th>
17
+ <th class="left_align">Total Coverage</th>
18
+ <th class="left_align">Code Coverage</th>
19
+ </tr>
20
+ </thead>
21
+ <tfoot>
22
+ <tr>
23
+ <td class="left_align">TOTAL</td>
24
+ <td class='right_align'><tt>30</tt></td>
25
+ <td class='right_align'><tt>15</tt></td>
26
+ <td class="left_align"><tt class=''>80.00%</tt></td>
27
+ <td class="left_align"><tt class='coverage_total'>80.00%</tt></td>
28
+ </tr>
29
+ </tfoot>
30
+ <tbody>
31
+
32
+ <tr class="all_files all_coverage 70 80 90 100 app controllers even">
33
+ <td class="left_align">./fixtures/app/controllers/sample_controller.rb</td>
34
+ <td class='right_align'><tt>10</tt></td>
35
+ <td class='right_align'><tt>5</tt></td>
36
+ <td class="left_align"><tt class=''>60.00%</tt></td>
37
+ <td class="left_align"><tt class=''>60.00%</tt></td>
38
+ </tr>
39
+
40
+ <tr class="all_files all_coverage 70 80 90 100 app controllers even">
41
+ <td class="left_align">./fixtures/app/models/user.rb</td>
42
+ <td class='right_align'><tt>10</tt></td>
43
+ <td class='right_align'><tt>5</tt></td>
44
+ <td class="left_align"><tt class=''>80.00%</tt></td>
45
+ <td class="left_align"><tt class=''>80.00%</tt></td>
46
+ </tr>
47
+
48
+ <tr class="all_files all_coverage 70 80 90 100 app controllers even">
49
+ <td class="left_align">./fixtures/sample.rb</td>
50
+ <td class='right_align'><tt>10</tt></td>
51
+ <td class='right_align'><tt>5</tt></td>
52
+ <td class="left_align"><tt class=''>100.00%</tt></td>
53
+ <td class="left_align"><tt class=''>100.00%</tt></td>
54
+ </tr>
55
+
56
+ </tbody>
57
+ </table>
58
+ </div>
59
+
60
+ </body>
61
+ </html>
@@ -0,0 +1,509 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
5
+ <title>SimpleCov - RCov style</title>
6
+ </head>
7
+ <body>
8
+ <h1>SimpleCov - RCov style</h1>
9
+
10
+ <div class="report_table_wrapper">
11
+ <table class='report' id='report_table'>
12
+ <thead>
13
+ <tr>
14
+ <th class="left_align">Name</th>
15
+ <th class="right_align">Total Lines</th>
16
+ <th class="right_align">Lines of Code</th>
17
+ <th class="left_align">Total Coverage</th>
18
+ <th class="left_align">Code Coverage</th>
19
+ </tr>
20
+ </thead>
21
+ <tfoot>
22
+ <tr>
23
+ <td class="left_align">TOTAL</td>
24
+ <td class='right_align'><tt>1019</tt></td>
25
+ <td class='right_align'><tt>757</tt></td>
26
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>89.21%</tt></div>
27
+ <div class="percent_graph">
28
+ <div class="covered" style="width:89px"></div>
29
+ <div class="uncovered" style="width:11px"></div>
30
+ </div></td>
31
+ <td class="left_align"><div class="percent_graph_legend"><tt class='coverage_total'>86.13%</tt></div>
32
+ <div class="percent_graph">
33
+ <div class="covered" style="width:86px"></div>
34
+ <div class="uncovered" style="width:14px"></div>
35
+ </div></td>
36
+ </tr>
37
+ </tfoot>
38
+ <tbody>
39
+
40
+ <tr class="all_files all_coverage 70 80 90 100 app controllers even">
41
+ <td class="left_align"><a href="app-controllers-application_controller_rb.html">app/controllers/application_controller.rb</a></td>
42
+ <td class='right_align'><tt>115</tt></td>
43
+ <td class='right_align'><tt>82</tt></td>
44
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>71.30%</tt></div>
45
+ <div class="percent_graph">
46
+ <div class="covered" style="width:71px"></div>
47
+ <div class="uncovered" style="width:29px"></div>
48
+ </div></td>
49
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>63.41%</tt></div>
50
+ <div class="percent_graph">
51
+ <div class="covered" style="width:63px"></div>
52
+ <div class="uncovered" style="width:37px"></div>
53
+ </div></td>
54
+ </tr>
55
+
56
+ <tr class="all_files all_coverage 110 app controllers odd">
57
+ <td class="left_align"><a href="app-controllers-authors_controller_rb.html">app/controllers/authors_controller.rb</a></td>
58
+ <td class='right_align'><tt>62</tt></td>
59
+ <td class='right_align'><tt>51</tt></td>
60
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
61
+ <div class="percent_graph">
62
+ <div class="covered" style="width:100px"></div>
63
+ <div class="uncovered" style="width:0px"></div>
64
+ </div></td>
65
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
66
+ <div class="percent_graph">
67
+ <div class="covered" style="width:100px"></div>
68
+ <div class="uncovered" style="width:0px"></div>
69
+ </div></td>
70
+ </tr>
71
+
72
+ <tr class="all_files all_coverage 110 app controllers even">
73
+ <td class="left_align"><a href="app-controllers-galleries_controller_rb.html">app/controllers/galleries_controller.rb</a></td>
74
+ <td class='right_align'><tt>18</tt></td>
75
+ <td class='right_align'><tt>15</tt></td>
76
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
77
+ <div class="percent_graph">
78
+ <div class="covered" style="width:100px"></div>
79
+ <div class="uncovered" style="width:0px"></div>
80
+ </div></td>
81
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
82
+ <div class="percent_graph">
83
+ <div class="covered" style="width:100px"></div>
84
+ <div class="uncovered" style="width:0px"></div>
85
+ </div></td>
86
+ </tr>
87
+
88
+ <tr class="all_files all_coverage 110 app controllers odd">
89
+ <td class="left_align"><a href="app-controllers-pages_controller_rb.html">app/controllers/pages_controller.rb</a></td>
90
+ <td class='right_align'><tt>5</tt></td>
91
+ <td class='right_align'><tt>5</tt></td>
92
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
93
+ <div class="percent_graph">
94
+ <div class="covered" style="width:100px"></div>
95
+ <div class="uncovered" style="width:0px"></div>
96
+ </div></td>
97
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
98
+ <div class="percent_graph">
99
+ <div class="covered" style="width:100px"></div>
100
+ <div class="uncovered" style="width:0px"></div>
101
+ </div></td>
102
+ </tr>
103
+
104
+ <tr class="all_files all_coverage 100 app controllers even">
105
+ <td class="left_align"><a href="app-controllers-paintings_controller_rb.html">app/controllers/paintings_controller.rb</a></td>
106
+ <td class='right_align'><tt>199</tt></td>
107
+ <td class='right_align'><tt>164</tt></td>
108
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>92.46%</tt></div>
109
+ <div class="percent_graph">
110
+ <div class="covered" style="width:92px"></div>
111
+ <div class="uncovered" style="width:8px"></div>
112
+ </div></td>
113
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>90.85%</tt></div>
114
+ <div class="percent_graph">
115
+ <div class="covered" style="width:91px"></div>
116
+ <div class="uncovered" style="width:9px"></div>
117
+ </div></td>
118
+ </tr>
119
+
120
+ <tr class="all_files all_coverage 50 60 70 80 90 100 app controllers odd">
121
+ <td class="left_align"><a href="app-controllers-user_sessions_controller_rb.html">app/controllers/user_sessions_controller.rb</a></td>
122
+ <td class='right_align'><tt>33</tt></td>
123
+ <td class='right_align'><tt>25</tt></td>
124
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>54.55%</tt></div>
125
+ <div class="percent_graph">
126
+ <div class="covered" style="width:55px"></div>
127
+ <div class="uncovered" style="width:45px"></div>
128
+ </div></td>
129
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>44.00%</tt></div>
130
+ <div class="percent_graph">
131
+ <div class="covered" style="width:44px"></div>
132
+ <div class="uncovered" style="width:56px"></div>
133
+ </div></td>
134
+ </tr>
135
+
136
+ <tr class="all_files all_coverage 110 app controllers even">
137
+ <td class="left_align"><a href="app-controllers-users_controller_rb.html">app/controllers/users_controller.rb</a></td>
138
+ <td class='right_align'><tt>47</tt></td>
139
+ <td class='right_align'><tt>37</tt></td>
140
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
141
+ <div class="percent_graph">
142
+ <div class="covered" style="width:100px"></div>
143
+ <div class="uncovered" style="width:0px"></div>
144
+ </div></td>
145
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
146
+ <div class="percent_graph">
147
+ <div class="covered" style="width:100px"></div>
148
+ <div class="uncovered" style="width:0px"></div>
149
+ </div></td>
150
+ </tr>
151
+
152
+ <tr class="all_files all_coverage 110 app controllers odd">
153
+ <td class="left_align"><a href="app-controllers-utils_controller_rb.html">app/controllers/utils_controller.rb</a></td>
154
+ <td class='right_align'><tt>5</tt></td>
155
+ <td class='right_align'><tt>5</tt></td>
156
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
157
+ <div class="percent_graph">
158
+ <div class="covered" style="width:100px"></div>
159
+ <div class="uncovered" style="width:0px"></div>
160
+ </div></td>
161
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
162
+ <div class="percent_graph">
163
+ <div class="covered" style="width:100px"></div>
164
+ <div class="uncovered" style="width:0px"></div>
165
+ </div></td>
166
+ </tr>
167
+
168
+ <tr class="all_files all_coverage 110 app helpers even">
169
+ <td class="left_align"><a href="app-helpers-application_helper_rb.html">app/helpers/application_helper.rb</a></td>
170
+ <td class='right_align'><tt>10</tt></td>
171
+ <td class='right_align'><tt>8</tt></td>
172
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
173
+ <div class="percent_graph">
174
+ <div class="covered" style="width:100px"></div>
175
+ <div class="uncovered" style="width:0px"></div>
176
+ </div></td>
177
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
178
+ <div class="percent_graph">
179
+ <div class="covered" style="width:100px"></div>
180
+ <div class="uncovered" style="width:0px"></div>
181
+ </div></td>
182
+ </tr>
183
+
184
+ <tr class="all_files all_coverage 110 app helpers odd">
185
+ <td class="left_align"><a href="app-helpers-authors_helper_rb.html">app/helpers/authors_helper.rb</a></td>
186
+ <td class='right_align'><tt>2</tt></td>
187
+ <td class='right_align'><tt>2</tt></td>
188
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
189
+ <div class="percent_graph">
190
+ <div class="covered" style="width:100px"></div>
191
+ <div class="uncovered" style="width:0px"></div>
192
+ </div></td>
193
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
194
+ <div class="percent_graph">
195
+ <div class="covered" style="width:100px"></div>
196
+ <div class="uncovered" style="width:0px"></div>
197
+ </div></td>
198
+ </tr>
199
+
200
+ <tr class="all_files all_coverage 60 70 80 90 100 app helpers even">
201
+ <td class="left_align"><a href="app-helpers-layout_helper_rb.html">app/helpers/layout_helper.rb</a></td>
202
+ <td class='right_align'><tt>22</tt></td>
203
+ <td class='right_align'><tt>15</tt></td>
204
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>68.18%</tt></div>
205
+ <div class="percent_graph">
206
+ <div class="covered" style="width:68px"></div>
207
+ <div class="uncovered" style="width:32px"></div>
208
+ </div></td>
209
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>53.33%</tt></div>
210
+ <div class="percent_graph">
211
+ <div class="covered" style="width:53px"></div>
212
+ <div class="uncovered" style="width:47px"></div>
213
+ </div></td>
214
+ </tr>
215
+
216
+ <tr class="all_files all_coverage 110 app models odd">
217
+ <td class="left_align"><a href="app-models-author_rb.html">app/models/author.rb</a></td>
218
+ <td class='right_align'><tt>23</tt></td>
219
+ <td class='right_align'><tt>17</tt></td>
220
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
221
+ <div class="percent_graph">
222
+ <div class="covered" style="width:100px"></div>
223
+ <div class="uncovered" style="width:0px"></div>
224
+ </div></td>
225
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
226
+ <div class="percent_graph">
227
+ <div class="covered" style="width:100px"></div>
228
+ <div class="uncovered" style="width:0px"></div>
229
+ </div></td>
230
+ </tr>
231
+
232
+ <tr class="all_files all_coverage 110 app models even">
233
+ <td class="left_align"><a href="app-models-invitation_rb.html">app/models/invitation.rb</a></td>
234
+ <td class='right_align'><tt>17</tt></td>
235
+ <td class='right_align'><tt>14</tt></td>
236
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
237
+ <div class="percent_graph">
238
+ <div class="covered" style="width:100px"></div>
239
+ <div class="uncovered" style="width:0px"></div>
240
+ </div></td>
241
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
242
+ <div class="percent_graph">
243
+ <div class="covered" style="width:100px"></div>
244
+ <div class="uncovered" style="width:0px"></div>
245
+ </div></td>
246
+ </tr>
247
+
248
+ <tr class="all_files all_coverage 90 100 app models odd">
249
+ <td class="left_align"><a href="app-models-painting_rb.html">app/models/painting.rb</a></td>
250
+ <td class='right_align'><tt>100</tt></td>
251
+ <td class='right_align'><tt>75</tt></td>
252
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>92.00%</tt></div>
253
+ <div class="percent_graph">
254
+ <div class="covered" style="width:92px"></div>
255
+ <div class="uncovered" style="width:8px"></div>
256
+ </div></td>
257
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>89.33%</tt></div>
258
+ <div class="percent_graph">
259
+ <div class="covered" style="width:89px"></div>
260
+ <div class="uncovered" style="width:11px"></div>
261
+ </div></td>
262
+ </tr>
263
+
264
+ <tr class="all_files all_coverage 110 app models even">
265
+ <td class="left_align"><a href="app-models-user_rb.html">app/models/user.rb</a></td>
266
+ <td class='right_align'><tt>46</tt></td>
267
+ <td class='right_align'><tt>34</tt></td>
268
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
269
+ <div class="percent_graph">
270
+ <div class="covered" style="width:100px"></div>
271
+ <div class="uncovered" style="width:0px"></div>
272
+ </div></td>
273
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
274
+ <div class="percent_graph">
275
+ <div class="covered" style="width:100px"></div>
276
+ <div class="uncovered" style="width:0px"></div>
277
+ </div></td>
278
+ </tr>
279
+
280
+ <tr class="all_files all_coverage 110 app models odd">
281
+ <td class="left_align"><a href="app-models-user_session_rb.html">app/models/user_session.rb</a></td>
282
+ <td class='right_align'><tt>2</tt></td>
283
+ <td class='right_align'><tt>2</tt></td>
284
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
285
+ <div class="percent_graph">
286
+ <div class="covered" style="width:100px"></div>
287
+ <div class="uncovered" style="width:0px"></div>
288
+ </div></td>
289
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
290
+ <div class="percent_graph">
291
+ <div class="covered" style="width:100px"></div>
292
+ <div class="uncovered" style="width:0px"></div>
293
+ </div></td>
294
+ </tr>
295
+
296
+ <tr class="all_files all_coverage 70 80 90 100 config even">
297
+ <td class="left_align"><a href="config-boot_rb.html">config/boot.rb</a></td>
298
+ <td class='right_align'><tt>110</tt></td>
299
+ <td class='right_align'><tt>89</tt></td>
300
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>72.73%</tt></div>
301
+ <div class="percent_graph">
302
+ <div class="covered" style="width:73px"></div>
303
+ <div class="uncovered" style="width:27px"></div>
304
+ </div></td>
305
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>67.42%</tt></div>
306
+ <div class="percent_graph">
307
+ <div class="covered" style="width:67px"></div>
308
+ <div class="uncovered" style="width:33px"></div>
309
+ </div></td>
310
+ </tr>
311
+
312
+ <tr class="all_files all_coverage 110 config odd">
313
+ <td class="left_align"><a href="config-environment_rb.html">config/environment.rb</a></td>
314
+ <td class='right_align'><tt>47</tt></td>
315
+ <td class='right_align'><tt>11</tt></td>
316
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
317
+ <div class="percent_graph">
318
+ <div class="covered" style="width:100px"></div>
319
+ <div class="uncovered" style="width:0px"></div>
320
+ </div></td>
321
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
322
+ <div class="percent_graph">
323
+ <div class="covered" style="width:100px"></div>
324
+ <div class="uncovered" style="width:0px"></div>
325
+ </div></td>
326
+ </tr>
327
+
328
+ <tr class="all_files all_coverage 110 config initializers even">
329
+ <td class="left_align"><a href="config-initializers-00_load_app_config_rb.html">config/initializers/00_load_app_config.rb</a></td>
330
+ <td class='right_align'><tt>2</tt></td>
331
+ <td class='right_align'><tt>2</tt></td>
332
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
333
+ <div class="percent_graph">
334
+ <div class="covered" style="width:100px"></div>
335
+ <div class="uncovered" style="width:0px"></div>
336
+ </div></td>
337
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
338
+ <div class="percent_graph">
339
+ <div class="covered" style="width:100px"></div>
340
+ <div class="uncovered" style="width:0px"></div>
341
+ </div></td>
342
+ </tr>
343
+
344
+ <tr class="all_files all_coverage 110 config initializers odd">
345
+ <td class="left_align"><a href="config-initializers-05_exception_notification_rb.html">config/initializers/05_exception_notification.rb</a></td>
346
+ <td class='right_align'><tt>5</tt></td>
347
+ <td class='right_align'><tt>3</tt></td>
348
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
349
+ <div class="percent_graph">
350
+ <div class="covered" style="width:100px"></div>
351
+ <div class="uncovered" style="width:0px"></div>
352
+ </div></td>
353
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
354
+ <div class="percent_graph">
355
+ <div class="covered" style="width:100px"></div>
356
+ <div class="uncovered" style="width:0px"></div>
357
+ </div></td>
358
+ </tr>
359
+
360
+ <tr class="all_files all_coverage 110 config initializers even">
361
+ <td class="left_align"><a href="config-initializers-locale_rb.html">config/initializers/locale.rb</a></td>
362
+ <td class='right_align'><tt>2</tt></td>
363
+ <td class='right_align'><tt>2</tt></td>
364
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
365
+ <div class="percent_graph">
366
+ <div class="covered" style="width:100px"></div>
367
+ <div class="uncovered" style="width:0px"></div>
368
+ </div></td>
369
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
370
+ <div class="percent_graph">
371
+ <div class="covered" style="width:100px"></div>
372
+ <div class="uncovered" style="width:0px"></div>
373
+ </div></td>
374
+ </tr>
375
+
376
+ <tr class="all_files all_coverage 110 config initializers odd">
377
+ <td class="left_align"><a href="config-initializers-new_rails_defaults_rb.html">config/initializers/new_rails_defaults.rb</a></td>
378
+ <td class='right_align'><tt>21</tt></td>
379
+ <td class='right_align'><tt>7</tt></td>
380
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
381
+ <div class="percent_graph">
382
+ <div class="covered" style="width:100px"></div>
383
+ <div class="uncovered" style="width:0px"></div>
384
+ </div></td>
385
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
386
+ <div class="percent_graph">
387
+ <div class="covered" style="width:100px"></div>
388
+ <div class="uncovered" style="width:0px"></div>
389
+ </div></td>
390
+ </tr>
391
+
392
+ <tr class="all_files all_coverage 110 config initializers even">
393
+ <td class="left_align"><a href="config-initializers-paperclip_rb.html">config/initializers/paperclip.rb</a></td>
394
+ <td class='right_align'><tt>2</tt></td>
395
+ <td class='right_align'><tt>2</tt></td>
396
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
397
+ <div class="percent_graph">
398
+ <div class="covered" style="width:100px"></div>
399
+ <div class="uncovered" style="width:0px"></div>
400
+ </div></td>
401
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
402
+ <div class="percent_graph">
403
+ <div class="covered" style="width:100px"></div>
404
+ <div class="uncovered" style="width:0px"></div>
405
+ </div></td>
406
+ </tr>
407
+
408
+ <tr class="all_files all_coverage 110 config initializers odd">
409
+ <td class="left_align"><a href="config-initializers-session_store_rb.html">config/initializers/session_store.rb</a></td>
410
+ <td class='right_align'><tt>15</tt></td>
411
+ <td class='right_align'><tt>4</tt></td>
412
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
413
+ <div class="percent_graph">
414
+ <div class="covered" style="width:100px"></div>
415
+ <div class="uncovered" style="width:0px"></div>
416
+ </div></td>
417
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
418
+ <div class="percent_graph">
419
+ <div class="covered" style="width:100px"></div>
420
+ <div class="uncovered" style="width:0px"></div>
421
+ </div></td>
422
+ </tr>
423
+
424
+ <tr class="all_files all_coverage 110 config even">
425
+ <td class="left_align"><a href="config-routes_rb.html">config/routes.rb</a></td>
426
+ <td class='right_align'><tt>25</tt></td>
427
+ <td class='right_align'><tt>18</tt></td>
428
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
429
+ <div class="percent_graph">
430
+ <div class="covered" style="width:100px"></div>
431
+ <div class="uncovered" style="width:0px"></div>
432
+ </div></td>
433
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
434
+ <div class="percent_graph">
435
+ <div class="covered" style="width:100px"></div>
436
+ <div class="uncovered" style="width:0px"></div>
437
+ </div></td>
438
+ </tr>
439
+
440
+ <tr class="all_files all_coverage 110 lib kids_art odd">
441
+ <td class="left_align"><a href="lib-kids_art-batch_processor_rb.html">lib/kids_art/batch_processor.rb</a></td>
442
+ <td class='right_align'><tt>27</tt></td>
443
+ <td class='right_align'><tt>20</tt></td>
444
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
445
+ <div class="percent_graph">
446
+ <div class="covered" style="width:100px"></div>
447
+ <div class="uncovered" style="width:0px"></div>
448
+ </div></td>
449
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
450
+ <div class="percent_graph">
451
+ <div class="covered" style="width:100px"></div>
452
+ <div class="uncovered" style="width:0px"></div>
453
+ </div></td>
454
+ </tr>
455
+
456
+ <tr class="all_files all_coverage 110 lib paperclip even">
457
+ <td class="left_align"><a href="lib-paperclip-write_dimensions_rb.html">lib/paperclip/write_dimensions.rb</a></td>
458
+ <td class='right_align'><tt>11</tt></td>
459
+ <td class='right_align'><tt>10</tt></td>
460
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
461
+ <div class="percent_graph">
462
+ <div class="covered" style="width:100px"></div>
463
+ <div class="uncovered" style="width:0px"></div>
464
+ </div></td>
465
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
466
+ <div class="percent_graph">
467
+ <div class="covered" style="width:100px"></div>
468
+ <div class="uncovered" style="width:0px"></div>
469
+ </div></td>
470
+ </tr>
471
+
472
+ <tr class="all_files all_coverage 110 lib utils odd">
473
+ <td class="left_align"><a href="lib-utils-core_rb.html">lib/utils/core.rb</a></td>
474
+ <td class='right_align'><tt>7</tt></td>
475
+ <td class='right_align'><tt>7</tt></td>
476
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
477
+ <div class="percent_graph">
478
+ <div class="covered" style="width:100px"></div>
479
+ <div class="uncovered" style="width:0px"></div>
480
+ </div></td>
481
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
482
+ <div class="percent_graph">
483
+ <div class="covered" style="width:100px"></div>
484
+ <div class="uncovered" style="width:0px"></div>
485
+ </div></td>
486
+ </tr>
487
+
488
+ <tr class="all_files all_coverage 100 lib utils even">
489
+ <td class="left_align"><a href="lib-utils-zip_rb.html">lib/utils/zip.rb</a></td>
490
+ <td class='right_align'><tt>39</tt></td>
491
+ <td class='right_align'><tt>31</tt></td>
492
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>94.87%</tt></div>
493
+ <div class="percent_graph">
494
+ <div class="covered" style="width:95px"></div>
495
+ <div class="uncovered" style="width:5px"></div>
496
+ </div></td>
497
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>93.55%</tt></div>
498
+ <div class="percent_graph">
499
+ <div class="covered" style="width:94px"></div>
500
+ <div class="uncovered" style="width:6px"></div>
501
+ </div></td>
502
+ </tr>
503
+
504
+ </tbody>
505
+ </table>
506
+ </div>
507
+
508
+ </body>
509
+ </html>
@@ -0,0 +1,10 @@
1
+ # Foo class
2
+ class Foo
3
+ def initialize
4
+ @foo = 'baz'
5
+ end
6
+
7
+ def bar
8
+ @foo
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ <tr>
2
+ <td class="left_align">TOTAL</td>
3
+ <td class='right_align'><tt>30</tt></td>
4
+ <td class='right_align'><tt>15</tt></td>
5
+ <td class="left_align"><tt class=''>80.00%</tt></td>
6
+ <td class="left_align"><tt class='coverage_total'>80.00%</tt></td>
7
+ </tr>
data/test/helper.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'mocha'
4
+ require 'simplecov'
5
+
6
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
8
+ require 'simplecov-rcov'
9
+
10
+ class Test::Unit::TestCase
11
+ end
@@ -0,0 +1,27 @@
1
+ require "#{File.dirname(__FILE__)}/helper"
2
+
3
+ class SimplecovRcovFormatterTest < Test::Unit::TestCase
4
+ def test_format
5
+ SimpleCov::Formatter::RcovFormatter.stubs( :path_result ).returns( '/tmp/rcov/coverage_test_index.html' )
6
+ if File.exists?( SimpleCov::Formatter::RcovFormatter.path_result )
7
+ File.delete( SimpleCov::Formatter::RcovFormatter.path_result )
8
+ end
9
+
10
+ @original_result = {
11
+ source_fixture( 'sample.rb' ) => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil],
12
+ source_fixture( 'app/models/user.rb' ) => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
13
+ source_fixture( 'app/controllers/sample_controller.rb' ) => [nil, 1, 1, 1, nil, nil, 0, 0, nil, nil]
14
+ }
15
+
16
+ @result = SimpleCov::Result.new( @original_result )
17
+ rcov_result = SimpleCov::Formatter::RcovFormatter.new().format( @result )
18
+
19
+ assert_match( File.read( "#{File.dirname(__FILE__)}/fixtures/totals_tr.html"), rcov_result )
20
+ assert_match( File.read( "#{File.dirname(__FILE__)}/fixtures/file_tr.html"), rcov_result )
21
+ assert( File.exists?( SimpleCov::Formatter::RcovFormatter.path_result ) )
22
+ end
23
+
24
+ def source_fixture( filename )
25
+ File.expand_path( File.join( File.dirname( __FILE__ ), 'fixtures', filename ) )
26
+ end
27
+ end
@@ -0,0 +1,45 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
5
+ <title>SimpleCov - RCov style</title>
6
+ </head>
7
+ <body>
8
+ <h1>SimpleCov - RCov style</h1>
9
+
10
+ <div class="report_table_wrapper">
11
+ <table class='report' id='report_table'>
12
+ <thead>
13
+ <tr>
14
+ <th class="left_align">Name</th>
15
+ <th class="right_align">Total Lines</th>
16
+ <th class="right_align">Lines of Code</th>
17
+ <th class="left_align">Total Coverage</th>
18
+ <th class="left_align">Code Coverage</th>
19
+ </tr>
20
+ </thead>
21
+ <tfoot>
22
+ <tr>
23
+ <td class="left_align">TOTAL</td>
24
+ <td class='right_align'><tt><%= @total_lines %></tt></td>
25
+ <td class='right_align'><tt><%= @total_lines_code %></tt></td>
26
+ <td class="left_align"><tt class=''><%= '%.2f' % @total_coverage %>%</tt></td>
27
+ <td class="left_align"><tt class='coverage_total'><%= '%.2f' % @total_coverage %>%</tt></td>
28
+ </tr>
29
+ </tfoot>
30
+ <tbody>
31
+ <% @files.each do |file| %>
32
+ <tr class="all_files">
33
+ <td class="left_align"><%= file.filename.gsub(SimpleCov.root, '.') %></td>
34
+ <td class='right_align'><tt><%= file.lines.count %></tt></td>
35
+ <td class='right_align'><tt><%= file.covered_lines.count + file.missed_lines.count %></tt></td>
36
+ <td class="left_align"><tt class=''><%= '%.2f' % file.covered_percent %>%</tt></td>
37
+ <td class="left_align"><tt class=''><%= '%.2f' % file.covered_percent %>%</tt></td>
38
+ </tr>
39
+ <% end %>
40
+ </tbody>
41
+ </table>
42
+ </div>
43
+
44
+ </body>
45
+ </html>
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simplecov-rcov
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Fernando Guillen http://fernandoguillen.info
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-19 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: simplecov
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: Rcov style formatter for SimpleCov
36
+ email: fguillen.mail@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README.rdoc
43
+ - lib/simplecov-rcov.rb
44
+ files:
45
+ - Manifest
46
+ - README.rdoc
47
+ - Rakefile
48
+ - lib/simplecov-rcov.rb
49
+ - test/fixtures/app/controllers/sample_controller.rb
50
+ - test/fixtures/app/models/user.rb
51
+ - test/fixtures/file_tr.html
52
+ - test/fixtures/index_created.html
53
+ - test/fixtures/index_rcov.html
54
+ - test/fixtures/sample.rb
55
+ - test/fixtures/totals_tr.html
56
+ - test/helper.rb
57
+ - test/simplecov-rcov_test.rb
58
+ - views/index.erb.html
59
+ - simplecov-rcov.gemspec
60
+ has_rdoc: true
61
+ homepage: http://github.com/fguillen/simplecov-rcov
62
+ licenses: []
63
+
64
+ post_install_message:
65
+ rdoc_options:
66
+ - --line-numbers
67
+ - --inline-source
68
+ - --title
69
+ - Simplecov-rcov
70
+ - --main
71
+ - README.rdoc
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 3
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ hash: 11
89
+ segments:
90
+ - 1
91
+ - 2
92
+ version: "1.2"
93
+ requirements: []
94
+
95
+ rubyforge_project: simplecov-rcov
96
+ rubygems_version: 1.3.7
97
+ signing_key:
98
+ specification_version: 3
99
+ summary: Rcov style formatter for SimpleCov
100
+ test_files:
101
+ - test/simplecov-rcov_test.rb