covered 0.15.3 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 005b3a56275c6e1e796e3b12a76addd19e78675be9ae6cc773102f1a905cfdf1
4
- data.tar.gz: a2218c1566644a8ecdacc85f964712e59cf3b968067c1e44e66fd5e54319f5da
3
+ metadata.gz: bd761cd8a63400d76fbc57d7b12ecde5965e65d5f102e8e00922324fe1122211
4
+ data.tar.gz: 46f677a145a2000644179350e533c71afa918e7c189738e7e1885a7c825c898e
5
5
  SHA512:
6
- metadata.gz: 00d1fae46afb3f1d25bd5b7b7d121547a584d35479a4d16e0cd4a2a0d99f0f4cd35c2f0ccb8d90871d498a9dec4521accd31494d54532fd57af88ab645a6de1f
7
- data.tar.gz: 0df096a51adbaf5982cf5b738d311b43a8eccf7057df14e9eacf36640ad61316ca39bc25ca81603ab93379c6e1afac17126b1cd19833f3786ee0359d6d32e7b4
6
+ metadata.gz: 6877f782692afc1640bae6f6755fc5e68f7fdbcbe1e815ac7c255005dfbf7e523fa2fb4ff92aee45d65a5745dda502d1ad5bbedd0b2ae25d63335933a348eb7b
7
+ data.tar.gz: 631fa71834807f84cf3aac8b22803d3659ac1b3ac732e2ccf86f5a9e6096501e929b1a993d6eddec817dee18810f91453093d2261a57fa311055cf841b3da93f
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2022, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ require_relative 'policy'
24
+
25
+ module Covered
26
+ class Config
27
+ PATH = "config/covered.rb"
28
+
29
+ def self.path(root)
30
+ path = ::File.join(root, PATH)
31
+
32
+ if ::File.exist?(path)
33
+ return path
34
+ end
35
+ end
36
+
37
+ def self.load(root: Dir.pwd, coverage: ENV['COVERAGE'])
38
+ return nil unless coverage
39
+
40
+ derived = Class.new(self)
41
+
42
+ if path = self.path(root)
43
+ config = Module.new
44
+ config.module_eval(::File.read(path), path)
45
+ derived.prepend(config)
46
+ end
47
+
48
+ return derived.new(root, coverage)
49
+ end
50
+
51
+ def initialize(root, coverage)
52
+ @root = root
53
+ @coverage = coverage
54
+ @policy = nil
55
+ end
56
+
57
+ def policy
58
+ @policy ||= Policy.new.tap{|policy| make_policy(policy)}.freeze
59
+ end
60
+
61
+ def enable
62
+ policy.enable
63
+ end
64
+
65
+ def disable
66
+ policy.disable
67
+ end
68
+
69
+ def flush
70
+ policy.flush
71
+ end
72
+
73
+ def call(output)
74
+ policy.call(output)
75
+ end
76
+
77
+ # Override this method to implement your own policy.
78
+ def make_policy(policy)
79
+ policy.cache!
80
+
81
+ # Only files in the root would be tracked:
82
+ policy.root(@root)
83
+
84
+ # We will ignore any files in the test or spec directory:
85
+ policy.skip(/^.*\/(test|spec|vendor|config)\//)
86
+
87
+ # We will include all files under lib, even if they aren't loaded:
88
+ policy.include("lib/**/*.rb")
89
+
90
+ policy.persist!
91
+
92
+ policy.source
93
+
94
+ policy.reports!(@coverage)
95
+ end
96
+ end
97
+ end
@@ -19,10 +19,11 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  require_relative 'policy'
22
- require_relative 'policy/default'
23
22
 
24
23
  require 'minitest'
25
24
 
25
+ $covered = Covered::Config.load
26
+
26
27
  module Covered
27
28
  module Minitest
28
29
  def run(*)
@@ -33,7 +34,7 @@ module Covered
33
34
  end
34
35
  end
35
36
 
36
- if ENV['COVERAGE']
37
+ if $covered
37
38
  class << Minitest
38
39
  prepend Covered::Minitest
39
40
  end
@@ -26,16 +26,6 @@ require_relative "cache"
26
26
  require_relative "persist"
27
27
 
28
28
  module Covered
29
- def self.policy(&block)
30
- policy = Policy.new
31
-
32
- policy.instance_eval(&block)
33
-
34
- policy.freeze
35
-
36
- return policy
37
- end
38
-
39
29
  class Policy < Wrapper
40
30
  def initialize
41
31
  super(Files.new)
@@ -132,7 +122,7 @@ module Covered
132
122
  end
133
123
  end
134
124
 
135
- def reports!(coverage = ENV['COVERAGE'])
125
+ def reports!(coverage)
136
126
  if coverage
137
127
  names = coverage.split(',')
138
128
 
data/lib/covered/rspec.rb CHANGED
@@ -18,11 +18,12 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- require_relative 'policy'
22
- require_relative 'policy/default'
21
+ require_relative 'config'
23
22
 
24
23
  require 'rspec/core/formatters'
25
24
 
25
+ $covered = Covered::Config.load
26
+
26
27
  module Covered
27
28
  module RSpec
28
29
  class Formatter
@@ -56,7 +57,7 @@ module Covered
56
57
  end
57
58
  end
58
59
 
59
- if ENV['COVERAGE']
60
+ if $covered
60
61
  RSpec::Core::Configuration.prepend(Covered::RSpec::Policy)
61
62
 
62
63
  RSpec.configure do |config|
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Covered
22
- VERSION = "0.15.3"
22
+ VERSION = "0.16.0"
23
23
  end
data.tar.gz.sig CHANGED
@@ -1,2 +1,5 @@
1
- iW��1 �y#\tE��6�l&Ϗ�_
2
- M̷�E����<�GXm\[$(��3c+�}nt���,3/a ��J }*XZV�H=:�7���U�{�����J�
1
+
2
+ Tiz/�8'����B��T4Txns~�����"h#��~L�&�L�
3
+ ��ӵf����V��g^Jl�&�d����-״4V���ƥ
4
+ �O��m�A�4K���O�6��H���i�H&u��9`�M y�@�z��7P<s��c+�2)+�D
5
+ C�f�|/y���������ޤ�"����C��,�p9G��qa(?�N]bg��vV��k��$ᓒ_l�tHiz�z�q�94 ��K��J��w(�1�p#�祙� ����q �a�q�IE�6�A
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: covered
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.3
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -39,7 +39,7 @@ cert_chain:
39
39
  RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
40
40
  HiLJ8VOFx6w=
41
41
  -----END CERTIFICATE-----
42
- date: 2022-06-13 00:00:00.000000000 Z
42
+ date: 2022-06-14 00:00:00.000000000 Z
43
43
  dependencies:
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: async-rest
@@ -163,6 +163,7 @@ files:
163
163
  - lib/covered.rb
164
164
  - lib/covered/cache.rb
165
165
  - lib/covered/capture.rb
166
+ - lib/covered/config.rb
166
167
  - lib/covered/coverage.rb
167
168
  - lib/covered/coveralls.rb
168
169
  - lib/covered/files.rb
@@ -170,7 +171,6 @@ files:
170
171
  - lib/covered/minitest.rb
171
172
  - lib/covered/persist.rb
172
173
  - lib/covered/policy.rb
173
- - lib/covered/policy/default.rb
174
174
  - lib/covered/rspec.rb
175
175
  - lib/covered/source.rb
176
176
  - lib/covered/statistics.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,44 +0,0 @@
1
- # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
20
-
21
- require_relative '../policy'
22
-
23
- if File.exist?("config/coverage.rb")
24
- load("config/coverage.rb")
25
- else
26
- $covered = Covered.policy do
27
- cache!
28
-
29
- # Only files in the root would be tracked:
30
- root(Dir.pwd)
31
-
32
- # We will ignore any files in the test or spec directory:
33
- skip(/^.*\/(test|spec|vendor)\//)
34
-
35
- # We will include all files under lib, even if they aren't loaded:
36
- include("lib/**/*.rb")
37
-
38
- persist!
39
-
40
- source
41
-
42
- reports!
43
- end
44
- end