complex_config 0.20.0 → 0.21.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 +4 -4
- data/.all_images.yml +1 -1
- data/CHANGES.md +372 -0
- data/README.md +24 -1
- data/Rakefile +3 -1
- data/VERSION +1 -1
- data/complex_config.gemspec +7 -7
- data/config/products.yml +20 -1
- data/lib/complex_config/provider.rb +1 -0
- data/lib/complex_config/settings.rb +5 -0
- data/lib/complex_config/tree.rb +80 -0
- data/lib/complex_config/version.rb +1 -1
- data/lib/complex_config.rb +1 -0
- data/spec/complex_config/provider_spec.rb +6 -0
- data/spec/complex_config/settings_spec.rb +29 -11
- data/spec/config/empty_config.yml +0 -0
- data/spec/spec_helper.rb +1 -1
- metadata +10 -6
- /data/{COPYING → LICENSE} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 432209a0d29d4d47874c82ebe27f311e3a545b1aac932bcf31e0307f8b3dc1fb
|
4
|
+
data.tar.gz: 6ed546fc3bbb9032503dc501c7d8350e145255756ca5cbcea18c10758e982577
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7a1a956b49424098d206442242850356de73db068d715d1d9bcfa0659cb336043d6d65af530c7ef0c6d7a021a91122bcaf2baba1998bbc49c0ea7266b582b55
|
7
|
+
data.tar.gz: c07a01e3c26ce55862c34a9b42caff05dfa7ed7730be92684eb1eacd335f4badf82c2dcaabe042429610ba4ac3324a2b62b3903dc8c89e428568e4fa230ffe16
|
data/.all_images.yml
CHANGED
data/CHANGES.md
ADDED
@@ -0,0 +1,372 @@
|
|
1
|
+
# Changes
|
2
|
+
|
3
|
+
## 2024-09-09 v0.21.0
|
4
|
+
|
5
|
+
* **Tree Representation**:
|
6
|
+
+ Add `Tree` class to convert complex config objects into trees.
|
7
|
+
+ Update `Settings` class to use `Tree` conversion in `to_tree` method.
|
8
|
+
+ Update tests to reflect changes.
|
9
|
+
* **Components Array**: Add components array for flux capacitors
|
10
|
+
* **Rakefile and Gemspec**:
|
11
|
+
- Add clobber task for coverage to Rakefile
|
12
|
+
- Update all_images script: update `bundle` to `bundle install --full-index`
|
13
|
+
* **.gitignore**: Remove `.byebug_history` from ignored files
|
14
|
+
* **Complex Config**:
|
15
|
+
+ Raise type error and add test for empty configuration file.
|
16
|
+
+ Update gemspec to use GemHadar 1.17.0
|
17
|
+
+ Add requirement for tins/xt/ask_and_send in complex_config/provider.rb
|
18
|
+
+ Add check for hash type in ComplexConfig::Settings#build method
|
19
|
+
+ Add test for reading from empty configuration file in provider_spec.rb
|
20
|
+
+ Replace byebug with debug in spec_helper.rb
|
21
|
+
|
22
|
+
## 2024-04-17 v0.20.0
|
23
|
+
|
24
|
+
#### Significant Changes
|
25
|
+
|
26
|
+
* **Add dependency to base64**: The code now depends on the `base64` library,
|
27
|
+
which will be extracted from Ruby 3.4.
|
28
|
+
* **Upgrade ruby and add debug gem**: The project has been upgraded to use a
|
29
|
+
newer version of Ruby and includes the `debug` gem for debugging purposes.
|
30
|
+
* **Use newest ruby, drop the older 2.5 version**: The code now targets the
|
31
|
+
latest version of Ruby and no longer supports Ruby 2.5.
|
32
|
+
|
33
|
+
#### Other Changes
|
34
|
+
|
35
|
+
* Run specs: The project now runs its specifications as part of its build
|
36
|
+
process.
|
37
|
+
* Test on newest ruby, on older ones don't: The project's tests are now run
|
38
|
+
only on the latest version of Ruby, with older versions being skipped.
|
39
|
+
* Align: The code has been aligned to follow best practices.
|
40
|
+
|
41
|
+
## 2022-07-11 v0.19.4
|
42
|
+
|
43
|
+
* **Configuration File Handling Improvements**
|
44
|
+
+ Replaced defaulting to `unsafe_load` with explicit usage, ensuring safer
|
45
|
+
handling of configuration files.
|
46
|
+
|
47
|
+
## 2022-05-19 v0.19.3
|
48
|
+
|
49
|
+
* **New Feature**: Pass parameters to json generator, allowing for more dynamic
|
50
|
+
and customizable JSON output.
|
51
|
+
* **Improvement**: Use `all_images` for testing, improving the robustness and
|
52
|
+
accuracy of image-related tests.
|
53
|
+
|
54
|
+
## 2021-10-28 v0.19.2
|
55
|
+
|
56
|
+
* **New Psych Support**
|
57
|
+
+ Added support for newest Psych 4 library
|
58
|
+
+ Defaults to disabling YAML alias feature
|
59
|
+
* **Psych API Update**
|
60
|
+
+ Updated code to use new Psych/YAML API when Psych version < 4
|
61
|
+
+ Retained behavior of evaluating aliases
|
62
|
+
* **Ruby Version Bump**
|
63
|
+
+ Updated Ruby version in tool-versions to 3.0.2
|
64
|
+
|
65
|
+
## 2021-04-09 v0.19.1
|
66
|
+
|
67
|
+
* **Breaking Change**: Updated code to adapt to the new keyword interface of
|
68
|
+
ERB for Ruby versions greater than or equal to 3.
|
69
|
+
|
70
|
+
## 2021-01-05 v0.19.0
|
71
|
+
|
72
|
+
* Added two new methods:
|
73
|
+
+ `get_attribute_by_name`
|
74
|
+
+ `get_attributes_by_name`
|
75
|
+
|
76
|
+
## 2020-08-26 v0.18.2
|
77
|
+
|
78
|
+
* **Bug Fix**: Resolved a similar issue, mirroring the fix introduced in
|
79
|
+
version 0.18.1.
|
80
|
+
|
81
|
+
## 2020-08-26 v0.18.1
|
82
|
+
|
83
|
+
* **New Feature**: Added support for faking data, allowing users to simulate
|
84
|
+
scenarios without actual data.
|
85
|
+
+ Implemented a new module `FakeIt` with methods for generating fake data.
|
86
|
+
+ Updated relevant tests to include fake data scenarios.
|
87
|
+
|
88
|
+
## 2020-01-07 v0.18.0
|
89
|
+
|
90
|
+
* **New Version Summary**
|
91
|
+
+ Added support for Ruby 2.7.0
|
92
|
+
+ Updated tests to include Ruby 2.7.0
|
93
|
+
+ Refactored code to avoid string modifications
|
94
|
+
* Significant Changes:
|
95
|
+
* Support added for Ruby 2.7.0
|
96
|
+
* Tests updated to include Ruby 2.7.0
|
97
|
+
* String modification stopped
|
98
|
+
|
99
|
+
## 2019-11-27 v0.17.1
|
100
|
+
|
101
|
+
* **Shared Settings Implementation**: The code now uses a more sane and
|
102
|
+
efficient approach for shared settings.
|
103
|
+
|
104
|
+
## 2019-03-18 v0.17.0
|
105
|
+
|
106
|
+
* **Decoding Fix**: Corrected the decoding issue to ensure proper data
|
107
|
+
interpretation.
|
108
|
+
|
109
|
+
## 2019-03-18 v0.16.2
|
110
|
+
|
111
|
+
* **New Feature**: Added support for handling complex scenarios
|
112
|
+
+ Implemented a new logic to handle intricate cases
|
113
|
+
* Improved error handling and reporting
|
114
|
+
+ Enhanced logging to provide more detailed information about errors
|
115
|
+
* Minor code refactoring
|
116
|
+
+ Simplified some conditional statements
|
117
|
+
|
118
|
+
## 2019-03-18 v0.16.1
|
119
|
+
|
120
|
+
* Improved error message for missing encryption key:
|
121
|
+
+ Added more informative and user-friendly error message when encryption
|
122
|
+
key is not provided.
|
123
|
+
|
124
|
+
## 2019-03-14 v0.16.0
|
125
|
+
|
126
|
+
* **New Features**
|
127
|
+
+ Added support for `trim_mode` in legacy mode
|
128
|
+
+ Enabled `trim_mode` by default
|
129
|
+
+ Added `#to_json` method to settings objects
|
130
|
+
* **Changes**
|
131
|
+
+ Updated code to use new `trim_mode` feature
|
132
|
+
+ Modified settings objects to include `#to_json` method
|
133
|
+
|
134
|
+
## 2019-03-14 v0.15.1
|
135
|
+
|
136
|
+
* **Fix**: Shared feature now works correctly even when the top-level settings
|
137
|
+
are empty.
|
138
|
+
|
139
|
+
## 2018-12-07 v0.15.0
|
140
|
+
|
141
|
+
* **New Feature**: Allow recrypting a file in-place with options.
|
142
|
+
+ Added functionality to enable recrypting a file without creating a new
|
143
|
+
copy.
|
144
|
+
|
145
|
+
## 2018-12-07 v0.14.1
|
146
|
+
|
147
|
+
* **New Version**: Bumped version
|
148
|
+
* **Improved Error Handling**:
|
149
|
+
+ Improved error handling if key isn't valid
|
150
|
+
+ Raises `ComplexConfig::DecryptionFailed` for encrypted files
|
151
|
+
* **Compatibility**:
|
152
|
+
+ Make this run on older rubies
|
153
|
+
* **Documentation**:
|
154
|
+
+ Cleanup documentation
|
155
|
+
* **RubyGems**:
|
156
|
+
+ Use newest rubygems
|
157
|
+
|
158
|
+
## 2018-06-07 v0.14.0
|
159
|
+
|
160
|
+
* Added `complex_config` executable to handle configuration files.
|
161
|
+
|
162
|
+
## 2018-02-23 v0.13.3
|
163
|
+
|
164
|
+
* **Changes in Evaluation Order**
|
165
|
+
+ The evaluation order of key sources has been modified.
|
166
|
+
|
167
|
+
## 2018-02-23 v0.13.2
|
168
|
+
|
169
|
+
* **Compatibility improvements**
|
170
|
+
+ Be compatible with ancient rubies^3
|
171
|
+
+ Be compatible with ancient rubies^2
|
172
|
+
+ Be compatible with ancient rubies
|
173
|
+
* **Refactoring**
|
174
|
+
+ Refactor key provision with source object
|
175
|
+
|
176
|
+
## 2018-02-09 v0.13.1
|
177
|
+
|
178
|
+
* **New Features**
|
179
|
+
+ Added information to README file
|
180
|
+
* **Significant Changes**
|
181
|
+
+ Bumped version number
|
182
|
+
+ Improved error reporting for encrypted files with missing keys
|
183
|
+
|
184
|
+
## 2018-01-26 v0.13.0
|
185
|
+
|
186
|
+
* Improved the `write_config` interface
|
187
|
+
* Added more tests
|
188
|
+
|
189
|
+
## 2017-11-17 v0.12.2
|
190
|
+
|
191
|
+
* **Output string keys on top level configs**:
|
192
|
+
* Added functionality to output string keys on top level configurations.
|
193
|
+
|
194
|
+
## 2017-11-17 v0.12.1
|
195
|
+
|
196
|
+
* **New Feature**: Suppress newline output during encryption.
|
197
|
+
|
198
|
+
## 2017-11-16 v0.12.0
|
199
|
+
|
200
|
+
* **New Features**
|
201
|
+
+ Add support for writing configurations (encrypted or not)
|
202
|
+
* **Version Bump**
|
203
|
+
+ Bump version to 0.12.0
|
204
|
+
* **Compatibility Improvements**
|
205
|
+
+ Support older Rubies
|
206
|
+
|
207
|
+
## 2017-11-02 v0.11.3
|
208
|
+
|
209
|
+
* **New Feature:** Added striping functionality.
|
210
|
+
* **Bug Fix:** Fixed issue where caches were not cleared when `deep_freeze` was
|
211
|
+
disabled.
|
212
|
+
|
213
|
+
## 2017-10-30 v0.11.2
|
214
|
+
|
215
|
+
* **Behavioral Fix**:
|
216
|
+
* Fixed the behavior for incomplete key setup.
|
217
|
+
|
218
|
+
## 2017-10-27 v0.11.1
|
219
|
+
|
220
|
+
* Added support for shared features.
|
221
|
+
|
222
|
+
## 2017-10-27 v0.11.0
|
223
|
+
|
224
|
+
* **New Feature**: Support for encrypted YAML files, compatible with Rails'
|
225
|
+
encryption.
|
226
|
+
* **Test Update**: Added testing to ensure compatibility with Ruby 2.4.2.
|
227
|
+
|
228
|
+
## 2017-02-02 v0.10.0
|
229
|
+
|
230
|
+
## 2017-01-23 v0.9.2
|
231
|
+
|
232
|
+
* **New Version**: Released version 0.9.2.
|
233
|
+
* **Performance Improvement**:
|
234
|
+
+ Memoized proxy object for improved performance.
|
235
|
+
|
236
|
+
## 2016-11-23 v0.9.1
|
237
|
+
|
238
|
+
* **New Features**
|
239
|
+
+ Use newest RubyGems
|
240
|
+
+ Test on Ruby 2.3.3
|
241
|
+
* **Bug Fixes**
|
242
|
+
+ Fix Travis builds
|
243
|
+
+ travis fiddles with RAILS_ENV variable, breaking specs (resolved)
|
244
|
+
* **Testing Improvements**
|
245
|
+
+ Test newer Rubies
|
246
|
+
|
247
|
+
## 2016-11-22 v0.9.0
|
248
|
+
|
249
|
+
* **Gem Update**: Updated to newest gem_hadar.
|
250
|
+
* **Coverage Report**: Only send new coverage report on success.
|
251
|
+
* **Manual Run**: We are supposed to run this manually now.
|
252
|
+
* **Code Organization**: Moved provider shortcuts into its own module.
|
253
|
+
|
254
|
+
## 2016-07-27 v0.8.0
|
255
|
+
|
256
|
+
* **New Feature**: Added support for replacing attributes in
|
257
|
+
`ComplexConfig::Settings` using the `#replace_attributes` method.
|
258
|
+
|
259
|
+
## 2016-07-18 v0.7.0
|
260
|
+
|
261
|
+
* **New Features**
|
262
|
+
+ Added new date functionality
|
263
|
+
* **Improvements**
|
264
|
+
+ Simplified `ComplexConfig::Settings` interface by basing it on
|
265
|
+
`BasicObject` and reducing mixin usage
|
266
|
+
* **Documentation**
|
267
|
+
+ Updated README.md with new changes
|
268
|
+
|
269
|
+
## 2016-07-15 v0.6.0
|
270
|
+
|
271
|
+
* **Caching Improvements**
|
272
|
+
+ Use `mize` for caching
|
273
|
+
|
274
|
+
## 2016-06-23 v0.5.2
|
275
|
+
|
276
|
+
* **Index Access Feature**
|
277
|
+
+ Fixed issue with incorrect indexing behavior (#56190d3)
|
278
|
+
+ Improved performance and reliability of index access functionality
|
279
|
+
|
280
|
+
## 2016-06-23 v0.5.1
|
281
|
+
|
282
|
+
* **New Features**
|
283
|
+
+ Resolve index access via the plugin code path, making `foo.bar` and
|
284
|
+
`foo[:bar]` equivalent for a plugin key.
|
285
|
+
+ Test on Ruby 2.3.1 and 2.4.0-preview1
|
286
|
+
* **Infrastructure Changes**
|
287
|
+
+ Use new infrastructure
|
288
|
+
* **Bug Fixes**
|
289
|
+
+ Fix typo
|
290
|
+
|
291
|
+
## 2015-11-19 v0.5.0
|
292
|
+
|
293
|
+
* **New Features**
|
294
|
+
+ Add configure method
|
295
|
+
+ Add configuration example to README
|
296
|
+
* **Bug Fixes**
|
297
|
+
+ Flush cache for every request in rails development
|
298
|
+
+ Change the Changes
|
299
|
+
* **Improvements**
|
300
|
+
+ Just always skip to avoid interference
|
301
|
+
|
302
|
+
## 2015-11-17 v0.4.0
|
303
|
+
|
304
|
+
* **New Feature:** Implemented root object method call syntax.
|
305
|
+
|
306
|
+
## 2015-11-03 v0.3.1
|
307
|
+
|
308
|
+
* **New Features**
|
309
|
+
+ Add missing tins dependency
|
310
|
+
+ Show improved settings output in README.md
|
311
|
+
+ Adds a decent string representation for ComplexConfig::Settings objects
|
312
|
+
* **Dependency Updates**
|
313
|
+
+ Use newest gem hadar
|
314
|
+
+ Add some development_dependencies (including tins)
|
315
|
+
* **Code Improvements**
|
316
|
+
+ Shorten codeclimate snippet
|
317
|
+
|
318
|
+
## 2015-03-24 v0.3.0
|
319
|
+
|
320
|
+
## 2015-03-24 v0.2.3
|
321
|
+
|
322
|
+
* **Typo Fix**: Corrected a typo in the `LoadErro(r)` method.
|
323
|
+
* **JRuby Update**: Updated JRuby version to use `jruby-head` and allowed it to
|
324
|
+
potentially fail.
|
325
|
+
|
326
|
+
## 2015-02-25 v0.2.2
|
327
|
+
|
328
|
+
* Removed unnecessary `sprintf` format.
|
329
|
+
|
330
|
+
## 2015-01-28 v0.2.1
|
331
|
+
|
332
|
+
* **New Version**:
|
333
|
+
* Added support for JRuby test target
|
334
|
+
* Removed always broken jruby-head
|
335
|
+
* Bumped version number to 0.2.0
|
336
|
+
* Bumped version to 0.2.1
|
337
|
+
* **Plugin Changes**:
|
338
|
+
* Skip the money plugin if monetize cannot be loaded (optional runtime
|
339
|
+
dependency)
|
340
|
+
* Remove require for plugins, allowing users to use the gem without requiring
|
341
|
+
the money gem
|
342
|
+
* Fixed requiring *with* plugins, enabling them to load correctly
|
343
|
+
|
344
|
+
## 2015-01-27 v0.2.0
|
345
|
+
|
346
|
+
* **New Features**
|
347
|
+
+ Added support for JRuby in tests
|
348
|
+
+ Updated to newest Ruby 2.2
|
349
|
+
* **Improvements**
|
350
|
+
+ Replaced mixin with delegation for Enumerable, allowing attribute names
|
351
|
+
like `zip`, `min`, or `max` without conflicts
|
352
|
+
* **Documentation**
|
353
|
+
+ Added Apache license file
|
354
|
+
|
355
|
+
## 2015-01-01 v0.1.1
|
356
|
+
|
357
|
+
* **New Version Summary**
|
358
|
+
+ Use value from non-associative list arrays
|
359
|
+
+ Fix `puts` method to call `to_ary` correctly
|
360
|
+
+ Prevent cash leakage after flushing cache
|
361
|
+
+ Add `to_ary` method for level on demand
|
362
|
+
|
363
|
+
## 2014-12-15 v0.1.0
|
364
|
+
|
365
|
+
* **Significant Changes**:
|
366
|
+
+ Freeze cached configuration by default (versioning)
|
367
|
+
+ Add to-do list for future development
|
368
|
+
+ Integrate CodeClimate for code analysis and improvement
|
369
|
+
|
370
|
+
## 2014-12-12 v0.0.0
|
371
|
+
|
372
|
+
* Start
|
data/README.md
CHANGED
@@ -30,21 +30,40 @@ Given a config file like this and named `config/products.yml`
|
|
30
30
|
name: Flux Capacitor Version 2.0
|
31
31
|
price_in_cents: 12_000_00
|
32
32
|
manual_pdf_url: "http://brown-inc.com/manuals/fc_20.pdf"
|
33
|
+
components:
|
34
|
+
- Miniature Chrono-Levitation Chamber (mCLC)
|
35
|
+
- Single Gravitational Displacement Coil (SGDC)
|
36
|
+
- Simple Quantum Flux Transducer (SQFT)
|
37
|
+
- Basic Time-Space Navigation System (BTN)
|
33
38
|
pro_version:
|
34
39
|
name: Flux Capacitor Professional
|
35
40
|
price_in_cents: 23_000_00
|
36
41
|
manual_pdf_url: "http://brown-inc.com/manuals/fc_pro.pdf"
|
42
|
+
components:
|
43
|
+
- Advanced Chrono-Levitation Chamber (ACL)
|
44
|
+
- Dual Gravitational Displacement Coils (DGDCs)
|
45
|
+
- Advanced Quantum Flux Transducer (AQFT)
|
46
|
+
- Professional Time-Space Navigation System (PTNS)
|
37
47
|
enterprise_version:
|
38
48
|
name: Flux Capacitor Enterpise
|
39
49
|
price_in_cents: 1_600_000_00
|
40
50
|
manual_pdf_url: "http://brown-inc.com/manuals/fc_enterprise.pdf"
|
41
|
-
|
51
|
+
components:
|
52
|
+
- Super-Advanced Chrono-Levitation Chamber (SACL)
|
53
|
+
- Quadruple Gravitational Displacement Coils (QGDCs)
|
54
|
+
- Ultra-Advanced Quantum Flux Transducer (UAQFT)
|
55
|
+
- Enterprise Time-Space Navigation System (ETNS)
|
42
56
|
test:
|
43
57
|
flux_capacitor:
|
44
58
|
test_version:
|
45
59
|
name: Yadayada
|
46
60
|
price_in_cents: 6_66
|
47
61
|
manual_pdf_url: "http://staging.brown-inc.com/manuals/fc_10.pdf"
|
62
|
+
components:
|
63
|
+
- Experimental Chrono-Levitation Chamber (ECLC)
|
64
|
+
- Modular Gravitational Displacement Coils (MGDCs)
|
65
|
+
- Variable Quantum Flux Transducer (VQFT)
|
66
|
+
- Development Time-Space Navigation System (DTNS)
|
48
67
|
|
49
68
|
and using `require "complex_config/rude"` in the `"development"` environment you
|
50
69
|
can now access the configuration.
|
@@ -82,6 +101,10 @@ You can also fetch config settings from a different environment:
|
|
82
101
|
products.flux_capacitor.test_version.name = "Yadayada"
|
83
102
|
products.flux_capacitor.test_version.price_in_cents = 666
|
84
103
|
products.flux_capacitor.test_version.manual_pdf_url = "http://staging.brown-inc.com/manuals/fc_10.pdf"
|
104
|
+
products.flux_capacitor.test_version.components[0] = "Experimental Chrono-Levitation Chamber (ECLC)"
|
105
|
+
products.flux_capacitor.test_version.components[1] = "Modular Gravitational Displacement Coils (MGDCs)"
|
106
|
+
products.flux_capacitor.test_version.components[2] = "Variable Quantum Flux Transducer (VQFT)"
|
107
|
+
products.flux_capacitor.test_version.components[3] = "Development Time-Space Navigation System (DTNS)"
|
85
108
|
|
86
109
|
Calling `complex_config.products.` instead of `cc(…)` would skip the implicite
|
87
110
|
namespacing via the `RAILS_ENV` environment, so
|
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ GemHadar do
|
|
12
12
|
executables 'complex_config'
|
13
13
|
test_dir 'spec'
|
14
14
|
ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', 'coverage', '.rvmrc',
|
15
|
-
'.AppleDouble', '.DS_Store', '
|
15
|
+
'.AppleDouble', '.DS_Store', 'errors.lst', 'tags'
|
16
16
|
package_ignore '.all_images', '.utilsrc', '.rspec', '.tool-versions',
|
17
17
|
'.gitignore'
|
18
18
|
|
@@ -20,6 +20,8 @@ GemHadar do
|
|
20
20
|
title "#{name.camelize} -- configuration library"
|
21
21
|
licenses << 'Apache-2.0'
|
22
22
|
|
23
|
+
clobber 'coverage'
|
24
|
+
|
23
25
|
dependency 'json'
|
24
26
|
dependency 'tins'
|
25
27
|
dependency 'mize', '~> 0.3', '>= 0.3.4'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.21.0
|
data/complex_config.gemspec
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: complex_config 0.
|
2
|
+
# stub: complex_config 0.21.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "complex_config".freeze
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.21.0".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-
|
11
|
+
s.date = "2024-09-09"
|
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]
|
15
|
-
s.extra_rdoc_files = ["README.md".freeze, "lib/complex_config.rb".freeze, "lib/complex_config/config.rb".freeze, "lib/complex_config/encryption.rb".freeze, "lib/complex_config/errors.rb".freeze, "lib/complex_config/key_source.rb".freeze, "lib/complex_config/plugins.rb".freeze, "lib/complex_config/plugins/enable.rb".freeze, "lib/complex_config/plugins/money.rb".freeze, "lib/complex_config/plugins/uri.rb".freeze, "lib/complex_config/provider.rb".freeze, "lib/complex_config/provider/shortcuts.rb".freeze, "lib/complex_config/proxy.rb".freeze, "lib/complex_config/railtie.rb".freeze, "lib/complex_config/rude.rb".freeze, "lib/complex_config/settings.rb".freeze, "lib/complex_config/shortcuts.rb".freeze, "lib/complex_config/version.rb".freeze]
|
16
|
-
s.files = [".all_images.yml".freeze, "
|
15
|
+
s.extra_rdoc_files = ["README.md".freeze, "lib/complex_config.rb".freeze, "lib/complex_config/config.rb".freeze, "lib/complex_config/encryption.rb".freeze, "lib/complex_config/errors.rb".freeze, "lib/complex_config/key_source.rb".freeze, "lib/complex_config/plugins.rb".freeze, "lib/complex_config/plugins/enable.rb".freeze, "lib/complex_config/plugins/money.rb".freeze, "lib/complex_config/plugins/uri.rb".freeze, "lib/complex_config/provider.rb".freeze, "lib/complex_config/provider/shortcuts.rb".freeze, "lib/complex_config/proxy.rb".freeze, "lib/complex_config/railtie.rb".freeze, "lib/complex_config/rude.rb".freeze, "lib/complex_config/settings.rb".freeze, "lib/complex_config/shortcuts.rb".freeze, "lib/complex_config/tree.rb".freeze, "lib/complex_config/version.rb".freeze]
|
16
|
+
s.files = [".all_images.yml".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/complex_config".freeze, "complex_config.gemspec".freeze, "config/products.yml".freeze, "lib/complex_config.rb".freeze, "lib/complex_config/config.rb".freeze, "lib/complex_config/encryption.rb".freeze, "lib/complex_config/errors.rb".freeze, "lib/complex_config/key_source.rb".freeze, "lib/complex_config/plugins.rb".freeze, "lib/complex_config/plugins/enable.rb".freeze, "lib/complex_config/plugins/money.rb".freeze, "lib/complex_config/plugins/uri.rb".freeze, "lib/complex_config/provider.rb".freeze, "lib/complex_config/provider/shortcuts.rb".freeze, "lib/complex_config/proxy.rb".freeze, "lib/complex_config/railtie.rb".freeze, "lib/complex_config/rude.rb".freeze, "lib/complex_config/settings.rb".freeze, "lib/complex_config/shortcuts.rb".freeze, "lib/complex_config/tree.rb".freeze, "lib/complex_config/version.rb".freeze, "spec/complex_config/config_spec.rb".freeze, "spec/complex_config/encryption_spec.rb".freeze, "spec/complex_config/key_source_spec.rb".freeze, "spec/complex_config/plugins_spec.rb".freeze, "spec/complex_config/provider_spec.rb".freeze, "spec/complex_config/settings_spec.rb".freeze, "spec/complex_config/shortcuts_spec.rb".freeze, "spec/config/broken_config.yml".freeze, "spec/config/config.yml".freeze, "spec/config/config_with_alias.yml".freeze, "spec/config/empty_config.yml".freeze, "spec/config/legacy_classes.yml".freeze, "spec/config/master.key".freeze, "spec/config/with-key-file.yml.enc".freeze, "spec/config/with-key-file.yml.key".freeze, "spec/config/without-key-file.yml.enc".freeze, "spec/spec_helper.rb".freeze]
|
17
17
|
s.homepage = "https://github.com/flori/complex_config".freeze
|
18
18
|
s.licenses = ["Apache-2.0".freeze]
|
19
19
|
s.rdoc_options = ["--title".freeze, "ComplexConfig -- configuration library".freeze, "--main".freeze, "README.md".freeze]
|
20
|
-
s.rubygems_version = "3.5.
|
20
|
+
s.rubygems_version = "3.5.18".freeze
|
21
21
|
s.summary = "configuration library".freeze
|
22
22
|
s.test_files = ["spec/complex_config/config_spec.rb".freeze, "spec/complex_config/encryption_spec.rb".freeze, "spec/complex_config/key_source_spec.rb".freeze, "spec/complex_config/plugins_spec.rb".freeze, "spec/complex_config/provider_spec.rb".freeze, "spec/complex_config/settings_spec.rb".freeze, "spec/complex_config/shortcuts_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
23
23
|
|
24
24
|
s.specification_version = 4
|
25
25
|
|
26
|
-
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.
|
26
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.17.0".freeze])
|
27
27
|
s.add_development_dependency(%q<rake>.freeze, [">= 0".freeze])
|
28
28
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
|
29
29
|
s.add_development_dependency(%q<rspec>.freeze, [">= 0".freeze])
|
data/config/products.yml
CHANGED
@@ -4,18 +4,37 @@ development:
|
|
4
4
|
name: Flux Capacitor Version 2.0
|
5
5
|
price_in_cents: 12_000_00
|
6
6
|
manual_pdf_url: "http://brown-inc.com/manuals/fc_20.pdf"
|
7
|
+
components:
|
8
|
+
- Miniature Chrono-Levitation Chamber (mCLC)
|
9
|
+
- Single Gravitational Displacement Coil (SGDC)
|
10
|
+
- Simple Quantum Flux Transducer (SQFT)
|
11
|
+
- Basic Time-Space Navigation System (BTN)
|
7
12
|
pro_version:
|
8
13
|
name: Flux Capacitor Professional
|
9
14
|
price_in_cents: 23_000_00
|
10
15
|
manual_pdf_url: "http://brown-inc.com/manuals/fc_pro.pdf"
|
16
|
+
components:
|
17
|
+
- Advanced Chrono-Levitation Chamber (ACL)
|
18
|
+
- Dual Gravitational Displacement Coils (DGDCs)
|
19
|
+
- Advanced Quantum Flux Transducer (AQFT)
|
20
|
+
- Professional Time-Space Navigation System (PTNS)
|
11
21
|
enterprise_version:
|
12
22
|
name: Flux Capacitor Enterpise
|
13
23
|
price_in_cents: 1_600_000_00
|
14
24
|
manual_pdf_url: "http://brown-inc.com/manuals/fc_enterprise.pdf"
|
15
|
-
|
25
|
+
components:
|
26
|
+
- Super-Advanced Chrono-Levitation Chamber (SACL)
|
27
|
+
- Quadruple Gravitational Displacement Coils (QGDCs)
|
28
|
+
- Ultra-Advanced Quantum Flux Transducer (UAQFT)
|
29
|
+
- Enterprise Time-Space Navigation System (ETNS)
|
16
30
|
test:
|
17
31
|
flux_capacitor:
|
18
32
|
test_version:
|
19
33
|
name: Yadayada
|
20
34
|
price_in_cents: 6_66
|
21
35
|
manual_pdf_url: "http://staging.brown-inc.com/manuals/fc_10.pdf"
|
36
|
+
components:
|
37
|
+
- Experimental Chrono-Levitation Chamber (ECLC)
|
38
|
+
- Modular Gravitational Displacement Coils (MGDCs)
|
39
|
+
- Variable Quantum Flux Transducer (VQFT)
|
40
|
+
- Development Time-Space Navigation System (DTNS)
|
@@ -28,6 +28,7 @@ class ComplexConfig::Settings < BasicObject
|
|
28
28
|
|
29
29
|
def build(name, hash)
|
30
30
|
name.nil? or self.name_prefix = name.to_sym
|
31
|
+
hash.respond_to?(:to_hash) or raise TypeError, 'require hash to build'
|
31
32
|
from_hash(hash)
|
32
33
|
ensure
|
33
34
|
self.name_prefix = nil
|
@@ -122,6 +123,10 @@ class ComplexConfig::Settings < BasicObject
|
|
122
123
|
to_h.to_json(*a)
|
123
124
|
end
|
124
125
|
|
126
|
+
def to_tree
|
127
|
+
::ComplexConfig::Tree.convert(name_prefix, self)
|
128
|
+
end
|
129
|
+
|
125
130
|
def size
|
126
131
|
each.count
|
127
132
|
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module ComplexConfig
|
2
|
+
class Tree
|
3
|
+
def self.convert(name, value)
|
4
|
+
case value
|
5
|
+
when ComplexConfig::Settings
|
6
|
+
convert(name, value.to_h)
|
7
|
+
when Hash
|
8
|
+
obj = new(name.to_s)
|
9
|
+
value.each do |name, value|
|
10
|
+
obj << convert(name, value)
|
11
|
+
end
|
12
|
+
obj
|
13
|
+
when Array
|
14
|
+
obj = new(name.to_s)
|
15
|
+
value.each_with_index do |value, i|
|
16
|
+
obj << convert(i, value)
|
17
|
+
end
|
18
|
+
obj
|
19
|
+
else
|
20
|
+
if name.is_a?(Integer)
|
21
|
+
new value.inspect
|
22
|
+
else
|
23
|
+
new "#{name} = #{value.inspect}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(name)
|
29
|
+
@name = name
|
30
|
+
@children = []
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def inner_child_prefix(i)
|
36
|
+
i.zero? ? "├─ " : "│ "
|
37
|
+
end
|
38
|
+
|
39
|
+
def last_child_prefix(i)
|
40
|
+
i.zero? ? "└─ " : " "
|
41
|
+
end
|
42
|
+
|
43
|
+
public
|
44
|
+
|
45
|
+
def to_enum
|
46
|
+
Enumerator.new do |y|
|
47
|
+
y.yield @name
|
48
|
+
|
49
|
+
@children.each_with_index do |child, child_index|
|
50
|
+
children_enum = child.to_enum
|
51
|
+
if child_index < @children.size - 1
|
52
|
+
children_enum.each_with_index do |setting, i|
|
53
|
+
y.yield "#{inner_child_prefix(i)}#{setting}"
|
54
|
+
end
|
55
|
+
else
|
56
|
+
children_enum.each_with_index do |setting, i|
|
57
|
+
y.yield "#{last_child_prefix(i)}#{setting}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def <<(child)
|
65
|
+
@children << child
|
66
|
+
end
|
67
|
+
|
68
|
+
def to_ary
|
69
|
+
to_enum.to_a
|
70
|
+
end
|
71
|
+
|
72
|
+
alias to_a to_ary
|
73
|
+
|
74
|
+
def to_str
|
75
|
+
to_ary * ?\n
|
76
|
+
end
|
77
|
+
|
78
|
+
alias to_s to_str
|
79
|
+
end
|
80
|
+
end
|
data/lib/complex_config.rb
CHANGED
@@ -84,6 +84,12 @@ RSpec.describe ComplexConfig::Provider do
|
|
84
84
|
).to be_a ComplexConfig::Settings
|
85
85
|
end
|
86
86
|
|
87
|
+
it 'cannot read from an empty configuration file' do
|
88
|
+
expect {
|
89
|
+
described_class.config(asset('empty_config.yml'))
|
90
|
+
}.to raise_error(TypeError)
|
91
|
+
end
|
92
|
+
|
87
93
|
it 'has deep frozen settings' do
|
88
94
|
settings = described_class.config(asset('config.yml'))
|
89
95
|
expect(settings).to be_frozen
|
@@ -7,7 +7,7 @@ RSpec.describe ComplexConfig::Settings do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
let :settings do
|
10
|
-
described_class[
|
10
|
+
obj = described_class[
|
11
11
|
foo: {
|
12
12
|
bar: {
|
13
13
|
baz: true
|
@@ -15,6 +15,8 @@ RSpec.describe ComplexConfig::Settings do
|
|
15
15
|
qux: 'quux'
|
16
16
|
}
|
17
17
|
]
|
18
|
+
obj.name_prefix = 'root'
|
19
|
+
obj
|
18
20
|
end
|
19
21
|
|
20
22
|
it 'can be initialized with a hash' do
|
@@ -79,15 +81,15 @@ RSpec.describe ComplexConfig::Settings do
|
|
79
81
|
|
80
82
|
it 'can return a hash with pathes as keys' do
|
81
83
|
expect(settings.pathes(path_sep: ?:)).to eq(
|
82
|
-
'foo:bar:baz' => true,
|
83
|
-
'foo:qux' => "quux"
|
84
|
+
'root:foo:bar:baz' => true,
|
85
|
+
'root:foo:qux' => "quux"
|
84
86
|
)
|
85
87
|
end
|
86
88
|
|
87
89
|
it 'can be represented as a string' do
|
88
90
|
expect(settings.to_s(pair_sep: ' → ', path_sep: ?/)).to eq <<EOT
|
89
|
-
foo/bar/baz → true
|
90
|
-
foo/qux → "quux"
|
91
|
+
root/foo/bar/baz → true
|
92
|
+
root/foo/qux → "quux"
|
91
93
|
EOT
|
92
94
|
end
|
93
95
|
|
@@ -98,17 +100,33 @@ EOT
|
|
98
100
|
it 'can be represented as a string if it has arrays' do
|
99
101
|
settings[:ary] = described_class[ [ 1, { nested: 2 }, 3 ] ]
|
100
102
|
expect(settings.to_s).to eq <<EOT
|
101
|
-
foo.bar.baz = true
|
102
|
-
foo.qux = "quux"
|
103
|
-
ary[0] = 1
|
104
|
-
ary[1].nested = 2
|
105
|
-
ary[2] = 3
|
103
|
+
root.foo.bar.baz = true
|
104
|
+
root.foo.qux = "quux"
|
105
|
+
root.ary[0] = 1
|
106
|
+
root.ary[1].nested = 2
|
107
|
+
root.ary[2] = 3
|
108
|
+
EOT
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'can be represented as tree' do
|
112
|
+
settings[:ary] = described_class[ [ 1, { nested: 2 }, 3 ] ]
|
113
|
+
expect(settings.to_tree.to_s).to eq <<EOT.chomp
|
114
|
+
root
|
115
|
+
├─ foo
|
116
|
+
│ ├─ bar
|
117
|
+
│ │ └─ baz = true
|
118
|
+
│ └─ qux = "quux"
|
119
|
+
└─ ary
|
120
|
+
├─ 1
|
121
|
+
├─ 1
|
122
|
+
│ └─ nested = 2
|
123
|
+
└─ 3
|
106
124
|
EOT
|
107
125
|
end
|
108
126
|
|
109
127
|
it 'can be pretty printed' do
|
110
128
|
q = double
|
111
|
-
expect(q).to receive(:text).with("foo.bar.baz = true\
|
129
|
+
expect(q).to receive(:text).with("root.foo.bar.baz = true\nroot.foo.qux = \"quux\"\n")
|
112
130
|
settings.pretty_print(q)
|
113
131
|
end
|
114
132
|
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 0.21.0
|
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-
|
11
|
+
date: 2024-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.17.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.17.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -193,11 +193,13 @@ extra_rdoc_files:
|
|
193
193
|
- lib/complex_config/rude.rb
|
194
194
|
- lib/complex_config/settings.rb
|
195
195
|
- lib/complex_config/shortcuts.rb
|
196
|
+
- lib/complex_config/tree.rb
|
196
197
|
- lib/complex_config/version.rb
|
197
198
|
files:
|
198
199
|
- ".all_images.yml"
|
199
|
-
-
|
200
|
+
- CHANGES.md
|
200
201
|
- Gemfile
|
202
|
+
- LICENSE
|
201
203
|
- README.md
|
202
204
|
- Rakefile
|
203
205
|
- VERSION
|
@@ -220,6 +222,7 @@ files:
|
|
220
222
|
- lib/complex_config/rude.rb
|
221
223
|
- lib/complex_config/settings.rb
|
222
224
|
- lib/complex_config/shortcuts.rb
|
225
|
+
- lib/complex_config/tree.rb
|
223
226
|
- lib/complex_config/version.rb
|
224
227
|
- spec/complex_config/config_spec.rb
|
225
228
|
- spec/complex_config/encryption_spec.rb
|
@@ -231,6 +234,7 @@ files:
|
|
231
234
|
- spec/config/broken_config.yml
|
232
235
|
- spec/config/config.yml
|
233
236
|
- spec/config/config_with_alias.yml
|
237
|
+
- spec/config/empty_config.yml
|
234
238
|
- spec/config/legacy_classes.yml
|
235
239
|
- spec/config/master.key
|
236
240
|
- spec/config/with-key-file.yml.enc
|
@@ -260,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
264
|
- !ruby/object:Gem::Version
|
261
265
|
version: '0'
|
262
266
|
requirements: []
|
263
|
-
rubygems_version: 3.5.
|
267
|
+
rubygems_version: 3.5.18
|
264
268
|
signing_key:
|
265
269
|
specification_version: 4
|
266
270
|
summary: configuration library
|
/data/{COPYING → LICENSE}
RENAMED
File without changes
|