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 CHANGED
@@ -1,5 +1,5 @@
1
1
  Manifest
2
- README.rdoc
2
+ README.md
3
3
  Rakefile
4
4
  lib/simplecov-rcov.rb
5
5
  test/fixtures/app/controllers/sample_controller.rb
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.1') do |p|
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"
@@ -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 = result.covered_percent
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 )
@@ -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.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{2010-10-19}
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.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"]
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.rdoc"]
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}
@@ -1,4 +1,5 @@
1
- fixtures/app/controllers/sample_controller.rb</td>
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: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.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: 2010-10-19 00:00:00 +02:00
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.rdoc
42
+ - README.md
43
43
  - lib/simplecov-rcov.rb
44
44
  files:
45
45
  - Manifest
46
- - README.rdoc
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.rdoc
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.