coco 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,68 @@
1
+ v0.7 (2013-06-19)
2
+ =================================================
3
+
4
+ * Bugfix: single_line_report option is now silent if there is nothing to
5
+ report
6
+ * Improve report styling (a bit)
7
+ * Default threeshold is now 100%
8
+ * Config file is renamed to '.coco.yml', to benefit of syntax highlighting
9
+
10
+
11
+ v0.6 (2011-10-30)
12
+ =================================================
13
+
14
+ * Added an option 'single_line_report'
15
+
16
+
17
+ v0.5.1 (2011-08-08)
18
+ =================================================
19
+
20
+ * Fix a bug where excluding a whole folder from the report does not worked
21
+
22
+
23
+ v0.5 (2011-03-14)
24
+ =================================================
25
+
26
+ * can exclude a whole folder of ruby files from the report
27
+ * works with unit/test framework
28
+
29
+
30
+ v0.4.2 (2011-03-01)
31
+ =================================================
32
+
33
+ Minor bug fixes
34
+ ---------------
35
+ * #14: sometimes text exit on the right from table in html report
36
+ * #13: '<' and '>' are not escaped in hml report
37
+ * #12: no link to web site in html files
38
+
39
+
40
+ v0.4.1 (2011-02-27)
41
+ =================================================
42
+
43
+ * Quick fix, add forgotten images for html menu
44
+
45
+
46
+ v0.4 (2011-02-26)
47
+ =================================================
48
+
49
+ * add colors to console output (*nix only)
50
+ * it can exclude unwanted files from the report
51
+
52
+
53
+ v0.3 (2011-02-25)
54
+ =================================================
55
+
56
+ * Report sources not covered at all
57
+ * Configurable via a simple yaml file: threeshold and source directories
58
+ * UTF-8 compliant
59
+ * Misc: sort index.html and console output by percentage, Display
60
+ version in index.html
61
+
62
+
63
+ v0.2 (2011-02-24)
64
+ =================================================
65
+
66
+ * Use coco from rspec with a simple require 'coco'
67
+ * Display filenames covered < 90% on console
68
+ * Build simple html report only for files covered < 90%
data/README.markdown ADDED
@@ -0,0 +1,108 @@
1
+ coco
2
+ ==============================
3
+
4
+ Code coverage tool for ruby 1.9.2, 1.9.3 and 2.0.
5
+
6
+ Features
7
+ --------------------------------
8
+
9
+ * Use it from rspec or test/unit with a simple `require 'coco'`
10
+ * Works with Rails
11
+ * Display names of uncovered files on console
12
+ * _Simple_ html report _only_ for uncovered files
13
+ * Report sources that have no tests
14
+ * UTF-8 compliant
15
+ * Configurable via a simple yaml file
16
+ * Colorized console output (nix only)
17
+
18
+
19
+ Install
20
+ --------------------------------
21
+
22
+ gem install coco
23
+
24
+ Usage
25
+ --------------------------------
26
+ Require the coco library at the beginning of your tests:
27
+
28
+ require 'coco'
29
+
30
+ Usually you do this only once, by putting this line in an spec_helper.rb,
31
+ or test_helper.rb (or whatever you named it).
32
+
33
+ ###View report
34
+
35
+ After your tests, coco will display a short report in the console window, like this one:
36
+
37
+ $ rake test
38
+ [...]
39
+ 26 examples, 0 failures
40
+ 0% /home/xavier/project/lib/iprune.rb
41
+ 0% /home/xavier/project/lib/iprune/iprune.rb
42
+ 46% /home/xavier/project/lib/parser/prunille.rb
43
+ $
44
+
45
+ If there is some files reported in the console, coco will create a `coverage/`
46
+ folder at the root of the project. Browse the `coverage/index.html` to access
47
+ a line by line report.
48
+
49
+ **Be careful!** Any `coverage` folder at the root of your project will be
50
+ deleted without warning!
51
+
52
+ _Note: files with a coverage of 0% are only listed in index.html ; there
53
+ is no line by line report for such files._
54
+
55
+ Configuration
56
+ ----------------------------------
57
+
58
+ Configuration is done via a YAML file. You can configure:
59
+
60
+ * __threeshold__: the percentage threeshold
61
+ * __directories__: the directories from where coco will search for untested source files
62
+ * __excludes__: a list of files to exclude from the report
63
+ * __single_line_report__: the report's style
64
+
65
+ By default, threeshold is set to 100 and directories is set to 'lib'.
66
+
67
+ To change the default coco configuration, put a `.coco.yml` file at the root of your project.
68
+
69
+ _Earlier versions of coco used to use `.coco` instead of `.coco.yml`, as of
70
+ version 0.7, using `.coco` is deprecated. Reason is `.yml` extension allow
71
+ for syntax highlighting._
72
+
73
+
74
+ ###Sample config for a Rails project
75
+
76
+ :directories:
77
+ - app
78
+ - lib
79
+ :excludes:
80
+ - spec
81
+ - config/initializers
82
+ :single_line_report: true
83
+
84
+ _Note: YAML is very punctilious with the syntax. In particular, paid attention
85
+ to not put any leading spaces or tab at all._
86
+
87
+ See [more examples](https://github.com/lkdjiin/coco/wiki) on the wiki.
88
+
89
+ Dependencies
90
+ --------------------------------
91
+
92
+ ruby >= 1.9.2
93
+
94
+
95
+ License
96
+ --------------------------------
97
+ GPLv3, see COPYING.
98
+
99
+ Questions and/or Comments
100
+ --------------------------------
101
+
102
+ Feel free to email [Xavier Nayrac](mailto:xavier.nayrac@gmail.com)
103
+ with any questions, or contact me on [twitter](https://twitter.com/lkdjiin).
104
+
105
+ Contributors
106
+ --------------------------------
107
+
108
+ [sunaku (Suraj N. Kurapati)](https://github.com/sunaku)
data/TODO CHANGED
@@ -1 +1,12 @@
1
+ travis: 1.9.2, 1.9.3, 2.0.0
1
2
 
3
+ exclure spec et test par défaut
4
+
5
+ le wiki dit que seul le dossier lib est inspecté par défaut, je pense
6
+ que c'est en fait toute l'application.
7
+
8
+ améliorer un poil le site + analytics
9
+
10
+ -----------------------
11
+
12
+ Virer les css de yahoo
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6
1
+ 0.7
@@ -21,13 +21,16 @@ module Coco
21
21
  class Configuration < Hash
22
22
 
23
23
  def initialize
24
- self[:threeshold] = 90
24
+ self[:threeshold] = 100
25
25
  self[:directories] = ['lib']
26
26
  self[:excludes] = []
27
27
  self[:single_line_report] = false
28
- if File.exist?('.coco')
29
- conf = YAML.load_file '.coco'
30
- self.merge!(conf)
28
+ if File.exist?('.coco.yml')
29
+ self.merge!(YAML.load_file('.coco.yml'))
30
+ # Deprecated: Support of '.coco' file will be remove in a future
31
+ # version.
32
+ elsif File.exist?('.coco')
33
+ self.merge!(YAML.load_file('.coco'))
31
34
  end
32
35
  expand_directories
33
36
  remove_directories
@@ -4,10 +4,10 @@ module Coco
4
4
 
5
5
  # I format coverages information for console output
6
6
  class ConsoleFormatter < Formatter
7
-
7
+
8
8
  # @param [Boolean] single_line_report
9
9
  #
10
- # return [string] percent covered and associated filenames
10
+ # return [string] percent covered and associated filenames
11
11
  def format single_line_report = false
12
12
  if single_line_report
13
13
  single_line_message
@@ -15,7 +15,7 @@ module Coco
15
15
  @formatted_output.join("\n")
16
16
  end
17
17
  end
18
-
18
+
19
19
  # @param [Hash] covered
20
20
  # @param [Array] uncovered
21
21
  def initialize covered, uncovered
@@ -24,7 +24,7 @@ module Coco
24
24
  compute_percentage
25
25
  add_percentage_to_uncovered
26
26
  @formatted_output.sort!
27
- @formatted_output.map! do |percentage, filename|
27
+ @formatted_output.map! do |percentage, filename|
28
28
  text = ColoredString.new "#{percentage}% #{filename}"
29
29
  if percentage <= 50
30
30
  text.red
@@ -33,28 +33,28 @@ module Coco
33
33
  end
34
34
  end
35
35
  end
36
-
36
+
37
37
  private
38
-
38
+
39
39
  def compute_percentage
40
- @raw_coverages.each do |filename, coverage|
40
+ @raw_coverages.each do |filename, coverage|
41
41
  percentage = CoverageStat.coverage_percent(coverage)
42
42
  @formatted_output << [percentage, filename]
43
43
  end
44
44
  end
45
-
45
+
46
46
  def add_percentage_to_uncovered
47
47
  @uncovered.each do |filename| @formatted_output << [0, filename] end
48
48
  end
49
-
49
+
50
50
  def single_line_message
51
- if @formatted_output.empty?
52
- "All files covered"
51
+ if @uncovered.empty?
52
+ ""
53
53
  else
54
54
  ColoredString.new("Some files are uncovered").yellow
55
55
  end
56
56
  end
57
-
57
+
58
58
  end
59
59
 
60
60
  end
data/lib/coco/helpers.rb CHANGED
@@ -22,7 +22,9 @@ module Coco
22
22
 
23
23
  # @return [String] The title of the index.html file
24
24
  def Helpers.index_title
25
- "Coco #{File.read(File.join($COCO_PATH, 'VERSION')).strip}, code coverage for #{File.basename(Dir.pwd)}"
25
+ project_name = File.basename(Dir.pwd)
26
+ version = File.read(File.join($COCO_PATH, 'VERSION')).strip
27
+ "#{project_name} - Code coverage (coco #{version})"
26
28
  end
27
29
 
28
30
  # @param [Array<String>] files List of filenames
@@ -1,34 +1,29 @@
1
1
  @charset "UTF-8";
2
2
  @import url("reset-min.css");
3
3
  @import url("base-min.css");
4
- @import url("font-min.css");
5
- @import url("ext.css");
4
+ @import url("font-min.css")
6
5
 
7
- html
8
- {
9
- background-color: #fcfcff;
6
+ html {
7
+ background-color: #fff;
8
+ color: #222;
10
9
  }
11
10
 
12
- h2
13
- {
11
+ h2 {
14
12
  padding: 10px;
15
- background-color: #668;
16
- color: #fcfcff;
13
+ background-color: #7658F8;
14
+ color: #fff;
17
15
  }
18
16
 
19
- a
20
- {
17
+ a {
21
18
  color:#446;
22
19
  text-decoration: none;
23
20
  }
24
21
 
25
- p.menu a
26
- {
22
+ p.menu a {
27
23
  font-weight: bold;
28
24
  }
29
25
 
30
- p.license
31
- {
26
+ p.license {
32
27
  color: #888;
33
28
  margin-top: 20px;
34
29
  padding-top: 5px;
@@ -36,71 +31,67 @@ p.license
36
31
  font-size: 80%;
37
32
  }
38
33
 
39
- p.date
40
- {
34
+ p.date {
41
35
  font-size: 80%;
42
36
  }
43
37
 
44
- table
45
- {
38
+ table {
46
39
  width: 100%;
47
40
  }
48
41
 
49
- table td
50
- {
42
+ table td {
51
43
  border-width: 0;
52
44
  }
53
45
 
54
- table.source td
55
- {
46
+ table.source td {
56
47
  padding: 0;
57
48
  }
58
49
 
59
- tr.never
60
- {
50
+ tr.never {
61
51
  background-color: #eee;
62
52
  }
63
53
 
64
- tr.hit
65
- {
66
- background-color: #efe;
54
+ tr.hit {
55
+ background-color: #5BD999;
67
56
  }
68
57
 
69
- tr.miss
70
- {
71
- background-color: #fbb;
58
+ tr.miss {
59
+ background-color: #E6567A;
72
60
  }
73
61
 
74
- td.yellow, td.orange, td.pink, td.red, td.black
75
- {
62
+ td.yellow, td.orange, td.pink, td.red, td.black {
76
63
  width: 45px;
64
+ color: #fff;
77
65
  }
78
66
 
79
- td.yellow
80
- {
81
- background-color: #fffead;
67
+ td.yellow {
68
+ background-color: #EAC14D;
82
69
  }
83
70
 
84
- td.orange
85
- {
86
- background-color: #ffcd84;
71
+ td.orange {
72
+ background-color: #CB70D7;
87
73
  }
88
74
 
89
- td.pink
90
- {
91
- background-color: #ffcd84;
75
+ td.pink {
76
+ background-color: #CB70D7;
92
77
  }
93
78
 
94
- td.red
95
- {
96
- background-color: #ff4747;
97
- color: #fff;
79
+ td.red {
80
+ background-color: #E6567A;
98
81
  font-weight: bold;
99
82
  }
100
83
 
101
- td.black
102
- {
103
- background-color: #002;
84
+ td.black {
85
+ background-color: #222;
104
86
  color: #fff;
105
87
  font-weight: bold;
106
88
  }
89
+
90
+ td:first-child {
91
+ text-align: right;
92
+ padding-right: 20px;
93
+ }
94
+
95
+ pre {
96
+ margin: 6px 0;
97
+ }
data/template/index.erb CHANGED
@@ -39,7 +39,7 @@
39
39
 
40
40
  <p class="license">
41
41
  Coco, code coverage for ruby.<br/>
42
- Copyright 2011, Xavier Nayrac<br/>
42
+ Copyright 2011-2013, Xavier Nayrac<br/>
43
43
  <br/>
44
44
  This program is free software: you can redistribute it and/or modify<br/>
45
45
  it under the terms of the GNU General Public License as published by<br/>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coco
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: '0.7'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,26 +9,19 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-30 01:00:00.000000000 +02:00
13
- default_executable:
12
+ date: 2013-06-19 00:00:00.000000000 Z
14
13
  dependencies: []
15
- description: ! '"Another code coverage tool for ruby 1.9
14
+ description: ! '"Code coverage tool for ruby 1.9.2 to 2.0.
16
15
 
17
- (from the famous post of Aaron Patterson).
16
+ Use it by "require ''coco''" from rspec or unit/test.
18
17
 
19
- * Simply "require ''coco''" from rspec or unit/test
18
+ It display names of uncovered files on console.
20
19
 
21
- * Display filenames covered less than 90% on console
20
+ It builds simple html report.
22
21
 
23
- * Build simple html report only for files covered less than 90%
22
+ It reports sources that have no tests.
24
23
 
25
- * Report sources that have no tests
26
-
27
- * UTF-8 compliant
28
-
29
- * Configurable with a simple yaml file
30
-
31
- * Colorized console output (*nix only)'
24
+ It''s configurable with a simple yaml file.'
32
25
  email: xavier.nayrac@gmail.com
33
26
  executables: []
34
27
  extensions: []
@@ -62,17 +55,15 @@ files:
62
55
  - template/css/reset-min.css
63
56
  - template/css/coco.css
64
57
  - template/css/LICENCE
65
- - template/css/ext.css
66
58
  - template/css/base-min.css
67
59
  - template/img/licenses
68
60
  - template/img/coconut16.png
69
61
  - VERSION
70
62
  - COPYING
71
- - NEWS
63
+ - README.markdown
64
+ - Changelog.markdown
72
65
  - Rakefile
73
66
  - TODO
74
- - README.rdoc
75
- has_rdoc: true
76
67
  homepage: http://lkdjiin.github.com/coco/
77
68
  licenses:
78
69
  - GPL-3
@@ -94,8 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
85
  version: '0'
95
86
  requirements: []
96
87
  rubyforge_project:
97
- rubygems_version: 1.6.2
88
+ rubygems_version: 1.8.25
98
89
  signing_key:
99
90
  specification_version: 3
100
- summary: Code coverage tool for ruby 1.9.
91
+ summary: Code coverage tool for ruby 1.9.2 to 2.0
101
92
  test_files: []
data/NEWS DELETED
@@ -1,52 +0,0 @@
1
- v0.6 (2011-10-30)
2
-
3
- * Added an option 'single_line_report'
4
-
5
-
6
- v0.5.1 (2011-08-08)
7
-
8
- * Fix a bug where excluding a whole folder from the report does not worked
9
-
10
-
11
- v0.5 (2011-03-14)
12
-
13
- * can exclude a whole folder of ruby files from the report
14
- * works with unit/test framework
15
-
16
-
17
- v0.4.2 (2011-03-01)
18
-
19
- * Minor bug fixes
20
- #14: sometimes text exit on the right from table in html report
21
- #13: '<' and '>' are not escaped in hml report
22
- #12: no link to web site in html files
23
-
24
-
25
- v0.4.1 (2011-02-27)
26
-
27
- * Quick fix, add forgotten images for html menu
28
-
29
-
30
- v0.4 (2011-02-26)
31
-
32
- * add colors to console output (*nix only)
33
- * it can exclude unwanted files from the report
34
-
35
-
36
- v0.3 (2011-02-25)
37
-
38
- * Report sources not covered at all
39
- * Configurable via a simple yaml file
40
- + threeshold
41
- + source directories
42
- * UTF-8 compliant
43
- * Misc
44
- + sort index.html and console output by percentage
45
- + display coco's version in index.html
46
-
47
-
48
- v0.2 (2011-02-24)
49
-
50
- * Use coco from rspec with a simple require 'coco'
51
- * Display filenames covered < 90% on console
52
- * Build simple html report only for files covered < 90%
data/README.rdoc DELETED
@@ -1,55 +0,0 @@
1
- = coco
2
-
3
- Another code coverage for ruby 1.9 (from the famous post of Aaron Patterson).
4
-
5
- == Features
6
- * Use it from rspec or test/unit with a simple <code>require 'coco'</code>
7
- * Works with Rails
8
- * Display filenames covered less than 90% on console
9
- * <em>Simple</em> html report <em>only</em> for files covered less than 90%
10
- * Report sources that have no tests
11
- * UTF-8 compliant
12
- * Configurable via a simple yaml file
13
- * Colorized console output (*nix only)
14
-
15
- <em>Note: I have tested coco only on debian linux.</em>
16
-
17
- == Documentation
18
-
19
- require 'coco'
20
-
21
- at the beginning of your tests, usually in a \*helper\*.rb file.
22
-
23
- See {the wiki}[https://github.com/lkdjiin/coco/wiki] for more information on using coco.
24
-
25
- To generate the developper's documentation in YARD format:
26
- rake doc
27
-
28
- == Dependencies
29
-
30
- ruby >= 1.9.2
31
-
32
- To contribute:
33
-
34
- * rspec
35
- * reek
36
- * flay
37
-
38
- == Installing coco
39
- From the sources:
40
- rake install
41
-
42
- From rubygems:
43
- gem install coco
44
-
45
- == License
46
- GPLv3, see COPYING.
47
-
48
- == Questions and/or Comments
49
-
50
- Feel free to email {Xavier Nayrac}[mailto:xavier.nayrac@gmail.com]
51
- with any questions.
52
-
53
- == Contributors
54
-
55
- {sunaku (Suraj N. Kurapati)}[https://github.com/sunaku]
data/template/css/ext.css DELETED
@@ -1,5 +0,0 @@
1
- td, h2
2
- {
3
- -moz-border-radius: 10px 0;
4
- border-radius: 10px 0;
5
- }