simplecov-rcov 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +1 -1
- data/README.md +26 -0
- data/Rakefile +1 -1
- data/lib/simplecov-rcov.rb +10 -1
- data/simplecov-rcov.gemspec +5 -5
- data/test/fixtures/file_tr.html +2 -1
- metadata +7 -7
- data/README.rdoc +0 -26
data/Manifest
CHANGED
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# SimpleCov Rcov Formatter gem
|
2
|
+
|
3
|
+
Is a Rcov style formatter for the ruby 1.9+ coverage gem: [SimpleCov](http://github.com/colszowka/simplecov).
|
4
|
+
|
5
|
+
The target of this formatter is to cheat on **Hudson** so I can use the [Ruby metrics plugin](http://github.com/hudson/rubymetrics-plugin) with **SimpleCov**.
|
6
|
+
|
7
|
+
So if you are looking some kind of workaround to integrate **SimpleCov** with your **Hudson** + **Ruby metrics plugin** this is a beginning.
|
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
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('simplecov-rcov', '0.1.
|
5
|
+
Echoe.new('simplecov-rcov', '0.1.2') do |p|
|
6
6
|
p.description = "Rcov style formatter for SimpleCov"
|
7
7
|
p.url = "http://github.com/fguillen/simplecov-rcov"
|
8
8
|
p.author = "Fernando Guillen http://fernandoguillen.info"
|
data/lib/simplecov-rcov.rb
CHANGED
@@ -6,7 +6,7 @@ class SimpleCov::Formatter::RcovFormatter
|
|
6
6
|
|
7
7
|
@total_lines = result.files.map { |e| e.lines.count }.inject(:+)
|
8
8
|
@total_lines_code = result.files.map { |e| e.covered_lines.count + e.missed_lines.count }.inject(:+)
|
9
|
-
@total_coverage =
|
9
|
+
@total_coverage = SimpleCov::Formatter::RcovFormatter.total_coverage(@files)
|
10
10
|
|
11
11
|
template = ERB.new( File.read( "#{File.dirname(__FILE__)}/../views/index.erb.html" ) )
|
12
12
|
rcov_result = template.result( binding )
|
@@ -23,6 +23,15 @@ class SimpleCov::Formatter::RcovFormatter
|
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
26
|
+
|
27
|
+
# Computes the coverage based upon lines covered and lines missed
|
28
|
+
def self.total_coverage(file_list)
|
29
|
+
return 100.0 if file_list.length == 0
|
30
|
+
porcents_sum = file_list.map(&:covered_percent).reduce(&:+)
|
31
|
+
result = porcents_sum / file_list.length
|
32
|
+
|
33
|
+
return result
|
34
|
+
end
|
26
35
|
|
27
36
|
def self.path_result
|
28
37
|
File.join( SimpleCov.coverage_path, SimpleCov::Formatter::RcovFormatter::PATH_RESULT )
|
data/simplecov-rcov.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{simplecov-rcov}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Fernando Guillen http://fernandoguillen.info"]
|
9
|
-
s.date = %q{
|
9
|
+
s.date = %q{2011-01-10}
|
10
10
|
s.description = %q{Rcov style formatter for SimpleCov}
|
11
11
|
s.email = %q{fguillen.mail@gmail.com}
|
12
|
-
s.extra_rdoc_files = ["README.
|
13
|
-
s.files = ["Manifest", "README.
|
12
|
+
s.extra_rdoc_files = ["README.md", "lib/simplecov-rcov.rb"]
|
13
|
+
s.files = ["Manifest", "README.md", "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
14
|
s.homepage = %q{http://github.com/fguillen/simplecov-rcov}
|
15
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Simplecov-rcov", "--main", "README.
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Simplecov-rcov", "--main", "README.md"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{simplecov-rcov}
|
18
18
|
s.rubygems_version = %q{1.3.7}
|
data/test/fixtures/file_tr.html
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
<tr class="all_files">
|
2
|
+
<td class="left_align"><a href="#./test/fixtures/app/controllers/sample_controller.rb">./test/fixtures/app/controllers/sample_controller.rb</a></td>
|
2
3
|
<td class='right_align'><tt>10</tt></td>
|
3
4
|
<td class='right_align'><tt>5</tt></td>
|
4
5
|
<td class="left_align"><tt class=''>60.00%</tt></td>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov-rcov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Fernando Guillen http://fernandoguillen.info
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-10 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -39,11 +39,11 @@ executables: []
|
|
39
39
|
extensions: []
|
40
40
|
|
41
41
|
extra_rdoc_files:
|
42
|
-
- README.
|
42
|
+
- README.md
|
43
43
|
- lib/simplecov-rcov.rb
|
44
44
|
files:
|
45
45
|
- Manifest
|
46
|
-
- README.
|
46
|
+
- README.md
|
47
47
|
- Rakefile
|
48
48
|
- lib/simplecov-rcov.rb
|
49
49
|
- test/fixtures/app/controllers/sample_controller.rb
|
@@ -68,7 +68,7 @@ rdoc_options:
|
|
68
68
|
- --title
|
69
69
|
- Simplecov-rcov
|
70
70
|
- --main
|
71
|
-
- README.
|
71
|
+
- README.md
|
72
72
|
require_paths:
|
73
73
|
- lib
|
74
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/README.rdoc
DELETED
@@ -1,26 +0,0 @@
|
|
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.
|