confset 1.0.3 → 1.1.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: ee921fe4009d09cc7bc14c73f8b8b92c34362519dc1f7c45d22ebfbdbbd672fc
4
- data.tar.gz: 075edbaa190b9a44f9b0d772c73430bc19bf3cf6223d7849571d37d073fb19c6
3
+ metadata.gz: 8a370ca26c32a42b9eb9cd17d98e99a1450db5a73f2e53f11222f2757bfac588
4
+ data.tar.gz: '035569d155fb88697b03d4d4659b5e061540ef34585f25fad5455a5091211ac9'
5
5
  SHA512:
6
- metadata.gz: 907c3c7a16e7c4b6c78295b7ecb61c01680a8b21978bbf5c20895b87628fbf3c5892884fccf29b2342851e4c6e758dcbaa1f6f99667442eacf949e4e0418c148
7
- data.tar.gz: 1f048671f6c483c98f84ca081c699a019414110fa062f2d9a9ccf839585b824c84e6f41a3434d4e05e3a61c57641db49dd5056c17a45938b84de00ee78dd4085
6
+ metadata.gz: 03c4a9c04f00ea925439156dd409c2f7e15c69c9861be8deeb9b9cb154a6e72b73059362ac839783d212c9f8cef4d8464c44bf256feae69971b9ae800be1984c
7
+ data.tar.gz: 7a503890c049a3f9fd44a57f97a95333ac72ea7c977266842145cbcd5f4cbf537454d7f142d4d334af6e7c55e717e594de4d9559b60971279dab54de23cce4a6
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.1.0] - 2023-10-13
11
+
12
+ ### Changed
13
+
14
+ #### Breaking Changes
15
+
16
+ - `config` no longer loads `deep_merge`'s monkey patch for `Hash#deep_merge` and Hash#deep_merge!`([#342](https://github.com/rubyconfig/config/pull/342)). If you rely on those methods and are not using Rails / Active Support, you can load the monkey patch via`require 'deep_merge/deep_merge_hash'` by @jonathanhefner
17
+
18
+ ### Fixed
19
+
20
+ - Address edge case with table config param (#339) by @krasnoukhov
21
+
10
22
  ## [1.0.3] - 2023-02-17
11
23
 
12
24
  ### Changed
@@ -26,8 +38,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
38
  ### Changed
27
39
 
28
40
  - Only load Railtie integration if Rails::Railtie is defined
29
- [rubyconfig#31](https://github.com/rubyconfig/config/pull/319) - Thanks to Ufuk
30
- Kayserilioglu <ufuk.kayserilioglu@shopify.com>
41
+ [rubyconfig#31](https://github.com/rubyconfig/config/pull/319) - Thanks to Ufuk
42
+ Kayserilioglu <ufuk.kayserilioglu@shopify.com>
31
43
  - CHANGELOG.md pattern changed to the [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
32
44
 
33
45
  ## [1.0.1] - 2022-05-30
@@ -35,7 +47,7 @@ Kayserilioglu <ufuk.kayserilioglu@shopify.com>
35
47
  ### Fixed
36
48
 
37
49
  - Avoid to crash the Rails application when there is an error
38
- parsing a variable <https://github.com/dcotecnologia/confset/pull/5>
50
+ parsing a variable <https://github.com/dcotecnologia/confset/pull/5>
39
51
 
40
52
  ## [1.0.0] - 2022-05-27
41
53
 
@@ -43,9 +55,9 @@ parsing a variable <https://github.com/dcotecnologia/confset/pull/5>
43
55
 
44
56
  - Initial release
45
57
  - Refac the project focusing on the newer versions of the
46
- Ruby language and Ruby on Rails.
58
+ Ruby language and Ruby on Rails.
47
59
 
48
- ---------------------
60
+ ---
49
61
 
50
62
  You can find the full changelog of the original "config" gem at the link
51
63
  <https://github.com/rubyconfig/config/blob/master/CHANGELOG.md>.
@@ -114,7 +114,7 @@ module Confset
114
114
  end
115
115
 
116
116
  # Some keywords that don't play nicely with OpenStruct
117
- SETTINGS_RESERVED_NAMES = %w[select collect test count zip min max exit!].freeze
117
+ SETTINGS_RESERVED_NAMES = %w[select collect test count zip min max exit! table].freeze
118
118
 
119
119
  # An alternative mechanism for property access.
120
120
  # This let's you do foo['bar'] along with foo.bar.
@@ -134,11 +134,11 @@ module Confset
134
134
  end
135
135
 
136
136
  def key?(key)
137
- table.key?(key)
137
+ @table.key?(key)
138
138
  end
139
139
 
140
140
  def has_key?(key)
141
- table.has_key?(key)
141
+ @table.has_key?(key)
142
142
  end
143
143
 
144
144
  def method_missing(method_name, *args)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Confset
4
- VERSION = "1.0.3"
4
+ VERSION = "1.1.0"
5
5
  end
data/lib/confset.rb CHANGED
@@ -7,7 +7,7 @@ require "confset/sources/yaml_source"
7
7
  require "confset/sources/hash_source"
8
8
  require "confset/sources/env_source"
9
9
  require "confset/validation/schema"
10
- require "deep_merge"
10
+ require "deep_merge/core"
11
11
 
12
12
  module Confset
13
13
  extend Confset::Validation::Schema
@@ -5,3 +5,4 @@ zip: cherry
5
5
  max: kumquat
6
6
  min: fig
7
7
  exit!: taro
8
+ table: strawberry
data/spec/options_spec.rb CHANGED
@@ -20,6 +20,7 @@ describe Confset::Options do
20
20
  expect(config.max).to eq("kumquat")
21
21
  expect(config.min).to eq("fig")
22
22
  expect(config.exit!).to eq("taro")
23
+ expect(config.table).to eq("strawberry")
23
24
  end
24
25
 
25
26
  it "should allow to access them using [] operator" do
@@ -30,6 +31,7 @@ describe Confset::Options do
30
31
  expect(config["max"]).to eq("kumquat")
31
32
  expect(config["min"]).to eq("fig")
32
33
  expect(config["exit!"]).to eq("taro")
34
+ expect(config["table"]).to eq("strawberry")
33
35
 
34
36
  expect(config[:select]).to eq("apple")
35
37
  expect(config[:collect]).to eq("banana")
@@ -38,6 +40,26 @@ describe Confset::Options do
38
40
  expect(config[:max]).to eq("kumquat")
39
41
  expect(config[:min]).to eq("fig")
40
42
  expect(config[:exit!]).to eq("taro")
43
+ expect(config[:table]).to eq("strawberry")
44
+ end
45
+ end
46
+
47
+ context "when empty" do
48
+ let(:config) do
49
+ Confset.load_files("#{fixture_path}/empty1.yml")
50
+ end
51
+
52
+ it "should allow to access them via object member notation" do
53
+ expect(config.select).to be_nil
54
+ expect(config.table).to be_nil
55
+ end
56
+
57
+ it "should allow to access them using [] operator" do
58
+ expect(config["select"]).to be_nil
59
+ expect(config["table"]).to be_nil
60
+
61
+ expect(config[:select]).to be_nil
62
+ expect(config[:table]).to be_nil
41
63
  end
42
64
  end
43
65
 
data/spec/spec_helper.rb CHANGED
@@ -10,6 +10,7 @@ Dir["./spec/support/**/*.rb"].each { |f| require f }
10
10
  RSpec.configure do |config|
11
11
  # Turn the deprecation warnings into errors, giving you the full backtrace
12
12
  config.raise_errors_for_deprecations!
13
+ config.include FixtureHelper
13
14
 
14
15
  config.before(:suite) do
15
16
  Confset.module_eval do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confset
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Carolino
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2023-02-17 00:00:00.000000000 Z
14
+ date: 2023-10-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: deep_merge
@@ -39,7 +39,7 @@ dependencies:
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '1.0'
42
+ version: 1.10.0
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
45
  version: 1.0.0
@@ -49,7 +49,7 @@ dependencies:
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '1.0'
52
+ version: 1.10.0
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: 1.0.0
@@ -60,6 +60,9 @@ dependencies:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: 3.12.0
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 3.12.0
63
66
  type: :development
64
67
  prerelease: false
65
68
  version_requirements: !ruby/object:Gem::Requirement
@@ -67,20 +70,23 @@ dependencies:
67
70
  - - "~>"
68
71
  - !ruby/object:Gem::Version
69
72
  version: 3.12.0
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 3.12.0
70
76
  - !ruby/object:Gem::Dependency
71
77
  name: rake
72
78
  requirement: !ruby/object:Gem::Requirement
73
79
  requirements:
74
80
  - - "~>"
75
81
  - !ruby/object:Gem::Version
76
- version: 13.0.6
82
+ version: '13.0'
77
83
  type: :development
78
84
  prerelease: false
79
85
  version_requirements: !ruby/object:Gem::Requirement
80
86
  requirements:
81
87
  - - "~>"
82
88
  - !ruby/object:Gem::Version
83
- version: 13.0.6
89
+ version: '13.0'
84
90
  - !ruby/object:Gem::Dependency
85
91
  name: simplecov
86
92
  requirement: !ruby/object:Gem::Requirement
@@ -101,14 +107,14 @@ dependencies:
101
107
  requirements:
102
108
  - - "~>"
103
109
  - !ruby/object:Gem::Version
104
- version: 0.12.0
110
+ version: 0.13.0
105
111
  type: :development
106
112
  prerelease: false
107
113
  version_requirements: !ruby/object:Gem::Requirement
108
114
  requirements:
109
115
  - - "~>"
110
116
  - !ruby/object:Gem::Version
111
- version: 0.12.0
117
+ version: 0.13.0
112
118
  - !ruby/object:Gem::Dependency
113
119
  name: pry
114
120
  requirement: !ruby/object:Gem::Requirement
@@ -129,14 +135,14 @@ dependencies:
129
135
  requirements:
130
136
  - - "~>"
131
137
  - !ruby/object:Gem::Version
132
- version: 1.45.1
138
+ version: 1.57.1
133
139
  type: :development
134
140
  prerelease: false
135
141
  version_requirements: !ruby/object:Gem::Requirement
136
142
  requirements:
137
143
  - - "~>"
138
144
  - !ruby/object:Gem::Version
139
- version: 1.45.1
145
+ version: 1.57.1
140
146
  - !ruby/object:Gem::Dependency
141
147
  name: rubocop-packaging
142
148
  requirement: !ruby/object:Gem::Requirement
@@ -251,7 +257,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
251
257
  requirements:
252
258
  - - ">="
253
259
  - !ruby/object:Gem::Version
254
- version: 2.7.0
260
+ version: 3.0.0
255
261
  required_rubygems_version: !ruby/object:Gem::Requirement
256
262
  requirements:
257
263
  - - ">="