covered 0.25.1 → 0.26.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: 374bfc6095d15b4908cd4faa5d3027742446cd4cb42e40c39a613d181c3d8e14
4
- data.tar.gz: 53a805a6c2a9df4d2a869054a43389935213e757eaa0308b0c967f0fa88fd34e
3
+ metadata.gz: 0b3b51e8cda089a57c22c3ef8e75f7f0da473883048f2526c343eeaff2b96578
4
+ data.tar.gz: a4ae054e1b15e1c4a0398c2bd2aaa4ee2291fab2d4f3315eaf8e0772b6e5921c
5
5
  SHA512:
6
- metadata.gz: 88832afe00019b3e76230e13a4eeb933b3f891e1bdc81f8c164783eae2bec7cb2fec8badffdecc61cebf2a9da8de019bb10c1a67c21ff423200deaf666e3f9dd
7
- data.tar.gz: bf5c8da4e3fc34ca72915e1e5e2ca157deb329f3ebe498280ad2c70e73343997df29b1a04b22df22bdc08c1d11716221bbbe9f9dd27938d0170ef51eb58b3742
6
+ metadata.gz: 1e841ed5b73e93b103adae84f250f43e204b75d8acb3de82ef4ec0dc6ef10a2db8c7c28cf00cad3a094678480bf07f7a4425e0f6284ea481f0e70c1ed68f7baa
7
+ data.tar.gz: 6e9b2dab1f92cf567126d20ea2ec77dfd7c8959ac397b1f73cfd3793d91fc7672408452ef4cf345962e55425ea13014de79a9b16f0978fbc2156a43ac2a0746d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2022-2023, by Samuel Williams.
4
+ # Copyright, 2022-2024, by Samuel Williams.
5
5
 
6
6
  def initialize(context)
7
7
  super
@@ -15,7 +15,6 @@ end
15
15
  # @parameter execute [Boolean] Whether to execute the code.
16
16
  def parse(paths: [], execute: false)
17
17
  files = output = Covered::Files.new
18
- output = Covered::Source.new(output)
19
18
 
20
19
  paths.each do |path|
21
20
  output.mark(path, 0, 0)
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2023, by Samuel Williams.
4
+ # Copyright, 2023-2024, by Samuel Williams.
5
+ # Copyright, 2023, by Michael Adams.
5
6
 
6
7
  def initialize(context)
7
8
  super
@@ -12,7 +13,7 @@ end
12
13
  # Load the current coverage policy.
13
14
  # Defaults to the default coverage path if no paths are specified.
14
15
  # @parameter paths [Array(String)] The coverage database paths.
15
- def current(paths: nil)
16
+ def current(paths: nil, reports: Covered::Config.reports)
16
17
  policy = Covered::Policy.new
17
18
 
18
19
  # Load the default path if no paths are specified:
@@ -29,6 +30,10 @@ def current(paths: nil)
29
30
  Covered::Persist.new(policy.output, path).load!(ignore_mtime: true)
30
31
  end
31
32
 
33
+ if reports
34
+ policy.reports!(reports)
35
+ end
36
+
32
37
  return policy
33
38
  end
34
39
 
@@ -26,6 +26,8 @@ def validate(paths: nil, minimum: 1.0, input:)
26
26
  # Print statistics:
27
27
  statistics.print($stderr)
28
28
 
29
+ policy.call(STDOUT)
30
+
29
31
  # Validate statistics and raise an error if they are not met:
30
32
  statistics.validate!(minimum)
31
33
  end
@@ -21,11 +21,11 @@ module Covered
21
21
  end
22
22
  end
23
23
 
24
- def self.coverage
24
+ def self.reports
25
25
  ENV['COVERAGE']
26
26
  end
27
27
 
28
- def self.load(root: self.root, coverage: self.coverage)
28
+ def self.load(root: self.root, reports: self.reports)
29
29
  derived = Class.new(self)
30
30
 
31
31
  if path = self.path(root)
@@ -34,19 +34,19 @@ module Covered
34
34
  derived.prepend(config)
