coco 0.12.0 → 0.13.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 370bbcc5a7090bd6ad4ce42f2b7a339a6cc7f4c9
4
- data.tar.gz: 588bd8101244a9802da80a2bc42641f3c180ea61
3
+ metadata.gz: 3030feb597e938253dfae399455180d66a35f093
4
+ data.tar.gz: a0a298d7731658d6aff3c0493304bc7111caa4a8
5
5
  SHA512:
6
- metadata.gz: 325a23f885d4c9342aad6f3006244952c74566f79463167f6027f32529d1ca0e405005de0b83896e5c60b2b3d9cbe6037ace7958cdd879449cde0552084ad845
7
- data.tar.gz: e6aa3b9764732984c806d196c6eccae802590da1fc05bc6ea483aec4f10c5b41addebfcc19fe8a6c0e32801a53f9c26fce912739dd41252b2be98b9460d484cd
6
+ metadata.gz: 44de807fa160bf1e72e5e48dfa78464faf3f5d6bea1298f4b0afa2ccb28c0e22e5d31408c30c195655cbabb212bd5f60b9533bfc9a0f50b92f93c1a1f2153d20
7
+ data.tar.gz: 3a1b568bb6d43580078b59d23abe583da54d06972b8f9aa81c69ed8f30232db811633b69e00145e223904463254a74baf2257cb5fd8daf102c33384e187d29dc
@@ -1,3 +1,17 @@
1
+ v0.13.0 (2015-07-03)
2
+ =================================================
3
+
4
+ * Drop support for Ruby 1.9.3.
5
+ * Remove base path in index file of the HTML report for greater
6
+ readability.
7
+ * Exclude spec and test folders by default from the coverage. It was
8
+ weird to sometimes see test files reported.
9
+ * Improve the theme.
10
+ * In HTML report, highlight each lines of code, not only the green ones.
11
+ * Ligthen the first part of the path in the index file of the HTML
12
+ report for greater readability.
13
+
14
+
1
15
  v0.12.0 (2014-08-09)
2
16
  =================================================
3
17
 
