complex_config 0.22.0 → 0.22.1
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 +4 -4
- data/CHANGES.md +16 -0
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/complex_config.gemspec +3 -4
- data/lib/complex_config/settings.rb +5 -1
- data/lib/complex_config/version.rb +1 -1
- data/spec/complex_config/config_spec.rb +0 -1
- data/spec/complex_config/plugins_spec.rb +0 -1
- data/spec/complex_config/settings_spec.rb +13 -5
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d25e925267a755f28ea324b3ed2f43d737659124e097ae52ac48bd87aedd9173
|
4
|
+
data.tar.gz: f68858a3bba577915b3d602093363f1143b29be84cfe42f4ac4c64056baa5551
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9cb2d7480057aa2685952e8c272c8a10245664c0e30fbdf83d76c1fd5c2ff196eb84bec265baa5fae19283acdcb9efd5c25e90721e40df4fe185fa5c2273bf9
|
7
|
+
data.tar.gz: 463827352c5df8655b58ea371c57733b78aa2a00ca28ac0e77516cb2b7edaf43919f5b5c93cf27e32d3add7d8eec53b8204af9b862871ba3d9a0037220ce34ae
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## 2024-09-22 v0.22.1
|
4
|
+
|
5
|
+
#### Bug Fixes and Improvements
|
6
|
+
|
7
|
+
* Refactor ComplexConfig settings and specs to handle nil values:
|
8
|
+
* Added `nil` handling in `ComplexConfig::Settings`
|
9
|
+
* Updated `settings_spec.rb` to test for `nil` values
|
10
|
+
* Update dependencies and date in gemspec files:
|
11
|
+
- Removed development dependency `'utils'` from Rakefile.
|
12
|
+
- Updated date in `complex_config.gemspec` from "2024-09-13" to "2024-09-22"
|
13
|
+
|
14
|
+
* Bumped version to **0.22.1**:
|
15
|
+
- Updated `VERSION` in `lib/complex_config/version.rb` from **0.22.0** to **0.22.1**
|
16
|
+
- Updated `s.version` in `complex_config.gemspec` from **0.22.0** to **0.22.1**
|
17
|
+
- Updated gem stub version in `complex_config.gemspec` from **0.22.0** to **0.22.1**
|
18
|
+
|
3
19
|
## 2024-09-12 v0.22.0
|
4
20
|
|
5
21
|
* **New Feature: UTF-8 Support**
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.22.
|
1
|
+
0.22.1
|
data/complex_config.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: complex_config 0.22.
|
2
|
+
# stub: complex_config 0.22.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "complex_config".freeze
|
6
|
-
s.version = "0.22.
|
6
|
+
s.version = "0.22.1".freeze
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Florian Frank".freeze]
|
11
|
-
s.date = "2024-09-
|
11
|
+
s.date = "2024-09-22"
|
12
12
|
s.description = "This library allows you to access configuration files via a simple interface".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
14
|
s.executables = ["complex_config".freeze]
|
@@ -28,7 +28,6 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
|
29
29
|
s.add_development_dependency(%q<rspec>.freeze, [">= 0".freeze])
|
30
30
|
s.add_development_dependency(%q<monetize>.freeze, [">= 0".freeze])
|
31
|
-
s.add_development_dependency(%q<utils>.freeze, [">= 0".freeze])
|
32
31
|
s.add_development_dependency(%q<debug>.freeze, [">= 0".freeze])
|
33
32
|
s.add_runtime_dependency(%q<json>.freeze, [">= 0".freeze])
|
34
33
|
s.add_runtime_dependency(%q<tins>.freeze, [">= 0".freeze])
|
@@ -104,7 +104,11 @@ class ComplexConfig::Settings < BasicObject
|
|
104
104
|
if ::Array === v
|
105
105
|
v.to_ary.map { |x| (x.ask_and_send(:to_h) rescue x) || x }
|
106
106
|
elsif v.respond_to?(:to_h)
|
107
|
-
v.
|
107
|
+
if v.nil?
|
108
|
+
nil
|
109
|
+
else
|
110
|
+
v.ask_and_send(:to_h) rescue v
|
111
|
+
end
|
108
112
|
else
|
109
113
|
v
|
110
114
|
end
|
@@ -19,7 +19,8 @@ RSpec.describe ComplexConfig::Settings do
|
|
19
19
|
bar: {
|
20
20
|
baz: true
|
21
21
|
},
|
22
|
-
|
22
|
+
nix: nil,
|
23
|
+
qux: 'quux',
|
23
24
|
}
|
24
25
|
]
|
25
26
|
obj.name_prefix = 'root'
|
@@ -69,7 +70,7 @@ RSpec.describe ComplexConfig::Settings do
|
|
69
70
|
end
|
70
71
|
|
71
72
|
it 'can display its attribute_names' do
|
72
|
-
expect(settings.foo.attribute_names).to eq [
|
73
|
+
expect(settings.foo.attribute_names).to eq %i[ bar nix qux ]
|
73
74
|
end
|
74
75
|
|
75
76
|
it 'can display its attribute_values' do
|
@@ -83,19 +84,21 @@ RSpec.describe ComplexConfig::Settings do
|
|
83
84
|
end
|
84
85
|
|
85
86
|
it 'can be converted into a hash' do
|
86
|
-
expect(settings.foo.to_h).to eq(bar: { baz: true }, qux: 'quux')
|
87
|
+
expect(settings.foo.to_h).to eq(bar: { baz: true }, nix: nil, qux: 'quux')
|
87
88
|
end
|
88
89
|
|
89
90
|
it 'can return a hash with pathes as keys' do
|
90
91
|
expect(settings.pathes(path_sep: ?:)).to eq(
|
91
92
|
'root:foo:bar:baz' => true,
|
92
|
-
'root:foo:
|
93
|
+
'root:foo:nix' => nil,
|
94
|
+
'root:foo:qux' => "quux",
|
93
95
|
)
|
94
96
|
end
|
95
97
|
|
96
98
|
it 'can be listed as string' do
|
97
99
|
expect(settings.attributes_list(pair_sep: ' → ', path_sep: ?/)).to eq <<~EOT
|
98
100
|
root/foo/bar/baz → true
|
101
|
+
root/foo/nix → nil
|
99
102
|
root/foo/qux → "quux"
|
100
103
|
EOT
|
101
104
|
end
|
@@ -108,6 +111,7 @@ RSpec.describe ComplexConfig::Settings do
|
|
108
111
|
settings[:ary] = described_class[ [ 1, { nested: 2 }, 3 ] ]
|
109
112
|
expect(settings.attributes_list).to eq <<~EOT
|
110
113
|
root.foo.bar.baz = true
|
114
|
+
root.foo.nix = nil
|
111
115
|
root.foo.qux = "quux"
|
112
116
|
root.ary[0] = 1
|
113
117
|
root.ary[1].nested = 2
|
@@ -122,6 +126,7 @@ RSpec.describe ComplexConfig::Settings do
|
|
122
126
|
├─ foo
|
123
127
|
│ ├─ bar
|
124
128
|
│ │ └─ baz = true
|
129
|
+
│ ├─ nix = nil
|
125
130
|
│ └─ qux = "quux"
|
126
131
|
└─ ary
|
127
132
|
├─ 1
|
@@ -138,6 +143,7 @@ RSpec.describe ComplexConfig::Settings do
|
|
138
143
|
└─ foo
|
139
144
|
├─ bar
|
140
145
|
│ └─ baz = true
|
146
|
+
├─ nix = nil
|
141
147
|
└─ qux = "quux"
|
142
148
|
EOT
|
143
149
|
settings.pretty_print(q)
|
@@ -150,6 +156,7 @@ RSpec.describe ComplexConfig::Settings do
|
|
150
156
|
`- foo
|
151
157
|
+- bar
|
152
158
|
| `- baz = true
|
159
|
+
+- nix = nil
|
153
160
|
`- qux = "quux"
|
154
161
|
EOT
|
155
162
|
ENV['LANG'] = 'de_DE.ISO8859-15'
|
@@ -162,12 +169,13 @@ RSpec.describe ComplexConfig::Settings do
|
|
162
169
|
:foo:
|
163
170
|
:bar:
|
164
171
|
:baz: true
|
172
|
+
:nix:
|
165
173
|
:qux: quux
|
166
174
|
EOT
|
167
175
|
end
|
168
176
|
|
169
177
|
it 'can be converted into JSON' do
|
170
|
-
expect(settings.to_json).to eq '{"foo":{"bar":{"baz":true},"qux":"quux"}}'
|
178
|
+
expect(settings.to_json).to eq '{"foo":{"bar":{"baz":true},"nix":null,"qux":"quux"}}'
|
171
179
|
end
|
172
180
|
|
173
181
|
it 'raises exception if expected attribute is missing' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: complex_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.22.
|
4
|
+
version: 0.22.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: utils
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: debug
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|