35
35
  end
36
36
 
37
- return derived.new(root, coverage)
37
+ return derived.new(root, reports)
38
38
  end
39
39
 
40
- def initialize(root, coverage)
40
+ def initialize(root, reports)
41
41
  @root = root
42
- @coverage = coverage
42
+ @reports = reports
43
43
  @policy = nil
44
44
 
45
45
  @environment = nil
46
46
  end
47
47
 
48
48
  def report?
49
- !!@coverage
49
+ !!@reports
50
50
  end
51
51
 
52
52
  alias :record? :report?
@@ -61,6 +61,7 @@ module Covered
61
61
  policy.output
62
62
  end
63
63
 
64
+ # Start coverage tracking.
64
65
  def start
65
66
  # Save and setup the environment:
66
67
  @environment = ENV.to_h
@@ -70,6 +71,7 @@ module Covered
70
71
  policy.start
71
72
  end
72
73
 
74
+ # Finish coverage tracking.
73
75
  def finish
74
76
  # Finish coverage tracking:
75
77
  policy.finish
@@ -79,6 +81,8 @@ module Covered
79
81
  @environment = nil
80
82
  end
81
83
 
84
+ # Generate coverage reports to the given output.
85
+ # @param output [IO] The output stream to write the coverage report to.
82
86
  def call(output)
83
87
  policy.call(output)
84
88
  end
@@ -87,10 +91,18 @@ module Covered
87
91
  policy.each(&block)
88
92
  end
89
93
 
94
+ # Which paths to ignore when computing coverage for a given project.
95
+ # @returns [Array(String)] An array of relative paths to ignore.
90
96
  def ignore_paths
91
97
  ['test/', 'fixtures/', 'spec/', 'vendor/', 'config/']
92
98
  end
93
99
 
100
+ # Which paths to include when computing coverage for a given project.
101
+ # @returns [Array(String)] An array of relative patterns to include, e.g. `"lib/**/*.rb"`.
102
+ def include_patterns
103
+ ["lib/**/*.rb"]
104
+ end
105
+
94
106
  # Override this method to implement your own policy.
95
107
  def make_policy(policy)
96
108
  # Only files in the root would be tracked:
@@ -104,11 +116,13 @@ module Covered
104
116
  policy.skip(Regexp.union(patterns))
105
117
 
106
118
  # We will include all files under lib, even if they aren't loaded:
107
- policy.include("lib/**/*.rb")
119
+ include_patterns.each do |pattern|
120
+ policy.include(pattern)
121
+ end
108
122
 
109
123
  policy.persist!
110
124
 
111
- policy.reports!(@coverage)
125
+ policy.reports!(@reports)
112
126
  end
113
127
 
114
128
  protected
@@ -101,9 +101,9 @@ module Covered
101
101
  end
102
102
  end
103
103
 
104
- def reports!(coverage)
105
- if coverage.is_a?(String)
106
- names = coverage.split(',')
104
+ def reports!(reports)
105
+ if reports.is_a?(String)
106
+ names = reports.split(',')
107
107
 
108
108
  names.each do |name|
109
109
  begin
@@ -113,8 +113,14 @@ module Covered
113
113
  @reports << Autoload.new(name)
114
114
  end
115
115
  end
116
- elsif coverage
116
+ elsif reports == true
117
117
  @reports << Covered::BriefSummary.new
118
+ elsif reports == false
119
+ @reports.clear
120
+ elsif reports.is_a?(Array)
121
+ @reports.concat(reports)
122
+ else
123
+ @reports << reports
118
124
  end
119
125
  end
120
126
 
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2018-2023, by Samuel Williams.
5
5
 
6
6
  module Covered
7
- VERSION = "0.25.1"
7
+ VERSION = "0.26.0"
8
8
  end
data/license.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2018-2023, by Samuel Williams.
3
+ Copyright, 2018-2024, by Samuel Williams.
4
4
  Copyright, 2018, by Shannon Skipper.
5
5
  Copyright, 2019, by Cyril Roelandt.
