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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8bb3c845cef4655af444f78682841a1d882176463aca7d05e6d156f64e70f38
4
- data.tar.gz: 58e18c72976148f86eb6c9f845d976b69311ce3edbd5fe219a141accc9cec6a1
3
+ metadata.gz: 48f718feaf6da5ef0dd8e81bad25fa58b7b06c2eb120b692c6111b745a507c4d
4
+ data.tar.gz: ad50f7258506db6837c0d08c9c6efaf003f12291427ec33c5b0f8c15124bfdfc
5
5
  SHA512:
6
- metadata.gz: c201ccb87e62e2424f38784aefaae67410c1725c6c2a33f00126412f9d495c081c6b8faf4fbf52b17e9f2ae674b87b8454002eedafdf4f5209e328afe4892821
7
- data.tar.gz: d7a6bb166580c9f8d8df2aba63cefbbc3251b2e84daf6ca9863442b585267459ba9b528327e484a86a26a4f5e031adaa911d3acfca36b3cf6d434e2aa50bd14d
6
+ metadata.gz: eb496fb435d1c6a203960ad98a36f2afac9efe5efd0d8a2466187f89c8df3a87af7a7c3678cd07fc73bacd10ca1ae1430a555d396d5783fcad58931cd2f08a1d
7
+ data.tar.gz: 926c610a00683e0a4cdbd2663777f95579a02c5a11e8548bdfb990a2c962e518e3797c5814a321be2cdc1e531e7855a20913d66bf0c6927f115b0106b30b050a
@@ -1,7 +1,11 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [Unreleased]
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)
@@ -3,6 +3,7 @@
3
3
  require 'yaml'
4
4
  require 'json'
5
5
  require 'erb'
6
+ require 'pathname'
6
7
 
7
8
  # @api public
8
9
  # @since 0.1.0
@@ -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 file_path.is_a?(String) || file_path == SELF_LOCATED_FILE_DEFINITION
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
@@ -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.21.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.21.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.21.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,
@@ -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
@@ -5,5 +5,5 @@ module Qonfig
5
5
  #
6
6
  # @api public
7
7
  # @since 0.1.0
8
- VERSION = '0.21.0'
8
+ VERSION = '0.22.0'
9
9
  end
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.21.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 00:00:00.000000000 Z
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
- rubygems_version: 3.0.3
247
+ rubyforge_project:
248
+ rubygems_version: 2.7.6
248
249
  signing_key:
249
250
  specification_version: 4
250
251
  summary: Config object