qonfig 0.21.0 → 0.22.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/CHANGELOG.md +5 -1
- data/README.md +1 -1
- data/lib/qonfig.rb +1 -0
- data/lib/qonfig/commands/definition/expose_json.rb +2 -2
- data/lib/qonfig/commands/definition/expose_yaml.rb +2 -2
- data/lib/qonfig/commands/definition/load_from_json.rb +2 -2
- data/lib/qonfig/commands/definition/load_from_yaml.rb +2 -2
- data/lib/qonfig/commands/instantiation/values_file.rb +13 -4
- data/lib/qonfig/data_set.rb +8 -7
- data/lib/qonfig/dsl.rb +5 -5
- data/lib/qonfig/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48f718feaf6da5ef0dd8e81bad25fa58b7b06c2eb120b692c6111b745a507c4d
|
4
|
+
data.tar.gz: ad50f7258506db6837c0d08c9c6efaf003f12291427ec33c5b0f8c15124bfdfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb496fb435d1c6a203960ad98a36f2afac9efe5efd0d8a2466187f89c8df3a87af7a7c3678cd07fc73bacd10ca1ae1430a555d396d5783fcad58931cd2f08a1d
|
7
|
+
data.tar.gz: 926c610a00683e0a4cdbd2663777f95579a02c5a11e8548bdfb990a2c962e518e3797c5814a321be2cdc1e531e7855a20913d66bf0c6927f115b0106b30b050a
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [
|
4
|
+
## [0.22.0] - 2019-12-12
|
5
|
+
### Added
|
6
|
+
- Support for `Pathname` file path in `.values_file`, `#load_from_file`, `#load_from_yaml`, `#load_from_json` and `#load_from_toml`;
|
7
|
+
|
8
|
+
## [0.21.0] - 2019-12-12
|
5
9
|
### Added
|
6
10
|
- Brand new type of config objects `Qonfig::Compacted`:
|
7
11
|
- represents the compacted config object with setting readers and setting writers only;
|
data/README.md
CHANGED
@@ -90,7 +90,7 @@ require 'qonfig'
|
|
90
90
|
- [Load from \_\_END\_\_](#load-from-__end__) (aka `.load_from_self`)
|
91
91
|
- [Expose \_\_END\_\_](#expose-__end__) (aka `.expose_self`)
|
92
92
|
- **Setting values**
|
93
|
-
- `(instance methods for loading setting values from a file to existing config object with already defined setting keys)`
|
93
|
+
- `(instance methods for loading the setting values from a file to existing config object with already defined setting keys)`
|
94
94
|
- [Default setting values file](#default-setting-values-file)
|
95
95
|
- [Load setting values from YAML file](#load-setting-values-from-yaml-file-by-instance)
|
96
96
|
- [Load setting values from JSON file](#load-setting-values-from-json-file-by-instance)
|
data/lib/qonfig.rb
CHANGED
@@ -18,7 +18,7 @@ class Qonfig::Commands::Definition::ExposeJSON < Qonfig::Commands::Base
|
|
18
18
|
# @since 0.14.0
|
19
19
|
EMPTY_JSON_DATA = {}.freeze
|
20
20
|
|
21
|
-
# @return [String]
|
21
|
+
# @return [String, Pathname]
|
22
22
|
#
|
23
23
|
# @api private
|
24
24
|
# @since 0.14.0
|
@@ -42,7 +42,7 @@ class Qonfig::Commands::Definition::ExposeJSON < Qonfig::Commands::Base
|
|
42
42
|
# @since 0.14.0
|
43
43
|
attr_reader :env
|
44
44
|
|
45
|
-
# @param file_path [String]
|
45
|
+
# @param file_path [String, Pathname]
|
46
46
|
# @option strict [Boolean]
|
47
47
|
# @option via [Symbol]
|
48
48
|
# @option env [String, Symbol]
|
@@ -18,7 +18,7 @@ class Qonfig::Commands::Definition::ExposeYAML < Qonfig::Commands::Base
|
|
18
18
|
# @since 0.7.0
|
19
19
|
EMPTY_YAML_DATA = {}.freeze
|
20
20
|
|
21
|
-
# @return [String]
|
21
|
+
# @return [String, Pathname]
|
22
22
|
#
|
23
23
|
# @api private
|
24
24
|
# @since 0.7.0
|
@@ -42,7 +42,7 @@ class Qonfig::Commands::Definition::ExposeYAML < Qonfig::Commands::Base
|
|
42
42
|
# @since 0.7.0
|
43
43
|
attr_reader :env
|
44
44
|
|
45
|
-
# @param file_path [String]
|
45
|
+
# @param file_path [String, Pathname]
|
46
46
|
# @option strict [Boolean]
|
47
47
|
# @option via [Symbol]
|
48
48
|
# @option env [String, Symbol]
|
@@ -6,7 +6,7 @@ class Qonfig::Commands::Definition::LoadFromJSON < Qonfig::Commands::Base
|
|
6
6
|
# @since 0.19.0
|
7
7
|
self.inheritable = true
|
8
8
|
|
9
|
-
# @return [String]
|
9
|
+
# @return [String, Pathname]
|
10
10
|
#
|
11
11
|
# @api private
|
12
12
|
# @since 0.5.0
|
@@ -18,7 +18,7 @@ class Qonfig::Commands::Definition::LoadFromJSON < Qonfig::Commands::Base
|
|
18
18
|
# @sicne 0.5.0
|
19
19
|
attr_reader :strict
|
20
20
|
|
21
|
-
# @param file_path [String]
|
21
|
+
# @param file_path [String, Pathname]
|
22
22
|
# @option strict [Boolean]
|
23
23
|
#
|
24
24
|
# @api private
|
@@ -6,7 +6,7 @@ class Qonfig::Commands::Definition::LoadFromYAML < Qonfig::Commands::Base
|
|
6
6
|
# @since 0.19.0
|
7
7
|
self.inheritable = true
|
8
8
|
|
9
|
-
# @return [String]
|
9
|
+
# @return [String, Pathname]
|
10
10
|
#
|
11
11
|
# @api private
|
12
12
|
# @since 0.2.0
|
@@ -18,7 +18,7 @@ class Qonfig::Commands::Definition::LoadFromYAML < Qonfig::Commands::Base
|
|
18
18
|
# @since 0.2.0
|
19
19
|
attr_reader :strict
|
20
20
|
|
21
|
-
# @param file_path [String]
|
21
|
+
# @param file_path [String, Pathname]
|
22
22
|
# @option strict [Boolean]
|
23
23
|
#
|
24
24
|
# @api private
|
@@ -30,10 +30,11 @@ class Qonfig::Commands::Instantiation::ValuesFile < Qonfig::Commands::Base
|
|
30
30
|
# @since 0.17.0
|
31
31
|
DEFAULT_FORMAT = :dynamic
|
32
32
|
|
33
|
-
# @return [String, Symbol]
|
33
|
+
# @return [String, Symbol, Pathname]
|
34
34
|
#
|
35
35
|
# @api private
|
36
36
|
# @since 0.17.0
|
37
|
+
# @version 0.22.0
|
37
38
|
attr_reader :file_path
|
38
39
|
|
39
40
|
# @return [String]
|
@@ -60,7 +61,7 @@ class Qonfig::Commands::Instantiation::ValuesFile < Qonfig::Commands::Base
|
|
60
61
|
# @since 0.17.0
|
61
62
|
attr_reader :expose
|
62
63
|
|
63
|
-
# @param file_path [String, Symbol]
|
64
|
+
# @param file_path [String, Symbol, Pathname]
|
64
65
|
# @param caller_location [String]
|
65
66
|
# @option format [String, Symbol]
|
66
67
|
# @option strict [Boolean]
|
@@ -69,6 +70,7 @@ class Qonfig::Commands::Instantiation::ValuesFile < Qonfig::Commands::Base
|
|
69
70
|
#
|
70
71
|
# @api private
|
71
72
|
# @since 0.17.0
|
73
|
+
# @version 0.22.0
|
72
74
|
def initialize(
|
73
75
|
file_path,
|
74
76
|
caller_location,
|
@@ -140,7 +142,7 @@ class Qonfig::Commands::Instantiation::ValuesFile < Qonfig::Commands::Base
|
|
140
142
|
raise(error) if strict
|
141
143
|
end
|
142
144
|
|
143
|
-
# @param file_path [String, Symbol]
|
145
|
+
# @param file_path [String, Symbol, Pathname]
|
144
146
|
# @param format [String, Symbol]
|
145
147
|
# @param strict [Boolean]
|
146
148
|
# @param expose [NilClass, String, Symbol]
|
@@ -151,8 +153,14 @@ class Qonfig::Commands::Instantiation::ValuesFile < Qonfig::Commands::Base
|
|
151
153
|
#
|
152
154
|
# @api private
|
153
155
|
# @since 0.17.0
|
156
|
+
# @version 0.22.0
|
157
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
154
158
|
def prevent_incompatible_attributes!(file_path, format, strict, expose)
|
155
|
-
unless
|
159
|
+
unless (
|
160
|
+
file_path.is_a?(String) ||
|
161
|
+
file_path.is_a?(Pathname) ||
|
162
|
+
file_path == SELF_LOCATED_FILE_DEFINITION
|
163
|
+
)
|
156
164
|
raise Qonfig::ArgumentError, 'Incorrect file path'
|
157
165
|
end
|
158
166
|
|
@@ -171,4 +179,5 @@ class Qonfig::Commands::Instantiation::ValuesFile < Qonfig::Commands::Base
|
|
171
179
|
raise Qonfig::ArgumentError, ':strict should be a type of boolean'
|
172
180
|
end
|
173
181
|
end
|
182
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
174
183
|
end
|
data/lib/qonfig/data_set.rb
CHANGED
@@ -97,7 +97,7 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
# @param file_path [String, Symbol]
|
100
|
+
# @param file_path [String, Symbol, Pathname]
|
101
101
|
# @option format [String, Symbol]
|
102
102
|
# @option strict [Boolean]
|
103
103
|
# @option expose [NilClass, String, Symbol] Environment key
|
@@ -108,7 +108,7 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
|
|
108
108
|
#
|
109
109
|
# @api public
|
110
110
|
# @since 0.17.0
|
111
|
-
# @version 0.
|
111
|
+
# @version 0.22.0
|
112
112
|
def load_from_file(file_path, format: :dynamic, strict: true, expose: nil, &configurations)
|
113
113
|
thread_safe_access do
|
114
114
|
load_setting_values_from_file(
|
@@ -117,7 +117,7 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
# @param file_path [String]
|
120
|
+
# @param file_path [String, Symbol, Pathname]
|
121
121
|
# @option strict [Boolean]
|
122
122
|
# @option expose [NilClass, String, Symbol] Environment key
|
123
123
|
# @param configurations [Block]
|
@@ -127,12 +127,12 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
|
|
127
127
|
#
|
128
128
|
# @api public
|
129
129
|
# @since 0.17.0
|
130
|
-
# @version 0.
|
130
|
+
# @version 0.22.0
|
131
131
|
def load_from_yaml(file_path, strict: true, expose: nil, &configurations)
|
132
132
|
load_from_file(file_path, format: :yml, strict: strict, expose: expose, &configurations)
|
133
133
|
end
|
134
134
|
|
135
|
-
# @param file_path [String]
|
135
|
+
# @param file_path [String, Symbol, Pathname]
|
136
136
|
# @option strict [Boolean]
|
137
137
|
# @option expose [NilClass, String, Symbol] Environment key
|
138
138
|
# @param configurations [Block]
|
@@ -142,7 +142,7 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
|
|
142
142
|
#
|
143
143
|
# @api public
|
144
144
|
# @since 0.17.0
|
145
|
-
# @version 0.
|
145
|
+
# @version 0.22.0
|
146
146
|
def load_from_json(file_path, strict: true, expose: nil, &configurations)
|
147
147
|
load_from_file(file_path, format: :json, strict: strict, expose: expose, &configurations)
|
148
148
|
end
|
@@ -513,7 +513,7 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
|
|
513
513
|
apply_settings(settings_map, &configurations)
|
514
514
|
end
|
515
515
|
|
516
|
-
# @param file_path [String, Symbol]
|
516
|
+
# @param file_path [String, Symbol, Pathname]
|
517
517
|
# @option format [String, Symbol]
|
518
518
|
# @option strict [Boolean]
|
519
519
|
# @option expose [NilClass, String, Symbol]
|
@@ -525,6 +525,7 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
|
|
525
525
|
#
|
526
526
|
# @api private
|
527
527
|
# @since 0.17.0
|
528
|
+
# @version 0.22.0
|
528
529
|
def load_setting_values_from_file(
|
529
530
|
file_path,
|
530
531
|
format: :dynamic,
|
data/lib/qonfig/dsl.rb
CHANGED
@@ -154,7 +154,7 @@ module Qonfig::DSL # rubocop:disable Metrics/ModuleLength
|
|
154
154
|
definition_commands << Qonfig::Commands::Definition::Compose.new(data_set_klass)
|
155
155
|
end
|
156
156
|
|
157
|
-
# @param file_path [String]
|
157
|
+
# @param file_path [String, Pathname]
|
158
158
|
# @option strict [Boolean]
|
159
159
|
# @return [void]
|
160
160
|
#
|
@@ -200,7 +200,7 @@ module Qonfig::DSL # rubocop:disable Metrics/ModuleLength
|
|
200
200
|
)
|
201
201
|
end
|
202
202
|
|
203
|
-
# @param file_path [String]
|
203
|
+
# @param file_path [String, Pathname]
|
204
204
|
# @option strict [Boolean]
|
205
205
|
# @return [void]
|
206
206
|
#
|
@@ -212,7 +212,7 @@ module Qonfig::DSL # rubocop:disable Metrics/ModuleLength
|
|
212
212
|
definition_commands << Qonfig::Commands::Definition::LoadFromJSON.new(file_path, strict: strict)
|
213
213
|
end
|
214
214
|
|
215
|
-
# @param file_path [String]
|
215
|
+
# @param file_path [String, Pathname]
|
216
216
|
# @option strict [Boolean]
|
217
217
|
# @option via [Symbol]
|
218
218
|
# @option env [Symbol, String]
|
@@ -228,7 +228,7 @@ module Qonfig::DSL # rubocop:disable Metrics/ModuleLength
|
|
228
228
|
)
|
229
229
|
end
|
230
230
|
|
231
|
-
# @param file_path [String]
|
231
|
+
# @param file_path [String, Pathname]
|
232
232
|
# @option strict [Boolean]
|
233
233
|
# @option via [Symbol]
|
234
234
|
# @option env [Symbol, String]
|
@@ -261,7 +261,7 @@ module Qonfig::DSL # rubocop:disable Metrics/ModuleLength
|
|
261
261
|
)
|
262
262
|
end
|
263
263
|
|
264
|
-
# @param file_path [String]
|
264
|
+
# @param file_path [String, Pathname]
|
265
265
|
# @option format [String, Symbol]
|
266
266
|
# @option strict [Boolean]
|
267
267
|
# @option expose [NilClass, String, Symbol] Environment key
|
data/lib/qonfig/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qonfig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Ibragimov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
@@ -244,7 +244,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
244
|
- !ruby/object:Gem::Version
|
245
245
|
version: '0'
|
246
246
|
requirements: []
|
247
|
-
|
247
|
+
rubyforge_project:
|
248
|
+
rubygems_version: 2.7.6
|
248
249
|
signing_key:
|
249
250
|
specification_version: 4
|
250
251
|
summary: Config object
|