simplecov-console 0.9.1 → 0.9.3

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
  SHA256:
3
- metadata.gz: 5bb7e11c42fb65f0946870622b11a55ab39bb0eba3aa8cfc16da3d18be8fa48e
4
- data.tar.gz: 433b3c37567470bb280384d28c48a6e9fc04916fb9f74ce451c3f77316d4b130
3
+ metadata.gz: b22892d93da49c959fa9cb9bc6346372a08e4e13e73860729c421e0b65459a74
4
+ data.tar.gz: 5e954e6c6d52382cbe7cc46fffa861f3aa6418556fbfe7ef8b23b26b7aa40d71
5
5
  SHA512:
6
- metadata.gz: 837d50087a4744ecfcbfb1086ad425573a2ba151da649c529ed379340cb0720ad27824b3c26d4a9fdfadb91bfa464e9c8036029ca62991919019a9dc658b4702
7
- data.tar.gz: 7f104c87f947046cf75996ceec687684aee3466c0eb8c86074b7a18185142a14bcff96d7565bec1987f5ad75e3425923507c0fbf4ff0ff1e7d7766ec47f179cc
6
+ metadata.gz: a30c45a645cc20b90fc4454febe88629a969bc2f2b8ad1c1593c08b3a520b499eaa0ec87a318513fd06aefdbe94f01db4224a89af85070b3566809c113d22b73
7
+ data.tar.gz: 634cc784def1616395f89aa7d605d5780f33c2c986970d163482f26a0bc85bd0c7b0545d104c3c41447dd20c38f8a012a0b6719159e9d5e0a695f21b33ec93b6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.2 (2024.09.17)
4
+
5
+ - Fix: typo in output ([#24](https://github.com/chetan/simplecov-console/pull/24))
6
+
7
+ ## 0.9.1 (2021.02.01)
8
+
9
+ - Fix: Don't add ellipsis if line groups are not truncated - thanks [@lbraun](https://github.com/lbraun)! ([#21](https://github.com/chetan/simplecov-console/pull/21))
10
+
11
+ ## 0.9 (2021.01.21)
12
+
13
+ - Added support for limiting number of lines shown
14
+
3
15
  ## 0.8 (2020.11.11)
4
16
 
5
17
  - Added support for branch coverage - thanks [@robotdana!](https://github.com/robotdana) ([#19](https://github.com/chetan/simplecov-console/pull/19))
data/README.md CHANGED
@@ -60,6 +60,8 @@ SimpleCov::Formatter::Console.max_lines = 5 # integer
60
60
  SimpleCov::Formatter::Console.missing_len = 20 # integer
61
61
  SimpleCov::Formatter::Console.output_style = 'block' # 'table' (default) or 'block'
62
62
  SimpleCov::Formatter::Console.table_options = {:style => {:width => 200}}
63
+ SimpleCov::Formatter::Console.output_to_file = false
64
+ SimpleCov::Formatter::Console.output_filename = 'results.txt'
63
65
  ```
64
66
 
65
67
  Note that all options except `table_options` can also be set via env var using
@@ -130,6 +132,16 @@ increasing the table width:
130
132
  SimpleCov::Formatter::Console.table_options = {:style => {:width => 200}}
131
133
  ```
132
134
 
135
+ #### Output to File and filename
136
+
137
+ Saves the results to a file defaulted as 'results.txt' (customisable with the `output_filename` option) in the coverage folder.
138
+ Default is false to match existing functionality
139
+
140
+ ```ruby
141
+ SimpleCov::Formatter::Console.output_to_file = true
142
+ SimpleCov::Formatter::Console.output_filename = 'my_coverage.txt'
143
+ ```
144
+
133
145
  #### Block output style
134
146
 
135
147
  As an alternative to the default table output format, a simpler block format is
@@ -188,13 +200,21 @@ BRANCH COVERAGE: 83.33% -- 5/6 branches in 2 branches
188
200
 
189
201
  ## History
190
202
 
203
+ ### 0.9.2 (2024.09.17)
204
+
205
+ - Fix: typo in output ([#24](https://github.com/chetan/simplecov-console/pull/24))
206
+
207
+ ### 0.9.1 (2021.02.01)
208
+
209
+ - Fix: Don't add ellipsis if line groups are not truncated - thanks [@lbraun](https://github.com/lbraun)! ([#21](https://github.com/chetan/simplecov-console/pull/21))
210
+
191
211
  ### 0.9 (2021.01.21)
192
212
 
193
213
  - Added support for limiting number of lines shown
194
214
 
195
215
  ### 0.8 (2020.11.11)
196
216
 
197
- - Added support for branch coverage - thanks [@robotdana!](https://github.com/robotdana) ([#19](https://github.com/chetan/simplecov-console/pull/19))
217
+ - Added support for branch coverage - thanks [@robotdana](https://github.com/robotdana)! ([#19](https://github.com/chetan/simplecov-console/pull/19))
198
218
 
199
219
  ### 0.7.2 (2020.03.05)
200
220
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.1
1
+ 0.9.3
@@ -5,7 +5,7 @@ class SimpleCov::Formatter::Console
5
5
  VERSION = IO.read(File.expand_path("../../VERSION", __FILE__)).strip
6
6
 
7
7
  ATTRIBUTES = [:table_options, :use_colors, :max_rows, :max_lines,
8
- :missing_len, :show_covered, :sort, :output_style]
8
+ :missing_len, :show_covered, :sort, :output_style, :output_to_file, :output_filename]
9
9
 
10
10
  class << self
11
11
  attr_accessor(*ATTRIBUTES)
@@ -31,6 +31,12 @@ class SimpleCov::Formatter::Console
31
31
  # configure output format ('table', 'block')
32
32
  SimpleCov::Formatter::Console.output_style = ENV.fetch('OUTPUT_STYLE', 'table')
33
33
 
34
+ # change output to a file
35
+ SimpleCov::Formatter::Console.output_to_file = ENV.fetch('SIMPLECOV_OUTPUT_TO_FILE', false)
36
+
37
+ # Related to above setting to change the filename
38
+ SimpleCov::Formatter::Console.output_filename = ENV.fetch('SIMPLECOV_OUTPUT_FILENAME', 'results.txt')
39
+
34
40
  def include_output_style
35
41
  if SimpleCov::Formatter::Console.output_style == 'block' then
36
42
  require 'simplecov-console/output/block'
@@ -61,11 +67,19 @@ class SimpleCov::Formatter::Console
61
67
  root = Dir.pwd
62
68
  end
63
69
 
64
- puts
70
+ result_file_path = ''
71
+ if SimpleCov::Formatter::Console.output_to_file
72
+ result_file_path = File.join(SimpleCov.coverage_path, SimpleCov::Formatter::Console.output_filename)
73
+ # Temporarily assign $stdout to the file
74
+ file = File.open(result_file_path, 'w')
75
+ $stdout = file
76
+ end
77
+
78
+ puts unless SimpleCov::Formatter::Console.output_to_file
65
79
  puts "COVERAGE: #{colorize(pct(result.covered_percent))} -- #{result.covered_lines}/#{result.total_lines} lines in #{result.files.size} files"
66
80
  show_branch_coverage = show_branch_coverage?(result)
67
81
  if show_branch_coverage
68
- puts "BRANCH COVERAGE: #{colorize(pct(result.coverage_statistics[:branch].percent))} -- #{result.covered_branches}/#{result.total_branches} branches in #{result.files.size} branches"
82
+ puts "BRANCH COVERAGE: #{colorize(pct(result.coverage_statistics[:branch].percent))} -- #{result.covered_branches}/#{result.total_branches} branches in #{result.files.size} files"
69
83
  end
70
84
  puts
71
85
 
@@ -115,6 +129,12 @@ class SimpleCov::Formatter::Console
115
129
  puts "#{covered_files} file(s) with 100% coverage not shown"
116
130
  end
117
131
 
132
+ if SimpleCov::Formatter::Console.output_to_file
133
+ # Restore $stdout to its original state
134
+ $stdout = STDOUT
135
+ file.close
136
+ puts "Coverage report generated for #{result.command_name} to #{result_file_path}"
137
+ end
118
138
  end
119
139
 
120
140
  def branches_missed(missed_branches)
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: simplecov-console 0.9.1 ruby lib
5
+ # stub: simplecov-console 0.9.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "simplecov-console".freeze
9
- s.version = "0.9.1"
9
+ s.version = "0.9.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Chetan Sarva".freeze]
14
- s.date = "2021-02-01"
14
+ s.date = "2025-02-18"
15
15
  s.description = "Simple console output formatter for SimpleCov".freeze
16
16
  s.email = "chetan@pixelcop.net".freeze
17
17
  s.extra_rdoc_files = [
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  ]
37
37
  s.homepage = "http://github.com/chetan/simplecov-console".freeze
38
38
  s.licenses = ["MIT".freeze]
39
- s.rubygems_version = "3.1.4".freeze
39
+ s.rubygems_version = "3.3.26".freeze
40
40
  s.summary = "Simple console output formatter".freeze
41
41
 
42
42
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov-console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chetan Sarva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-01 00:00:00.000000000 Z
11
+ date: 2025-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.1.4
152
+ rubygems_version: 3.3.26
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: Simple console output formatter