config 5.2.0 → 5.3.0

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: e9473a6dc953514afb09fbefa950f14cf7fe20e9cf461740e682404dc06ea726
4
- data.tar.gz: 2dcd6fb8e88fbc2b04c152a424ad4877804e0c7e5607fc4d1b9be6000b02bf92
3
+ metadata.gz: 777b7f8139564b25204ca8c3d375044d16d7ed58132d898493404f04133f7a22
4
+ data.tar.gz: 8ce204241f891f5cf9b2130d02c0d03c12999624dd6a12efc653462bc4e781f1
5
5
  SHA512:
6
- metadata.gz: '049ac670db93d0c93e7d3fe60688ae3edda405e9f28b67d2464d660ccd9a6dbbfd5d66e57d1d25b1b3fa763956d719e5fe252e7d5147e0bfc4da0f458b0f726f'
7
- data.tar.gz: 20774a5e9bfcbc377cd1969a133129b1259ccd9d211651312fce5e69a98999766ccb11ca1521e661f168086bfcd310f87840c141d2acd923b5fe708bf3fd8a26
6
+ metadata.gz: 143d0364fd88bfacfceb6032d82bdd7e8cf74179f4bef6b9439dc966e94692ebfd41c166a85b31dbfa052b57004cfbc91dccb6fb80646d23764ee5a9466f1902
7
+ data.tar.gz: a71272f604d882b05eab6958bddbb0aac72894dc62463668aaedcd3d98814d6eada6ab480cffd0679763bb0d8a125e792e7d02577b118a7771738dace0ad6af3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.3.0
4
+
5
+ * Remove `dry-validation` from dependencies ([#333](https://github.com/rubyconfig/config/pull/333))
6
+
3
7
  ## 5.2.0
4
8
 
5
9
  ### New features
data/config.gemspec CHANGED
@@ -1,6 +1,5 @@
1
- $:.push File.expand_path('../lib', __FILE__)
2
-
3
- require 'config/version'
1
+ require_relative 'lib/config/version'
2
+ require_relative 'lib/config/dry_validation_requirements'
4
3
 
5
4
  Gem::Specification.new do |s|
6
5
  s.name = 'config'
@@ -32,8 +31,8 @@ Donate: \e[34mhttps://opencollective.com/rubyconfig/donate\e[0m\n"
32
31
  s.required_ruby_version = '>= 2.6.0'
33
32
 
34
33
  s.add_dependency 'deep_merge', '~> 1.2', '>= 1.2.1'
35
- s.add_dependency 'dry-validation', '~> 1.0', '>= 1.0.0'
36
34
 
35
+ s.add_development_dependency 'dry-validation', *Config::DryValidationRequirements::VERSIONS
37
36
  s.add_development_dependency 'rake', '~> 12.0', '>= 12.0.0'
38
37
 
39
38
  # Testing
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Config
4
+ module DryValidationRequirements
5
+ VERSIONS = ['~> 1.0', '>= 1.0.0'].freeze
6
+
7
+ def self.load_dry_validation!
8
+ return if defined?(@load_dry_validation)
9
+
10
+ begin
11
+ require 'dry/validation/version'
12
+ version = Gem::Version.new(Dry::Validation::VERSION)
13
+ unless VERSIONS.all? { |req| Gem::Requirement.new(req).satisfied_by?(version) }
14
+ raise LoadError
15
+ end
16
+ rescue LoadError
17
+ raise ::Config::Error, 'Could not find a dry-validation version' \
18
+ ' matching requirements' \
19
+ " (#{VERSIONS.map(&:inspect) * ','})"
20
+ end
21
+
22
+ require 'dry/validation'
23
+ @load_dry_validation = true
24
+ nil
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,4 @@
1
+ module Config
2
+ class Error < StandardError
3
+ end
4
+ end
@@ -1,6 +1,8 @@
1
+ require_relative "../error"
2
+
1
3
  module Config
2
4
  module Validation
3
- class Error < StandardError
5
+ class Error < ::Config::Error
4
6
 
5
7
  def self.format(v_res)
6
8
  v_res.errors.group_by(&:path).map do |path, messages|
@@ -1,3 +1,6 @@
1
+ require_relative '../dry_validation_requirements'
2
+ require_relative '../error'
3
+
1
4
  module Config
2
5
  module Validation
3
6
  module Schema
@@ -9,7 +12,7 @@ module Config
9
12
  def schema(&block)
10
13
  if block_given?
11
14
  # Delay require until optional schema validation is requested
12
- require 'dry-validation'
15
+ Config::DryValidationRequirements.load_dry_validation!
13
16
  @schema = Dry::Schema.define(&block)
14
17
  else
15
18
  @schema
@@ -4,6 +4,10 @@ module Config
4
4
  module Validation
5
5
  module Validate
6
6
  def validate!
7
+ return unless Config.validation_contract || Config.schema
8
+
9
+ Config::DryValidationRequirements.load_dry_validation!
10
+
7
11
  validate_using!(Config.validation_contract)
8
12
  validate_using!(Config.schema)
9
13
  end
@@ -1,3 +1,3 @@
1
1
  module Config
2
- VERSION = '5.2.0'.freeze
2
+ VERSION = '5.3.0'.freeze
3
3
  end
data/lib/config.rb CHANGED
@@ -1,6 +1,6 @@
1
- require 'config/compatibility'
2
1
  require 'config/options'
3
2
  require 'config/configuration'
3
+ require 'config/dry_validation_requirements'
4
4
  require 'config/version'
5
5
  require 'config/sources/yaml_source'
6
6
  require 'config/sources/hash_source'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Kuczynski
@@ -42,7 +42,7 @@ dependencies:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
44
  version: 1.0.0
45
- type: :runtime
45
+ type: :development
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
48
48
  requirements:
@@ -236,8 +236,9 @@ files:
236
236
  - README.md
237
237
  - config.gemspec
238
238
  - lib/config.rb
239
- - lib/config/compatibility.rb
240
239
  - lib/config/configuration.rb
240
+ - lib/config/dry_validation_requirements.rb
241
+ - lib/config/error.rb
241
242
  - lib/config/integrations/heroku.rb
242
243
  - lib/config/integrations/rails/railtie.rb
243
244
  - lib/config/integrations/sinatra.rb
@@ -1,3 +0,0 @@
1
- if defined?(RbConfig) && defined?(Config)
2
- Object.send :remove_const, :Config
3
- end