config_default 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +1 -1
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +131 -126
- data/README.md +1 -2
- data/lib/config_default/struct.rb +2 -6
- data/lib/config_default/version.rb +1 -1
- data/lib/config_default.rb +4 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c668f11a0329c689b17ce83c7f656efba30e31ecbe4c277602df2a623ce5395f
|
4
|
+
data.tar.gz: edc20362637a4ee07b9db2f6bdc41d60841ad40b5af6e29b1edf1990664deec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d060c70fe676be1172615599c64ba5c59f3b03c3b9313c5758e5724dd256c02def5b05697f44b39c17c1fdc352753f1dc6b32cc74e41ac51cd446f440683252
|
7
|
+
data.tar.gz: 2a8133cb3fe79507af9dc42c9d86aaa96e8d47f5cf1a82b67ff58eddb5027adb8e4a81f2364fc566659f2b22497dd60a5078d0ca668dd836155f09180f1b70c5
|
data/.github/workflows/main.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
## 0.2.5
|
2
|
+
|
3
|
+
- Remove `attributes` keyword.
|
4
|
+
- Development dependency gems upgrade.
|
5
|
+
|
6
|
+
## 0.2.4
|
7
|
+
|
8
|
+
- Avoid `symbolize_keys' for nil:NilClass error.
|
9
|
+
|
10
|
+
## 0.2.3
|
11
|
+
|
12
|
+
- Moving to ArgumentError for better semantics.
|
13
|
+
|
14
|
+
## 0.2.1
|
15
|
+
|
16
|
+
- Better rails monkey path apply. Rails extension classes without namespace.
|
17
|
+
|
18
|
+
## 0.2.0
|
19
|
+
|
20
|
+
- New gem version with better code organization.
|
21
|
+
|
1
22
|
## 0.1.2
|
2
23
|
|
3
24
|
- Move config struct option definition from `#method_missing` to `#define_singleton_method`
|
data/Gemfile.lock
CHANGED
@@ -1,73 +1,73 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
config_default (0.2.
|
4
|
+
config_default (0.2.5)
|
5
5
|
activesupport (>= 6)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (7.0.
|
11
|
-
actionpack (= 7.0.
|
12
|
-
activesupport (= 7.0.
|
10
|
+
actioncable (7.0.5)
|
11
|
+
actionpack (= 7.0.5)
|
12
|
+
activesupport (= 7.0.5)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (7.0.
|
16
|
-
actionpack (= 7.0.
|
17
|
-
activejob (= 7.0.
|
18
|
-
activerecord (= 7.0.
|
19
|
-
activestorage (= 7.0.
|
20
|
-
activesupport (= 7.0.
|
15
|
+
actionmailbox (7.0.5)
|
16
|
+
actionpack (= 7.0.5)
|
17
|
+
activejob (= 7.0.5)
|
18
|
+
activerecord (= 7.0.5)
|
19
|
+
activestorage (= 7.0.5)
|
20
|
+
activesupport (= 7.0.5)
|
21
21
|
mail (>= 2.7.1)
|
22
22
|
net-imap
|
23
23
|
net-pop
|
24
24
|
net-smtp
|
25
|
-
actionmailer (7.0.
|
26
|
-
actionpack (= 7.0.
|
27
|
-
actionview (= 7.0.
|
28
|
-
activejob (= 7.0.
|
29
|
-
activesupport (= 7.0.
|
25
|
+
actionmailer (7.0.5)
|
26
|
+
actionpack (= 7.0.5)
|
27
|
+
actionview (= 7.0.5)
|
28
|
+
activejob (= 7.0.5)
|
29
|
+
activesupport (= 7.0.5)
|
30
30
|
mail (~> 2.5, >= 2.5.4)
|
31
31
|
net-imap
|
32
32
|
net-pop
|
33
33
|
net-smtp
|
34
34
|
rails-dom-testing (~> 2.0)
|
35
|
-
actionpack (7.0.
|
36
|
-
actionview (= 7.0.
|
37
|
-
activesupport (= 7.0.
|
38
|
-
rack (~> 2.0, >= 2.2.
|
35
|
+
actionpack (7.0.5)
|
36
|
+
actionview (= 7.0.5)
|
37
|
+
activesupport (= 7.0.5)
|
38
|
+
rack (~> 2.0, >= 2.2.4)
|
39
39
|
rack-test (>= 0.6.3)
|
40
40
|
rails-dom-testing (~> 2.0)
|
41
41
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
42
|
-
actiontext (7.0.
|
43
|
-
actionpack (= 7.0.
|
44
|
-
activerecord (= 7.0.
|
45
|
-
activestorage (= 7.0.
|
46
|
-
activesupport (= 7.0.
|
42
|
+
actiontext (7.0.5)
|
43
|
+
actionpack (= 7.0.5)
|
44
|
+
activerecord (= 7.0.5)
|
45
|
+
activestorage (= 7.0.5)
|
46
|
+
activesupport (= 7.0.5)
|
47
47
|
globalid (>= 0.6.0)
|
48
48
|
nokogiri (>= 1.8.5)
|
49
|
-
actionview (7.0.
|
50
|
-
activesupport (= 7.0.
|
49
|
+
actionview (7.0.5)
|
50
|
+
activesupport (= 7.0.5)
|
51
51
|
builder (~> 3.1)
|
52
52
|
erubi (~> 1.4)
|
53
53
|
rails-dom-testing (~> 2.0)
|
54
54
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
55
|
-
activejob (7.0.
|
56
|
-
activesupport (= 7.0.
|
55
|
+
activejob (7.0.5)
|
56
|
+
activesupport (= 7.0.5)
|
57
57
|
globalid (>= 0.3.6)
|
58
|
-
activemodel (7.0.
|
59
|
-
activesupport (= 7.0.
|
60
|
-
activerecord (7.0.
|
61
|
-
activemodel (= 7.0.
|
62
|
-
activesupport (= 7.0.
|
63
|
-
activestorage (7.0.
|
64
|
-
actionpack (= 7.0.
|
65
|
-
activejob (= 7.0.
|
66
|
-
activerecord (= 7.0.
|
67
|
-
activesupport (= 7.0.
|
58
|
+
activemodel (7.0.5)
|
59
|
+
activesupport (= 7.0.5)
|
60
|
+
activerecord (7.0.5)
|
61
|
+
activemodel (= 7.0.5)
|
62
|
+
activesupport (= 7.0.5)
|
63
|
+
activestorage (7.0.5)
|
64
|
+
actionpack (= 7.0.5)
|
65
|
+
activejob (= 7.0.5)
|
66
|
+
activerecord (= 7.0.5)
|
67
|
+
activesupport (= 7.0.5)
|
68
68
|
marcel (~> 1.0)
|
69
69
|
mini_mime (>= 1.1.0)
|
70
|
-
activesupport (7.0.
|
70
|
+
activesupport (7.0.5)
|
71
71
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
72
72
|
i18n (>= 1.6, < 2)
|
73
73
|
minitest (>= 5.1)
|
@@ -75,142 +75,147 @@ GEM
|
|
75
75
|
ast (2.4.2)
|
76
76
|
builder (3.2.4)
|
77
77
|
coderay (1.1.3)
|
78
|
-
concurrent-ruby (1.
|
78
|
+
concurrent-ruby (1.2.2)
|
79
79
|
crass (1.0.6)
|
80
|
+
date (3.3.3)
|
80
81
|
diff-lcs (1.5.0)
|
81
|
-
|
82
|
-
|
83
|
-
globalid (1.0.0)
|
82
|
+
erubi (1.12.0)
|
83
|
+
globalid (1.1.0)
|
84
84
|
activesupport (>= 5.0)
|
85
|
-
i18n (1.
|
85
|
+
i18n (1.14.1)
|
86
86
|
concurrent-ruby (~> 1.0)
|
87
|
-
|
88
|
-
loofah (2.
|
87
|
+
json (2.6.3)
|
88
|
+
loofah (2.21.3)
|
89
89
|
crass (~> 1.0.2)
|
90
|
-
nokogiri (>= 1.
|
91
|
-
mail (2.
|
90
|
+
nokogiri (>= 1.12.0)
|
91
|
+
mail (2.8.1)
|
92
92
|
mini_mime (>= 0.1.1)
|
93
|
+
net-imap
|
94
|
+
net-pop
|
95
|
+
net-smtp
|
93
96
|
marcel (1.0.2)
|
94
97
|
method_source (1.0.0)
|
95
98
|
mini_mime (1.1.2)
|
96
|
-
minitest (5.
|
97
|
-
net-imap (0.
|
98
|
-
|
99
|
+
minitest (5.18.0)
|
100
|
+
net-imap (0.3.4)
|
101
|
+
date
|
99
102
|
net-protocol
|
100
|
-
|
101
|
-
net-pop (0.1.1)
|
102
|
-
digest
|
103
|
+
net-pop (0.1.2)
|
103
104
|
net-protocol
|
105
|
+
net-protocol (0.2.1)
|
104
106
|
timeout
|
105
|
-
net-
|
106
|
-
io-wait
|
107
|
-
timeout
|
108
|
-
net-smtp (0.3.1)
|
109
|
-
digest
|
107
|
+
net-smtp (0.3.3)
|
110
108
|
net-protocol
|
111
|
-
|
112
|
-
|
113
|
-
|
109
|
+
nio4r (2.5.9)
|
110
|
+
nokogiri (1.15.2-arm64-darwin)
|
111
|
+
racc (~> 1.4)
|
112
|
+
nokogiri (1.15.2-x86_64-darwin)
|
114
113
|
racc (~> 1.4)
|
115
|
-
nokogiri (1.
|
114
|
+
nokogiri (1.15.2-x86_64-linux)
|
116
115
|
racc (~> 1.4)
|
117
|
-
parallel (1.
|
118
|
-
parser (3.
|
116
|
+
parallel (1.23.0)
|
117
|
+
parser (3.2.2.3)
|
119
118
|
ast (~> 2.4.1)
|
120
|
-
|
119
|
+
racc
|
120
|
+
pry (0.14.2)
|
121
121
|
coderay (~> 1.1)
|
122
122
|
method_source (~> 1.0)
|
123
|
-
racc (1.
|
124
|
-
rack (2.2.
|
125
|
-
rack-test (
|
126
|
-
rack (>= 1.
|
127
|
-
rails (7.0.
|
128
|
-
actioncable (= 7.0.
|
129
|
-
actionmailbox (= 7.0.
|
130
|
-
actionmailer (= 7.0.
|
131
|
-
actionpack (= 7.0.
|
132
|
-
actiontext (= 7.0.
|
133
|
-
actionview (= 7.0.
|
134
|
-
activejob (= 7.0.
|
135
|
-
activemodel (= 7.0.
|
136
|
-
activerecord (= 7.0.
|
137
|
-
activestorage (= 7.0.
|
138
|
-
activesupport (= 7.0.
|
123
|
+
racc (1.7.0)
|
124
|
+
rack (2.2.7)
|
125
|
+
rack-test (2.1.0)
|
126
|
+
rack (>= 1.3)
|
127
|
+
rails (7.0.5)
|
128
|
+
actioncable (= 7.0.5)
|
129
|
+
actionmailbox (= 7.0.5)
|
130
|
+
actionmailer (= 7.0.5)
|
131
|
+
actionpack (= 7.0.5)
|
132
|
+
actiontext (= 7.0.5)
|
133
|
+
actionview (= 7.0.5)
|
134
|
+
activejob (= 7.0.5)
|
135
|
+
activemodel (= 7.0.5)
|
136
|
+
activerecord (= 7.0.5)
|
137
|
+
activestorage (= 7.0.5)
|
138
|
+
activesupport (= 7.0.5)
|
139
139
|
bundler (>= 1.15.0)
|
140
|
-
railties (= 7.0.
|
140
|
+
railties (= 7.0.5)
|
141
141
|
rails-dom-testing (2.0.3)
|
142
142
|
activesupport (>= 4.2.0)
|
143
143
|
nokogiri (>= 1.6)
|
144
|
-
rails-html-sanitizer (1.
|
145
|
-
loofah (~> 2.
|
146
|
-
|
147
|
-
|
148
|
-
|
144
|
+
rails-html-sanitizer (1.6.0)
|
145
|
+
loofah (~> 2.21)
|
146
|
+
nokogiri (~> 1.14)
|
147
|
+
railties (7.0.5)
|
148
|
+
actionpack (= 7.0.5)
|
149
|
+
activesupport (= 7.0.5)
|
149
150
|
method_source
|
150
151
|
rake (>= 12.2)
|
151
152
|
thor (~> 1.0)
|
152
153
|
zeitwerk (~> 2.5)
|
153
154
|
rainbow (3.1.1)
|
154
155
|
rake (13.0.6)
|
155
|
-
regexp_parser (2.
|
156
|
+
regexp_parser (2.8.0)
|
156
157
|
rexml (3.2.5)
|
157
|
-
rspec (3.
|
158
|
-
rspec-core (~> 3.
|
159
|
-
rspec-expectations (~> 3.
|
160
|
-
rspec-mocks (~> 3.
|
161
|
-
rspec-core (3.
|
162
|
-
rspec-support (~> 3.
|
163
|
-
rspec-expectations (3.
|
158
|
+
rspec (3.12.0)
|
159
|
+
rspec-core (~> 3.12.0)
|
160
|
+
rspec-expectations (~> 3.12.0)
|
161
|
+
rspec-mocks (~> 3.12.0)
|
162
|
+
rspec-core (3.12.2)
|
163
|
+
rspec-support (~> 3.12.0)
|
164
|
+
rspec-expectations (3.12.3)
|
164
165
|
diff-lcs (>= 1.2.0, < 2.0)
|
165
|
-
rspec-support (~> 3.
|
166
|
-
rspec-mocks (3.
|
166
|
+
rspec-support (~> 3.12.0)
|
167
|
+
rspec-mocks (3.12.5)
|
167
168
|
diff-lcs (>= 1.2.0, < 2.0)
|
168
|
-
rspec-support (~> 3.
|
169
|
-
rspec-support (3.
|
170
|
-
rubocop (1.
|
169
|
+
rspec-support (~> 3.12.0)
|
170
|
+
rspec-support (3.12.0)
|
171
|
+
rubocop (1.50.2)
|
172
|
+
json (~> 2.3)
|
171
173
|
parallel (~> 1.10)
|
172
|
-
parser (>= 3.
|
174
|
+
parser (>= 3.2.0.0)
|
173
175
|
rainbow (>= 2.2.2, < 4.0)
|
174
176
|
regexp_parser (>= 1.8, < 3.0)
|
175
|
-
rexml
|
176
|
-
rubocop-ast (>= 1.
|
177
|
+
rexml (>= 3.2.5, < 4.0)
|
178
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
177
179
|
ruby-progressbar (~> 1.7)
|
178
|
-
unicode-display_width (>=
|
179
|
-
rubocop-ast (1.
|
180
|
-
parser (>= 3.
|
181
|
-
rubocop-
|
182
|
-
rubocop (~> 1.
|
183
|
-
|
184
|
-
rubocop
|
180
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
181
|
+
rubocop-ast (1.29.0)
|
182
|
+
parser (>= 3.2.1.0)
|
183
|
+
rubocop-capybara (2.18.0)
|
184
|
+
rubocop (~> 1.41)
|
185
|
+
rubocop-config-umbrellio (1.50.0.85)
|
186
|
+
rubocop (~> 1.50.0)
|
187
|
+
rubocop-performance (~> 1.17.0)
|
188
|
+
rubocop-rails (~> 2.19.0)
|
185
189
|
rubocop-rake (~> 0.6.0)
|
186
|
-
rubocop-rspec (~> 2.
|
190
|
+
rubocop-rspec (~> 2.20.0)
|
187
191
|
rubocop-sequel (~> 0.3.3)
|
188
|
-
rubocop-performance (1.
|
192
|
+
rubocop-performance (1.17.1)
|
189
193
|
rubocop (>= 1.7.0, < 2.0)
|
190
194
|
rubocop-ast (>= 0.4.0)
|
191
|
-
rubocop-rails (2.
|
195
|
+
rubocop-rails (2.19.1)
|
192
196
|
activesupport (>= 4.2.0)
|
193
197
|
rack (>= 1.1)
|
194
|
-
rubocop (>= 1.
|
198
|
+
rubocop (>= 1.33.0, < 2.0)
|
195
199
|
rubocop-rake (0.6.0)
|
196
200
|
rubocop (~> 1.0)
|
197
|
-
rubocop-rspec (2.
|
198
|
-
rubocop (~> 1.
|
199
|
-
|
201
|
+
rubocop-rspec (2.20.0)
|
202
|
+
rubocop (~> 1.33)
|
203
|
+
rubocop-capybara (~> 2.17)
|
204
|
+
rubocop-sequel (0.3.4)
|
200
205
|
rubocop (~> 1.0)
|
201
|
-
ruby-progressbar (1.
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
tzinfo (2.0.4)
|
206
|
+
ruby-progressbar (1.13.0)
|
207
|
+
thor (1.2.2)
|
208
|
+
timeout (0.3.2)
|
209
|
+
tzinfo (2.0.6)
|
206
210
|
concurrent-ruby (~> 1.0)
|
207
|
-
unicode-display_width (2.
|
211
|
+
unicode-display_width (2.4.2)
|
208
212
|
websocket-driver (0.7.5)
|
209
213
|
websocket-extensions (>= 0.1.0)
|
210
214
|
websocket-extensions (0.1.5)
|
211
|
-
zeitwerk (2.
|
215
|
+
zeitwerk (2.6.8)
|
212
216
|
|
213
217
|
PLATFORMS
|
218
|
+
arm64-darwin-22
|
214
219
|
x86_64-darwin-20
|
215
220
|
x86_64-darwin-21
|
216
221
|
x86_64-linux
|
@@ -224,4 +229,4 @@ DEPENDENCIES
|
|
224
229
|
rubocop-config-umbrellio
|
225
230
|
|
226
231
|
BUNDLED WITH
|
227
|
-
2.
|
232
|
+
2.4.13
|
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
ConfigDefault is a simple way to separate your test/development config from your staging/production config.
|
4
4
|
Designed to work with [Rails](https://github.com/rails/rails). It depends on `ActiveSupport`.
|
5
|
-
Maybe in future I'll remove Rails dependency (cause it's never cool) and leave only ActiveSupport.
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
|
@@ -171,7 +170,7 @@ Here an example of creation struct object on the fly:
|
|
171
170
|
|
172
171
|
```ruby
|
173
172
|
config_on_the_fly = { first: { second: { third: "option" } } }
|
174
|
-
config = ConfigDefault::Struct.new(
|
173
|
+
config = ConfigDefault::Struct.new(config_on_the_fly, recursive: true)
|
175
174
|
config.first.to_hash
|
176
175
|
# => { "second" => { "third" => "option" } }
|
177
176
|
config.first.second.third
|
@@ -3,7 +3,7 @@
|
|
3
3
|
class ConfigDefault::Struct
|
4
4
|
RESERVED_METHODS = %i[method_missing respond_to_missing? to_hash].freeze
|
5
5
|
|
6
|
-
def initialize(attributes
|
6
|
+
def initialize(attributes, recursive: false, allow_nil: false)
|
7
7
|
@attributes = ActiveSupport::HashWithIndifferentAccess.new(attributes)
|
8
8
|
@allow_nil = allow_nil
|
9
9
|
@recursive = recursive
|
@@ -47,11 +47,7 @@ class ConfigDefault::Struct
|
|
47
47
|
|
48
48
|
@attributes.each do |key, value|
|
49
49
|
next unless value.is_a?(Hash)
|
50
|
-
@attributes[key] = self.class.new(
|
51
|
-
attributes: value,
|
52
|
-
recursive: @recursive,
|
53
|
-
allow_nil: @allow_nil,
|
54
|
-
)
|
50
|
+
@attributes[key] = self.class.new(value, recursive: @recursive, allow_nil: @allow_nil)
|
55
51
|
end
|
56
52
|
end
|
57
53
|
|
data/lib/config_default.rb
CHANGED
@@ -31,6 +31,8 @@ module ConfigDefault
|
|
31
31
|
data = default_config.deep_merge(config)
|
32
32
|
data = key ? data[key] : data
|
33
33
|
|
34
|
+
return {} if data.nil?
|
35
|
+
|
34
36
|
if deep_symbolize_keys
|
35
37
|
data.deep_symbolize_keys
|
36
38
|
elsif symbolize_keys
|
@@ -48,10 +50,7 @@ module ConfigDefault
|
|
48
50
|
end
|
49
51
|
|
50
52
|
def load_struct(name, key: Rails.env, recursive: false, allow_nil: false)
|
51
|
-
|
52
|
-
|
53
|
-
recursive: recursive,
|
54
|
-
allow_nil: allow_nil,
|
55
|
-
)
|
53
|
+
attributes = load(name, key: key)
|
54
|
+
ConfigDefault::Struct.new(attributes, recursive: recursive, allow_nil: allow_nil)
|
56
55
|
end
|
57
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config_default
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stepan Kirushkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
|
-
rubygems_version: 3.
|
76
|
+
rubygems_version: 3.4.13
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: A simple way to manage default and env configuration in Rails.
|