checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
---
2
- SHA1:
3
- metadata.gz: bec010d959a204e33d769bf7ab234f8649815db6
4
- data.tar.gz: 9f282da9a5e8b3b9ed7c8548315138f874fc972e
2
+ SHA256:
3
+ metadata.gz: 290f9f7dda635d7301e3c4f2acd9bb81a17fda27aee5a812983ba19bfea11ebe
4
+ data.tar.gz: 2e317c4c10cf7dff407e2544c2916136c7d436f35a89fc10a509649a8706d32c
5
5
SHA512:
6
- metadata.gz: 4fcf5b434645fc9f979b5597316fc385b5ded4986900c099e22f2bb8a35211f375ec92db06c84d4d8e01d29bc5f95341b77d188387a1629b460b60fbd434bdbf
7
- data.tar.gz: 7085bb1d529cd7e88c62e0ec769c6b931cc8359125a6d728cbb0c1cb632f3b7c4b2b3a8d98b21cc87674505fb67964419aa557215bc415413b80534cdc3df45d
6
+ metadata.gz: 2de0c0d1e3b265df0d214368841200362feee6817497562d0ad04246b2c2ab81346e714242bd767bf8ffbe7fdca8d321061559a5a05a47a09fe2c79f14df91bd
7
+ data.tar.gz: 0d6bd990215178e64db73696dfa06454ba46d0f72771e380114d9c881e7945fc0e7c33dcc010b8c5b1b598eb4f4a2ad3cb39aff921c298446bc375306a66102f
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
source "http://rubygems.org"
2
2
3
3
gem "simplecov"
4
- gem "hirb"
4
+ gem "terminal-table"
5
5
gem "ansi"
6
6
7
7
group :development do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.5.0
data/lib/simplecov-console.rb CHANGED
@@ -1,15 +1,19 @@
1
- require 'hirb'
1
+ require 'terminal-table'
2
2
require 'ansi/code'
3
3
4
4
class SimpleCov::Formatter::Console
5
5
6
- VERSION = File.new(File.join(File.expand_path(File.dirname(__FILE__)), "../VERSION")).read.strip
6
+ VERSION = IO.read(File.expand_path("../../VERSION", __FILE__)).strip
7
7
8
- ATTRIBUTES = [:table_options]
8
+ ATTRIBUTES = [:table_options, :use_colors]
9
9
class << self
10
10
attr_accessor(*ATTRIBUTES)
11
11
end
12
12
13
+ # enable colors unless NO_COLOR=1
14
+ SimpleCov::Formatter::Console.use_colors =
15
+ (ENV['NO_COLOR'].nil? or ENV['NO_COLOR'].empty?) ? true : false
16
+
13
17
def format(result)
14
18
15
19
root = nil
@@ -48,11 +52,13 @@ class SimpleCov::Formatter::Console
48
52
end
49
53
50
54
table = files.map do |f|
51
- { :coverage => pct(f),
52
- :lines => f.lines_of_code,
53
- :file => f.filename.gsub(root + "/", ''),
54
- :missed => f.missed_lines.count,
55
- :missing => missed(f.missed_lines).join(", ") }
55
+ [
56
+ colorize(pct(f)),
57
+ f.filename.gsub(root + "/", ''),
58
+ f.lines_of_code,
59
+ f.missed_lines.count,
60
+ missed(f.missed_lines).join(", ")
61
+ ]
56
62
end
57
63
58
64
if table.size > 15 then
@@ -61,10 +67,14 @@ class SimpleCov::Formatter::Console
61
67
end
62
68
63
69
table_options = SimpleCov::Formatter::Console.table_options || {}
70
+ if !table_options.kind_of?(Hash) then
71
+ raise ArgumentError.new("SimpleCov::Formatter::Console.table_options must be a Hash")
72
+ end
73
+ headings = %w{ coverage file lines missed missing }
64
74
65
- s = Hirb::Helpers::Table.render(table, table_options).split(/\n/)
66
- s.pop
67
- puts s.join("\n").gsub(/\d+\.\d+%/) { |m| colorize(m) }
75
+ opts = table_options.merge({:headings => headings, :rows => table})
76
+ t = Terminal::Table.new(opts)
77
+ puts t
68
78
69
79
if covered_files > 0 then
70
80
puts "#{covered_files} file(s) with 100% coverage not shown"
@@ -104,7 +114,13 @@ class SimpleCov::Formatter::Console
104
114
sprintf("%6.2f%%", obj.covered_percent)
105
115
end
106
116
117
+ def use_colors?
118
+ SimpleCov::Formatter::Console.use_colors
119
+ end
120
+
107
121
def colorize(s)
122
+ return s if !use_colors?
123
+
108
124
s =~ /([\d.]+)/
109
125
n = $1.to_f
110
126
if n >= 90 then
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.4.2 ruby lib
5
+ # stub: simplecov-console 0.5.0 ruby lib
6
6
7
7
Gem::Specification.new do |s|
8
8
s.name = "simplecov-console".freeze
9
- s.version = "0.4.2"
9
+ s.version = "0.5.0"
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 = "2017-06-21"
14
+ s.date = "2019-05-24"
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 = [
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
]
33
33
s.homepage = "http://github.com/chetan/simplecov-console".freeze
34
34
s.licenses = ["MIT".freeze]
35
- s.rubygems_version = "2.6.8".freeze
35
+ s.rubygems_version = "3.0.2".freeze
36
36
s.summary = "Simple console output formatter".freeze
37
37
38
38
if s.respond_to? :specification_version then
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
40
40
41
41
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
42
s.add_runtime_dependency(%q<simplecov>.freeze, [">= 0"])
43
- s.add_runtime_dependency(%q<hirb>.freeze, [">= 0"])
43
+ s.add_runtime_dependency(%q<terminal-table>.freeze, [">= 0"])
44
44
s.add_runtime_dependency(%q<ansi>.freeze, [">= 0"])
45
45
s.add_development_dependency(%q<minitest>.freeze, [">= 0"])
46
46
s.add_development_dependency(%q<yard>.freeze, [">= 0"])
@@ -48,7 +48,7 @@ Gem::Specification.new do |s|
48
48
s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
49
49
else
50
50
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
51
- s.add_dependency(%q<hirb>.freeze, [">= 0"])
51
+ s.add_dependency(%q<terminal-table>.freeze, [">= 0"])
52
52
s.add_dependency(%q<ansi>.freeze, [">= 0"])
53
53
s.add_dependency(%q<minitest>.freeze, [">= 0"])
54
54
s.add_dependency(%q<yard>.freeze, [">= 0"])
@@ -57,7 +57,7 @@ Gem::Specification.new do |s|
57
57
end
58
58
else
59
59
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
60
- s.add_dependency(%q<hirb>.freeze, [">= 0"])
60
+ s.add_dependency(%q<terminal-table>.freeze, [">= 0"])
61
61
s.add_dependency(%q<ansi>.freeze, [">= 0"])
62
62
s.add_dependency(%q<minitest>.freeze, [">= 0"])
63
63
s.add_dependency(%q<yard>.freeze, [">= 0"])
data/test/helper.rb CHANGED
@@ -1,25 +1,15 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require "simplecov"
11
- require "minitest/autorun"
12
1
13
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.push(File.expand_path("../../lib", __FILE__))
14
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
- require 'simplecov-console'
16
3
17
- class MiniTest::Test
18
- end
4
+ require "bundler/setup"
5
+ require "simplecov"
6
+ require "simplecov-console"
19
7
20
- SimpleCov.formatter = SimpleCov::Formatter::Console
21
8
SimpleCov.start do
22
- add_filter "/test/"
9
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
10
+ SimpleCov::Formatter::HTMLFormatter,
11
+ SimpleCov::Formatter::Console
12
+ ])
23
13
end
24
14
25
- MiniTest.autorun
15
+ require "minitest/autorun"
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.4.2
4
+ version: 0.5.0
5
5
platform: ruby
6
6
authors:
7
7
- Chetan Sarva
8
8
autorequire:
9
9
bindir: bin
10
10
cert_chain: []
11
- date: 2017-06-21 00:00:00.000000000 Z
11
+ date: 2019-05-24 00:00:00.000000000 Z
12
12
dependencies:
13
13
- !ruby/object:Gem::Dependency
14
14
name: simplecov
@@ -25,7 +25,7 @@ dependencies:
25
25
- !ruby/object:Gem::Version
26
26
version: '0'
27
27
- !ruby/object:Gem::Dependency
28
- name: hirb
28
+ name: terminal-table
29
29
requirement: !ruby/object:Gem::Requirement
30
30
requirements:
31
31
- - ">="
@@ -145,8 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
- !ruby/object:Gem::Version
146
146
version: '0'
147
147
requirements: []
148
- rubyforge_project:
148
+ rubygems_version: 3.0.2
149
- rubygems_version: 2.6.8
150
149
signing_key:
151
150
specification_version: 4
152
151
summary: Simple console output formatter