6
6
  Copyright, 2022, by Adam Daniels.
7
7
  Copyright, 2022, by Felix Yan.
8
8
  Copyright, 2023, by Stephen Ierodiaconou.
9
+ Copyright, 2023, by Michael Adams.
9
10
 
10
11
  Permission is hereby granted, free of charge, to any person obtaining a copy
11
12
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -11,8 +11,7 @@ into Ruby.
11
11
  platforms.
12
12
  - Supports coverage of views - templates compiled to Ruby code can be tracked for coverage reporting.
13
13
 
14
- [![Development
15
- Status](https://github.com/ioquatix/covered/workflows/Test/badge.svg)](https://github.com/ioquatix/covered/actions?workflow=Test)
14
+ [![Development Status](https://github.com/ioquatix/covered/workflows/Test/badge.svg)](https://github.com/ioquatix/covered/actions?workflow=Test)
16
15
 
17
16
  ## Motivation
18
17
 
@@ -25,10 +24,11 @@ After this concept prooved useful, [it was integrated directly into Ruby](https:
25
24
 
26
25
  ## Usage
27
26
 
28
- Please see the [project documentation](https://github.com/ioquatix/covered) for more details.
27
+ Please see the [project documentation](https://ioquatix.github.io/covered/) for more details.
29
28
 
30
- - [Getting Started](https://github.com/ioquatix/coveredguides/getting-started/index) - This guide explains how to get
31
- started with `covered` and integrate it with your test suite.
29
+ - [Getting Started](https://ioquatix.github.io/covered/guides/getting-started/index) - This guide explains how to get started with `covered` and integrate it with your test suite.
30
+
31
+ - [Configuration](https://ioquatix.github.io/covered/guides/configuration/index) - This guide will help you to configure covered for your project's specific requirements.
32
32
 
33
33
  ## See Also
34
34
 
@@ -48,10 +48,8 @@ We welcome contributions to this project.
48
48
 
49
49
  ### Developer Certificate of Origin
50
50
 
51
- This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this
52
- project must agree to this document to have their contributions accepted.
51
+ This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
53
52
 
54
53
  ### Contributor Covenant
55
54
 
56
- This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and
57
- participants agree to abide by its terms.
55
+ This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: covered
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.1
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - Adam Daniels
9
9
  - Cyril Roelandt
10
10
  - Felix Yan
11
+ - Michael Adams
11
12
  - Shannon Skipper
12
13
  - Stephen Ierodiaconou
13
14
  autorequire:
@@ -42,7 +43,7 @@ cert_chain:
42
43
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
43
44
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
44
45
  -----END CERTIFICATE-----
45
- date: 2023-10-29 00:00:00.000000000 Z
46
+ date: 2024-07-11 00:00:00.000000000 Z
46
47
  dependencies:
47
48
  - !ruby/object:Gem::Dependency
48
49
  name: console
@@ -105,7 +106,9 @@ homepage: https://github.com/ioquatix/covered
105
106
  licenses:
106
107
  - MIT
107
108
  metadata:
109
+ documentation_uri: https://ioquatix.github.io/covered/
108
110
  funding_uri: https://github.com/sponsors/ioquatix/
111
+ source_code_uri: https://github.com/ioquatix/covered.git
109
112
  post_install_message:
110
113
  rdoc_options: []
111
114
  require_paths:
@@ -114,14 +117,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
117
  requirements:
115
118
  - - ">="
116
119
  - !ruby/object:Gem::Version
117
- version: '3.0'
120
+ version: '3.1'
118
121
  required_rubygems_version: !ruby/object:Gem::Requirement
119
122
  requirements:
120
123
  - - ">="
121
124
  - !ruby/object:Gem::Version
122
125
  version: '0'
123
126
  requirements: []
124
- rubygems_version: 3.4.10
127
+ rubygems_version: 3.5.11
125
128
  signing_key:
126
129
  specification_version: 4
127
130
  summary: A modern approach to code coverage.
metadata.gz.sig CHANGED
Binary file