simplecov-console 0.7.0 → 0.7.1
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 +4 -4
- data/README.md +4 -0
- data/VERSION +1 -1
- data/lib/simplecov-console.rb +11 -41
- data/lib/simplecov-console/output/block.rb +22 -0
- data/lib/simplecov-console/output/table.rb +30 -0
- data/simplecov-console.gemspec +5 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47674068cbbb506bb6d565cf8ed24c112e41331d62eb6607cb4a67945513fff5
|
4
|
+
data.tar.gz: 3ea9a7740fb46c53b0a9e06d4005828581c9d5b54743b216546685cd9c95e9b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5928a536464a73295d9f19a059c61273cf5d80f32664c6fe931ccb60649191981fe3f031973400ed52aed55d6841a0909a866cb5465f065c9aa5e2e9c93d833
|
7
|
+
data.tar.gz: 667f7c5ba2be5ccd16112fb8ff87a168b534e09bdef50ffc8a6ce441e4a4dbc5a102386f23b91a208fe989906ad651500da71ee97d236dc8f6df555316e0ac5a
|
data/README.md
CHANGED
@@ -133,6 +133,10 @@ coverage: 44.00% (28/50 lines)
|
|
133
133
|
|
134
134
|
## History
|
135
135
|
|
136
|
+
### 0.7.1 (2020.03.05)
|
137
|
+
|
138
|
+
- Fix: block output doesn't work with frozen string literal ([#16](https://github.com/chetan/simplecov-console/issues/16))
|
139
|
+
|
136
140
|
### 0.7 (2020.03.04)
|
137
141
|
|
138
142
|
- Added new 'block' style output option - thanks [@hpainter](https://github.com/hpainter)! ([#15](https://github.com/chetan/simplecov-console/issues/15))
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.1
|
data/lib/simplecov-console.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'terminal-table'
|
2
1
|
require 'ansi/code'
|
3
2
|
|
4
3
|
class SimpleCov::Formatter::Console
|
@@ -28,6 +27,15 @@ class SimpleCov::Formatter::Console
|
|
28
27
|
|
29
28
|
def format(result)
|
30
29
|
|
30
|
+
if SimpleCov::Formatter::Console.output_style == 'block' then
|
31
|
+
require 'simplecov-console/output/block'
|
32
|
+
extend BlockOutput
|
33
|
+
else
|
34
|
+
# default to table
|
35
|
+
require './output/table'
|
36
|
+
extend TableOutput
|
37
|
+
end
|
38
|
+
|
31
39
|
root = nil
|
32
40
|
if Module.const_defined? :ROOT then
|
33
41
|
root = ROOT
|
@@ -76,8 +84,8 @@ class SimpleCov::Formatter::Console
|
|
76
84
|
files = files.slice(0, max_rows)
|
77
85
|
end
|
78
86
|
|
79
|
-
puts
|
80
|
-
|
87
|
+
puts output(files,root)
|
88
|
+
|
81
89
|
if covered_files > 0 then
|
82
90
|
puts "#{covered_files} file(s) with 100% coverage not shown"
|
83
91
|
end
|
@@ -134,42 +142,4 @@ class SimpleCov::Formatter::Console
|
|
134
142
|
end
|
135
143
|
end
|
136
144
|
|
137
|
-
# format per-file results output using Terminal::Table
|
138
|
-
def table_output(files, root)
|
139
|
-
table = files.map do |f|
|
140
|
-
[
|
141
|
-
colorize(pct(f)),
|
142
|
-
f.filename.gsub(root + "/", ''),
|
143
|
-
f.lines_of_code,
|
144
|
-
f.missed_lines.count,
|
145
|
-
missed(f.missed_lines).join(", ")
|
146
|
-
]
|
147
|
-
end
|
148
|
-
|
149
|
-
table_options = SimpleCov::Formatter::Console.table_options || {}
|
150
|
-
if !table_options.kind_of?(Hash) then
|
151
|
-
raise ArgumentError.new("SimpleCov::Formatter::Console.table_options must be a Hash")
|
152
|
-
end
|
153
|
-
|
154
|
-
headings = %w{ coverage file lines missed missing }
|
155
|
-
|
156
|
-
opts = table_options.merge({:headings => headings, :rows => table})
|
157
|
-
Terminal::Table.new(opts)
|
158
|
-
end
|
159
|
-
|
160
|
-
# format per-file results output as plain text blocks
|
161
|
-
def block_output(files, root)
|
162
|
-
blocks = []
|
163
|
-
files.each do |f|
|
164
|
-
block = []
|
165
|
-
block << sprintf("%8.8s: %s", 'file', f.filename.gsub(root + "/", ''))
|
166
|
-
block << sprintf("%8.8s: %s (%d/%d lines)", 'coverage',
|
167
|
-
colorize(sprintf("%.2f%%", f.covered_percent)),
|
168
|
-
f.covered_lines.count, f.lines_of_code)
|
169
|
-
block << sprintf("%8.8s: %s", 'missed', missed(f.missed_lines).join(", "))
|
170
|
-
blocks << block.join("\n")
|
171
|
-
end
|
172
|
-
"\n" << blocks.join("\n\n") << "\n\n"
|
173
|
-
end
|
174
|
-
|
175
145
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
class SimpleCov::Formatter::Console
|
3
|
+
module BlockOutput
|
4
|
+
|
5
|
+
# format per-file results output as plain text blocks
|
6
|
+
def output(files, root)
|
7
|
+
blocks = []
|
8
|
+
files.each do |f|
|
9
|
+
block = []
|
10
|
+
block << sprintf("%8.8s: %s", 'file', f.filename.gsub(root + "/", ''))
|
11
|
+
block << sprintf("%8.8s: %s (%d/%d lines)", 'coverage',
|
12
|
+
colorize(sprintf("%.2f%%", f.covered_percent)),
|
13
|
+
f.covered_lines.count, f.lines_of_code)
|
14
|
+
block << sprintf("%8.8s: %s", 'missed', missed(f.missed_lines).join(", "))
|
15
|
+
blocks << block.join("\n")
|
16
|
+
end
|
17
|
+
|
18
|
+
"\n" + blocks.join("\n\n") + "\n\n"
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'terminal-table'
|
2
|
+
|
3
|
+
class SimpleCov::Formatter::Console
|
4
|
+
module TableOutput
|
5
|
+
|
6
|
+
# format per-file results output using Terminal::Table
|
7
|
+
def output(files, root)
|
8
|
+
table = files.map do |f|
|
9
|
+
[
|
10
|
+
colorize(pct(f)),
|
11
|
+
f.filename.gsub(root + "/", ''),
|
12
|
+
f.lines_of_code,
|
13
|
+
f.missed_lines.count,
|
14
|
+
missed(f.missed_lines).join(", ")
|
15
|
+
]
|
16
|
+
end
|
17
|
+
|
18
|
+
table_options = SimpleCov::Formatter::Console.table_options || {}
|
19
|
+
if !table_options.kind_of?(Hash) then
|
20
|
+
raise ArgumentError.new("SimpleCov::Formatter::Console.table_options must be a Hash")
|
21
|
+
end
|
22
|
+
|
23
|
+
headings = %w{ coverage file lines missed missing }
|
24
|
+
|
25
|
+
opts = table_options.merge({:headings => headings, :rows => table})
|
26
|
+
Terminal::Table.new(opts)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
data/simplecov-console.gemspec
CHANGED
@@ -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.7.
|
5
|
+
# stub: simplecov-console 0.7.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "simplecov-console".freeze
|
9
|
-
s.version = "0.7.
|
9
|
+
s.version = "0.7.1"
|
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 = "2020-03-
|
14
|
+
s.date = "2020-03-04"
|
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 = [
|
@@ -26,6 +26,8 @@ Gem::Specification.new do |s|
|
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
28
|
"lib/simplecov-console.rb",
|
29
|
+
"lib/simplecov-console/output/block.rb",
|
30
|
+
"lib/simplecov-console/output/table.rb",
|
29
31
|
"simplecov-console.gemspec",
|
30
32
|
"test/helper.rb",
|
31
33
|
"test/test_simplecov-console.rb"
|
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.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chetan Sarva
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|
@@ -123,6 +123,8 @@ files:
|
|
123
123
|
- Rakefile
|
124
124
|
- VERSION
|
125
125
|
- lib/simplecov-console.rb
|
126
|
+
- lib/simplecov-console/output/block.rb
|
127
|
+
- lib/simplecov-console/output/table.rb
|
126
128
|
- simplecov-console.gemspec
|
127
129
|
- test/helper.rb
|
128
130
|
- test/test_simplecov-console.rb
|