@@ -1,38 +1,58 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coco (0.12.0)
4
+ coco (0.13.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ abstract_type (0.0.7)
10
+ adamantium (0.2.0)
11
+ ice_nine (~> 0.11.0)
12
+ memoizable (~> 0.4.0)
13
+ ast (2.0.0)
14
+ concord (0.1.5)
15
+ adamantium (~> 0.2.0)
16
+ equalizer (~> 0.0.9)
9
17
  diff-lcs (1.2.5)
10
- flay (2.4.0)
18
+ equalizer (0.0.11)
19
+ flay (2.6.1)
11
20
  ruby_parser (~> 3.0)
12
21
  sexp_processor (~> 4.0)
22
+ ice_nine (0.11.1)
23
+ memoizable (0.4.2)
24
+ thread_safe (~> 0.3, >= 0.3.1)
25
+ parser (2.2.2.6)
26
+ ast (>= 1.1, < 3.0)
27
+ procto (0.0.2)
13
28
  rainbow (2.0.0)
14
- rake (10.3.2)
15
- reek (1.3.7)
16
- rainbow
17
- ruby2ruby (~> 2.0.8)
18
- ruby_parser (~> 3.3)
19
- sexp_processor
20
- rspec (2.14.1)
21
- rspec-core (~> 2.14.0)
22
- rspec-expectations (~> 2.14.0)
23
- rspec-mocks (~> 2.14.0)
24
- rspec-core (2.14.8)
25
- rspec-expectations (2.14.5)
29
+ rake (10.4.2)
30
+ reek (3.0.0)
31
+ parser (~> 2.2.2.5)
32
+ rainbow (~> 2.0)
33
+ unparser (~> 0.2.2)
34
+ rspec (2.99.0)
35
+ rspec-core (~> 2.99.0)
36
+ rspec-expectations (~> 2.99.0)
37
+ rspec-mocks (~> 2.99.0)
38
+ rspec-core (2.99.2)
39
+ rspec-expectations (2.99.2)
26
40
  diff-lcs (>= 1.1.3, < 2.0)
27
- rspec-mocks (2.14.6)
28
- ruby2ruby (2.0.8)
29
- ruby_parser (~> 3.1)
30
- sexp_processor (~> 4.0)
31
- ruby_parser (3.6.1)
41
+ rspec-mocks (2.99.4)
42
+ ruby_parser (3.7.0)
32
43
  sexp_processor (~> 4.1)
33
- sexp_processor (4.4.3)
44
+ sexp_processor (4.6.0)
45
+ thread_safe (0.3.5)
34
46
  tomparse (0.4.2)
35
- yard (0.8.7.3)
47
+ unparser (0.2.4)
48
+ abstract_type (~> 0.0.7)
49
+ adamantium (~> 0.2.0)
50
+ concord (~> 0.1.5)
51
+ diff-lcs (~> 1.2.5)
52
+ equalizer (~> 0.0.9)
53
+ parser (~> 2.2.2)
54
+ procto (~> 0.0.2)
55
+ yard (0.8.7.6)
36
56
  yard-tomdoc (0.7.1)
37
57
  tomparse (>= 0.4.0)
38
58
  yard
@@ -45,6 +65,6 @@ DEPENDENCIES
45
65
  coco!
46
66
  flay (~> 2.4)
47
67
  rake (~> 10.1)
48
- reek (~> 1.3)
68
+ reek (~> 3.0)
49
69
  rspec (~> 2.14)
50
70
  yard-tomdoc (~> 0.7)
@@ -1,7 +1,10 @@
1
1
  coco [![Build Status](https://travis-ci.org/lkdjiin/coco.png)](https://travis-ci.org/lkdjiin/coco) [![Gem Version](https://badge.fury.io/rb/coco.png)](http://badge.fury.io/rb/coco) [![Inline docs](http://inch-ci.org/github/lkdjiin/coco.png)](http://inch-ci.org/github/lkdjiin/coco) [![Dependency Status](https://gemnasium.com/lkdjiin/coco.svg)](https://gemnasium.com/lkdjiin/coco)
2
2
  ==============================
3
3
 
4
- Code coverage tool for ruby 1.9.3, 2.0 and 2.1.
4
+ *«If it's well-covered it doesn't mean it's well-tested!»* —
5
+
6
+ Code coverage tool for ruby 2.0, 2.1 and 2.2.
7
+ =======
5
8
 
6
9
  Features
7
10
  --------------------------------
@@ -11,7 +14,6 @@ Features
11
14
  * Display names of uncovered files on console
12
15
  * _Simple_ html report _only_ for uncovered files
13
16
  * Report sources that have no tests
14
- * UTF-8 compliant
15
17
  * Configurable via a simple yaml file
16
18
  * Colorized console output (nix only)
17
19
 
@@ -27,6 +29,7 @@ Or directly:
27
29
 
28
30
  gem install coco
29
31
 
32
+ *NOTE: If you're using a Gemfile, don't `:require => false`*
30
33
 
31
34
  Usage
32
35
  --------------------------------
@@ -161,7 +164,7 @@ Now, when running tests, you will see something like the following:
161
164
  Dependencies
162
165
  --------------------------------
163
166
 
164
- ruby >= 1.9.3
167
+ ruby >= 2.0
165
168
 
166
169
 
167
170
  Contributing
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'bundler/gem_tasks'
4
2
  require 'rake/dsl_definition'
5
3
  require 'rake'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.12.0
1
+ 0.13.0
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'coco/formatter'
4
2
  require 'coco/cover'
5
3
  require 'coco/writer'
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'yaml'
4
2
 
5
3
  module Coco
@@ -26,7 +24,7 @@ module Coco
26
24
  def initialize
27
25
  self[:threshold] = 100
28
26
  self[:directories] = ['lib']
29
- self[:excludes] = []
27
+ self[:excludes] = ['spec', 'test']
30
28
  self[:single_line_report] = false
31
29
  self[:always_run] = true
32
30
  self[:show_link_in_terminal] = false
@@ -1,4 +1,2 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'coco/cover/coverage_stat'
4
2
  require 'coco/cover/coverage_result'
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # Compute results of interest from the big results information (from
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # Public: Give statistics about an array of lines hit.
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # Public: Build String with ANSI colorization.
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # I format coverages data for console output.
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # Contextual information for ERB template, representing each covered files.
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # My childs will format coverages information.
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'cgi'
4
2
  require 'erb'
5
3
 
@@ -13,12 +11,12 @@ module Coco
13
11
  super(raw_coverages, [])
14
12
  @formatted_output_files = {}
15
13
  @context = nil
16
- @template = Template.open File.join(Coco::ROOT, 'template/file.erb')
14
+ @template = Template.open(File.join(Coco::ROOT, 'template/file.erb'))
17
15
  end
18
16
 
19
17
  def format
20
18
  @raw_coverages.each do |filename, coverage|
21
- build_html filename, coverage
19
+ build_html(filename, coverage)
22
20
  end
23
21
  @formatted_output_files
24
22
  end
@@ -26,15 +24,18 @@ module Coco
26
24
  private
27
25
 
28
26
  def build_html(filename, coverage)
29
- source = File.readlines filename
30
27
  lines = []
31
- source.each_with_index do |line, index|
28
+ source(filename).each_with_index do |line, index|
32
29
  lines << [index+1, CGI.escapeHTML(line.chomp), coverage[index]]
33
30
  end
34
- @context = Context.new filename, lines
31
+ @context = Context.new(Helpers.name_for_html(filename), lines)
35
32
  @formatted_output_files[filename] = @template.result(@context.get_binding)
36
33
  end
37
34
 
35
+ def source(filename)
36
+ File.readlines(filename)
37
+ end
38
+
38
39
  end
39
40
 
40
41
  end
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'erb'
4
2
 
5
3
  module Coco
@@ -10,15 +8,16 @@ module Coco
10
8
  def initialize(raw_coverages, uncovered)
11
9
  super
12
10
  @context = nil
13
- @template = Template.open File.join(Coco::ROOT, 'template/index.erb')
11
+ @template = Template.open(File.join(Coco::ROOT, 'template/index.erb'))
14
12
  @lines = []
15
13
  build_lines_for_context
16
14
  end
17
15
 
18
16
  def format
19
- @context = IndexContext.new(Helpers.index_title,
20
- @lines,
21
- @uncovered.map{|e| emphasize(e) })
17
+ @context = IndexContext.new(
18
+ Helpers.index_title,
19
+ @lines,
20
+ @uncovered.map {|filename| Helpers.name_for_html(filename) })
22
21
  @template.result(@context.get_binding)
23
22
  end
24
23
 
@@ -26,19 +25,15 @@ module Coco
26
25
 
27
26
  def build_lines_for_context
28
27
  @raw_coverages.each do |filename, coverage|
29
- filename = File.expand_path(filename)
30
- percentage = CoverageStat.coverage_percent(coverage)
31
- on_disk_filename = Helpers.rb2html(filename)
32
- @lines << [percentage, emphasize(filename), on_disk_filename]
28
+ @lines << [
29
+ CoverageStat.coverage_percent(coverage),
30
+ Helpers.name_for_html(filename),
31
+ Helpers.rb2html(filename)
32
+ ]
33
33
  end
34
34
  @lines.sort!
35
35
  end
36
36
 
37
- def emphasize(filename)
38
- base = File.basename filename
39
- filename.sub(base, "<b>#{base}</b>")
40
- end
41
-
42
37
  end
43
38
 
44
39
  end
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'erb'
4
2
 
5
3
  module Coco
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # Public: Collection of application's helpers methods.
@@ -9,6 +7,27 @@ module Coco
9
7
  module Helpers
10
8
  class << self
11
9
 
10
+ # Public: Get a String (ruby) source filename ready to be
11
+ # displayed in the index file.
12
+ #
13
+ # name - String full path filename (normaly full path but, who
14
+ # knows? may be relative path).
15
+ #
16
+ # Examples
17
+ #
18
+ # name = '/home/user/my_project/lib/source.rb'
19
+ # Helpers.name_for_html(name)
20
+ # #=> 'lib/<b>source.rb</b>'
21
+ #
22
+ # Returns the formatted String.
23
+ def name_for_html(name)
24
+ name = File.expand_path(name)
25
+ name = name.sub(Dir.pwd, '')
26
+ name = name.sub(/^\//, '')
27
+ base = File.basename(name)
28
+ name.sub(base, "<b>#{base}</b>")
29
+ end
30
+
12
31
  # Public: Get html filename (from a ruby filename) suitable for
13
32
  # the coverage directory.
14
33
  #
@@ -22,7 +41,10 @@ module Coco
22
41
  #
23
42
  # Returns String HTML filename.
24
43
  def rb2html(name)
25
- name.sub(Dir.pwd, '').tr('/\\', '_') + '.html'
44
+ name = name.sub(Dir.pwd, '')
45
+ name = name.sub(/^\//, '')
46
+ name = name.tr('/\\', '_')
47
+ name + '.html'
26
48
  end
27
49
 
28
50
  # Public: Get page title for the index.html file.
@@ -1,4 +1,2 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'coco/lister/source_lister'
4
2
  require 'coco/lister/uncovered_lister'
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # I retrieve the .rb files from a list of directories.
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # I retrieve the list of uncovered (0%) .rb files.
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'coco/writer/file_writer'
4
2
  require 'coco/writer/html_directory'
5
3
  require 'coco/writer/html_files_writer'
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # Public: I write a single file.
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # Public: I prepare the coverage/ directory for html files.
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # Public: I populate the coverage/ directory with files, if any.
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  module Coco
4
2
 
5
3
  # Public: I write the index.html
@@ -14,8 +14,8 @@ table.index td {
14
14
  }
15
15
 
16
16
  html {
17
- background-color: #fff;
18
- color: #222;
17
+ background-color: #F5F5F5;
18
+ color: #505050;
19
19
  }
20
20
 
21
21
  body {
@@ -24,13 +24,13 @@ body {
24
24
 
25
25
  h2 {
26
26
  padding: 10px;
27
- background-color: #7658F8;
28
- color: #fff;
27
+ background-color: #6A9FB5;
28
+ color: #F5F5F5;
29
29
  font-size: 1.1em;
30
30
  }
31
31
 
32
32
  a {
33
- color:#446;
33
+ color: #505050;
34
34
  text-decoration: none;
35
35
  }
36
36
 
@@ -43,10 +43,10 @@ p.menu a {
43
43
  }
44
44
 
45
45
  p.license {
46
- color: #888;
46
+ color: #B0B0B0;
47
47
  margin-top: 20px;
48
48
  padding-top: 5px;
49
- border-top: 1px solid #888;
49
+ border-top: 1px solid #D0D0D0;
50
50
  font-size: 80%;
51
51
  }
52
52
 
@@ -70,52 +70,57 @@ table.source td {
70
70
 
71
71
  thead {
72
72
  font-weight: bold;
73
- background-color: #eee;
73
+ background-color: #E0E0E0;
74
74
  text-align: center;
75
75
  }
76
76
 
77
+ td,
78
+ td a {
79
+ color: #B0B0B0;
80
+ }
81
+
82
+ td b,
83
+ td a b {
84
+ color: #505050;
85
+ }
86
+
77
87
  tr.never {
78
- background-color: #eee;
88
+ background-color: #F5F5F5;
79
89
  }
80
90
 
81
91
  tr.hit {
82
- background-color: #5BD999;
92
+ background-color: #90A959;
83
93
  }
84
94
 
85
95
  tr.hit:hover {
86
- background-color: #8BF9C9;
96
+ background-color: #C4E679;
87
97
  }
88
98
 
89
99
  tr.miss {
90
- background-color: #E6567A;
91
- }
92
-
93
- td.yellow, td.orange, td.pink, td.red, td.black {
94
- width: 45px;
95
- color: #fff;
100
+ background-color: #AC4142;
96
101
  }
97
102
 
98
- td.yellow {
99
- background-color: #EAC14D;
103
+ tr.miss:hover {
104
+ background-color: #E65758;
100
105
  }
101
106
 
102
- td.orange {
103
- background-color: #CB70D7;
107
+ td.yellow, td.red, td.black {
108
+ width: 45px;
104
109
  }
105
110
 
106
- td.pink {
107
- background-color: #CB70D7;
111
+ td.yellow {
112
+ background-color: #F4BF75;
113
+ color: #303030;
108
114
  }
109
115
 
110
116
  td.red {
111
- background-color: #E6567A;
112
- font-weight: bold;
117
+ background-color: #AC4142;
118
+ color: #F5F5F5;
113
119
  }
114
120
 
115
121
  td.black {
116
- background-color: #222;
117
- color: #fff;
118
- font-weight: bold;
122
+ background-color: #505050;
123
+ color: #F5F5F5;
119
124
  }
120
125
 
121
126
  td.percentage {
@@ -123,22 +128,27 @@ td.percentage {
123
128
  padding-right: 20px;
124
129
  }
125
130
 
131
+ td.line-num,
132
+ td.line-hits,
126
133
  td.line-source {
127
- padding-right: 0;
134
+ color: #202020;
128
135
  }
129
136
 
130
- td.line-num, td.line-hits {
137
+ td.line-num,
138
+ td.line-hits {
131
139
  width: 10%;
140
+ text-align: right;
141
+ }
142
+
143
+ td.line-source {
144
+ padding-right: 0;
132
145
  }
133
146
 
134
147
  td.line-num {
135
- color: #444;
136
- text-align: right;
137
148
  padding-right: 5px;
138
149
  }
139
150
 
140
151
  td.line-hits {
141
- text-align: right;
142
152
  padding-right: 20px;
143
153
  }
144
154
 
@@ -150,3 +160,5 @@ th {
150
160
  pre {
151
161
  margin: 6px 0;
152
162
  }
163
+
164
+
@@ -23,7 +23,7 @@
23
23
  <% end %>
24
24
 
25
25
  <% @covered.each do |percentage, filename, href| %>
26
- <% level_class = case percentage; when 80..100; 'yellow'; when 70..79; 'orange'; when 69..50; 'pink'; else 'red'; end %>
26
+ <% level_class = case percentage; when 80..100; 'yellow'; else 'red'; end %>
27
27
  <tr>
28
28
  <td class="percentage <%= level_class %>"><%= percentage %>%</td>
29
29
  <td><a href="<%= href %>"><%= filename %></a></td>
@@ -34,7 +34,7 @@
34
34
 
35
35
  <p class="license">
36
36
  Coco, code coverage for ruby.<br/>
37
- Copyright 2011-2014, Xavier Nayrac<br/>
37
+ Copyright 2011-<%= Time.now.year %>, Xavier Nayrac<br/>
38
38
  <br/>
39
39
  This program is free software: you can redistribute it and/or modify<br/>
40
40
  it under the terms of the GNU General Public License as published by<br/>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xavier Nayrac
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-09 00:00:00.000000000 Z
11
+ date: 2015-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.3'
61
+ version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.3'
68
+ version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: flay
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.7'
97
97
  description: |-
98
- "Code coverage tool for ruby 1.9.3 to 2.1.
98
+ "Code coverage tool for ruby 2.0 to 2.2.
99
99
  Use it by "require 'coco'" from rspec or unit/test.
100
100
  It display names of uncovered files on console.
101
101
  It builds simple html report.
@@ -152,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
153
  - - ">="
154
154
  - !ruby/object:Gem::Version
155
- version: 1.9.3
155
+ version: '2.0'
156
156
  required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - ">="
@@ -160,9 +160,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  version: '0'
161
161
  requirements: []
162
162
  rubyforge_project:
163
- rubygems_version: 2.2.0.rc.1
163
+ rubygems_version: 2.4.5
164
164
  signing_key:
165
165
  specification_version: 4
166
- summary: Code coverage tool for ruby 1.9.3 to 2.1
166
+ summary: Code coverage tool for ruby 2.0 to 2.2
167
167
  test_files: []
168
168
  has_rdoc: