config_default 0.2.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c668f11a0329c689b17ce83c7f656efba30e31ecbe4c277602df2a623ce5395f
4
- data.tar.gz: edc20362637a4ee07b9db2f6bdc41d60841ad40b5af6e29b1edf1990664deec1
3
+ metadata.gz: 3ee450c0ba68badbd9918f55242afccc8c61368591c3f430cc42fc6ddc84d3ad
4
+ data.tar.gz: a6d5aa218bdf39fd65a6b19c223b196e5358327aaf7011529c31673b236a8cd2
5
5
  SHA512:
6
- metadata.gz: 4d060c70fe676be1172615599c64ba5c59f3b03c3b9313c5758e5724dd256c02def5b05697f44b39c17c1fdc352753f1dc6b32cc74e41ac51cd446f440683252
7
- data.tar.gz: 2a8133cb3fe79507af9dc42c9d86aaa96e8d47f5cf1a82b67ff58eddb5027adb8e4a81f2364fc566659f2b22497dd60a5078d0ca668dd836155f09180f1b70c5
6
+ metadata.gz: be3a0b8ce4621dad804e5d767d9da31170c35044712caf503320d584b25fd1430c3fa6e7140f3a02a6cc161370dfa3397d306e2bdb00d73ab6c73a7fa7da2383
7
+ data.tar.gz: b17ceb5c71b2c2dc054ced8496392cebcf9846ff72961ee1b3df2872f27cfed2ef1e2ca099b38e51ec036f3102a9eea5f512a61cd34382698f14709298e8b84c
data/Gemfile.lock CHANGED
@@ -1,91 +1,108 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- config_default (0.2.5)
4
+ config_default (0.3.0)
5
5
  activesupport (>= 6)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.0.5)
11
- actionpack (= 7.0.5)
12
- activesupport (= 7.0.5)
10
+ actioncable (7.1.1)
11
+ actionpack (= 7.1.1)
12
+ activesupport (= 7.1.1)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
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)
15
+ zeitwerk (~> 2.6)
16
+ actionmailbox (7.1.1)
17
+ actionpack (= 7.1.1)
18
+ activejob (= 7.1.1)
19
+ activerecord (= 7.1.1)
20
+ activestorage (= 7.1.1)
21
+ activesupport (= 7.1.1)
21
22
  mail (>= 2.7.1)
22
23
  net-imap
23
24
  net-pop
24
25
  net-smtp
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)
26
+ actionmailer (7.1.1)
27
+ actionpack (= 7.1.1)
28
+ actionview (= 7.1.1)
29
+ activejob (= 7.1.1)
30
+ activesupport (= 7.1.1)
30
31
  mail (~> 2.5, >= 2.5.4)
31
32
  net-imap
32
33
  net-pop
33
34
  net-smtp
34
- rails-dom-testing (~> 2.0)
35
- actionpack (7.0.5)
36
- actionview (= 7.0.5)
37
- activesupport (= 7.0.5)
38
- rack (~> 2.0, >= 2.2.4)
35
+ rails-dom-testing (~> 2.2)
36
+ actionpack (7.1.1)
37
+ actionview (= 7.1.1)
38
+ activesupport (= 7.1.1)
39
+ nokogiri (>= 1.8.5)
40
+ rack (>= 2.2.4)
41
+ rack-session (>= 1.0.1)
39
42
  rack-test (>= 0.6.3)
40
- rails-dom-testing (~> 2.0)
41
- rails-html-sanitizer (~> 1.0, >= 1.2.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)
43
+ rails-dom-testing (~> 2.2)
44
+ rails-html-sanitizer (~> 1.6)
45
+ actiontext (7.1.1)
46
+ actionpack (= 7.1.1)
47
+ activerecord (= 7.1.1)
48
+ activestorage (= 7.1.1)
49
+ activesupport (= 7.1.1)
47
50
  globalid (>= 0.6.0)
48
51
  nokogiri (>= 1.8.5)
49
- actionview (7.0.5)
50
- activesupport (= 7.0.5)
52
+ actionview (7.1.1)
53
+ activesupport (= 7.1.1)
51
54
  builder (~> 3.1)
52
- erubi (~> 1.4)
53
- rails-dom-testing (~> 2.0)
54
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.5)
56
- activesupport (= 7.0.5)
55
+ erubi (~> 1.11)
56
+ rails-dom-testing (~> 2.2)
57
+ rails-html-sanitizer (~> 1.6)
58
+ activejob (7.1.1)
59
+ activesupport (= 7.1.1)
57
60
  globalid (>= 0.3.6)
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)
61
+ activemodel (7.1.1)
62
+ activesupport (= 7.1.1)
63
+ activerecord (7.1.1)
64
+ activemodel (= 7.1.1)
65
+ activesupport (= 7.1.1)
66
+ timeout (>= 0.4.0)
67
+ activestorage (7.1.1)
68
+ actionpack (= 7.1.1)
69
+ activejob (= 7.1.1)
70
+ activerecord (= 7.1.1)
71
+ activesupport (= 7.1.1)
68
72
  marcel (~> 1.0)
69
- mini_mime (>= 1.1.0)
70
- activesupport (7.0.5)
73
+ activesupport (7.1.1)
74
+ base64
75
+ bigdecimal
71
76
  concurrent-ruby (~> 1.0, >= 1.0.2)
77
+ connection_pool (>= 2.2.5)
78
+ drb
72
79
  i18n (>= 1.6, < 2)
73
80
  minitest (>= 5.1)
81
+ mutex_m
74
82
  tzinfo (~> 2.0)
75
83
  ast (2.4.2)
84
+ base64 (0.1.1)
85
+ bigdecimal (3.1.4)
76
86
  builder (3.2.4)
77
87
  coderay (1.1.3)
78
88
  concurrent-ruby (1.2.2)
89
+ connection_pool (2.4.1)
79
90
  crass (1.0.6)
80
91
  date (3.3.3)
81
92
  diff-lcs (1.5.0)
93
+ drb (2.1.1)
94
+ ruby2_keywords
82
95
  erubi (1.12.0)
83
- globalid (1.1.0)
84
- activesupport (>= 5.0)
96
+ globalid (1.2.1)
97
+ activesupport (>= 6.1)
85
98
  i18n (1.14.1)
86
99
  concurrent-ruby (~> 1.0)
100
+ io-console (0.6.0)
101
+ irb (1.8.3)
102
+ rdoc
103
+ reline (>= 0.3.8)
87
104
  json (2.6.3)
88
- loofah (2.21.3)
105
+ loofah (2.21.4)
89
106
  crass (~> 1.0.2)
90
107
  nokogiri (>= 1.12.0)
91
108
  mail (2.8.1)
@@ -95,66 +112,80 @@ GEM
95
112
  net-smtp
96
113
  marcel (1.0.2)
97
114
  method_source (1.0.0)
98
- mini_mime (1.1.2)
99
- minitest (5.18.0)
100
- net-imap (0.3.4)
115
+ mini_mime (1.1.5)
116
+ minitest (5.20.0)
117
+ mutex_m (0.1.2)
118
+ net-imap (0.4.3)
101
119
  date
102
120
  net-protocol
103
121
  net-pop (0.1.2)
104
122
  net-protocol
105
123
  net-protocol (0.2.1)
106
124
  timeout
107
- net-smtp (0.3.3)
125
+ net-smtp (0.4.0)
108
126
  net-protocol
109
127
  nio4r (2.5.9)
110
- nokogiri (1.15.2-arm64-darwin)
128
+ nokogiri (1.15.4-arm64-darwin)
111
129
  racc (~> 1.4)
112
- nokogiri (1.15.2-x86_64-darwin)
130
+ nokogiri (1.15.4-x86_64-darwin)
113
131
  racc (~> 1.4)
114
- nokogiri (1.15.2-x86_64-linux)
132
+ nokogiri (1.15.4-x86_64-linux)
115
133
  racc (~> 1.4)
116
134
  parallel (1.23.0)
117
- parser (3.2.2.3)
135
+ parser (3.2.2.4)
118
136
  ast (~> 2.4.1)
119
137
  racc
120
138
  pry (0.14.2)
121
139
  coderay (~> 1.1)
122
140
  method_source (~> 1.0)
123
- racc (1.7.0)
124
- rack (2.2.7)
141
+ psych (5.1.1.1)
142
+ stringio
143
+ racc (1.7.1)
144
+ rack (3.0.8)
145
+ rack-session (2.0.0)
146
+ rack (>= 3.0.0)
125
147
  rack-test (2.1.0)
126
148
  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)
149
+ rackup (2.1.0)
150
+ rack (>= 3)
151
+ webrick (~> 1.8)
152
+ rails (7.1.1)
153
+ actioncable (= 7.1.1)
154
+ actionmailbox (= 7.1.1)
155
+ actionmailer (= 7.1.1)
156
+ actionpack (= 7.1.1)
157
+ actiontext (= 7.1.1)
158
+ actionview (= 7.1.1)
159
+ activejob (= 7.1.1)
160
+ activemodel (= 7.1.1)
161
+ activerecord (= 7.1.1)
162
+ activestorage (= 7.1.1)
163
+ activesupport (= 7.1.1)
139
164
  bundler (>= 1.15.0)
140
- railties (= 7.0.5)
141
- rails-dom-testing (2.0.3)
142
- activesupport (>= 4.2.0)
165
+ railties (= 7.1.1)
166
+ rails-dom-testing (2.2.0)
167
+ activesupport (>= 5.0.0)
168
+ minitest
143
169
  nokogiri (>= 1.6)
144
170
  rails-html-sanitizer (1.6.0)
145
171
  loofah (~> 2.21)
146
172
  nokogiri (~> 1.14)
147
- railties (7.0.5)
148
- actionpack (= 7.0.5)
149
- activesupport (= 7.0.5)
150
- method_source
173
+ railties (7.1.1)
174
+ actionpack (= 7.1.1)
175
+ activesupport (= 7.1.1)
176
+ irb
177
+ rackup (>= 1.0.0)
151
178
  rake (>= 12.2)
152
- thor (~> 1.0)
153
- zeitwerk (~> 2.5)
179
+ thor (~> 1.0, >= 1.2.2)
180
+ zeitwerk (~> 2.6)
154
181
  rainbow (3.1.1)
155
- rake (13.0.6)
156
- regexp_parser (2.8.0)
157
- rexml (3.2.5)
182
+ rake (13.1.0)
183
+ rdoc (6.5.0)
184
+ psych (>= 4.0.0)
185
+ regexp_parser (2.8.2)
186
+ reline (0.3.9)
187
+ io-console (~> 0.5)
188
+ rexml (3.2.6)
158
189
  rspec (3.12.0)
159
190
  rspec-core (~> 3.12.0)
160
191
  rspec-expectations (~> 3.12.0)
@@ -164,10 +195,10 @@ GEM
164
195
  rspec-expectations (3.12.3)
165
196
  diff-lcs (>= 1.2.0, < 2.0)
166
197
  rspec-support (~> 3.12.0)
167
- rspec-mocks (3.12.5)
198
+ rspec-mocks (3.12.6)
168
199
  diff-lcs (>= 1.2.0, < 2.0)
169
200
  rspec-support (~> 3.12.0)
170
- rspec-support (3.12.0)
201
+ rspec-support (3.12.1)
171
202
  rubocop (1.50.2)
172
203
  json (~> 2.3)
173
204
  parallel (~> 1.10)
@@ -178,9 +209,9 @@ GEM
178
209
  rubocop-ast (>= 1.28.0, < 2.0)
179
210
  ruby-progressbar (~> 1.7)
180
211
  unicode-display_width (>= 2.4.0, < 3.0)
181
- rubocop-ast (1.29.0)
212
+ rubocop-ast (1.30.0)
182
213
  parser (>= 3.2.1.0)
183
- rubocop-capybara (2.18.0)
214
+ rubocop-capybara (2.19.0)
184
215
  rubocop (~> 1.41)
185
216
  rubocop-config-umbrellio (1.50.0.85)
186
217
  rubocop (~> 1.50.0)
@@ -204,15 +235,18 @@ GEM
204
235
  rubocop-sequel (0.3.4)
205
236
  rubocop (~> 1.0)
206
237
  ruby-progressbar (1.13.0)
207
- thor (1.2.2)
208
- timeout (0.3.2)
238
+ ruby2_keywords (0.0.5)
239
+ stringio (3.0.8)
240
+ thor (1.3.0)
241
+ timeout (0.4.0)
209
242
  tzinfo (2.0.6)
210
243
  concurrent-ruby (~> 1.0)
211
- unicode-display_width (2.4.2)
212
- websocket-driver (0.7.5)
244
+ unicode-display_width (2.5.0)
245
+ webrick (1.8.1)
246
+ websocket-driver (0.7.6)
213
247
  websocket-extensions (>= 0.1.0)
214
248
  websocket-extensions (0.1.5)
215
- zeitwerk (2.6.8)
249
+ zeitwerk (2.6.12)
216
250
 
217
251
  PLATFORMS
218
252
  arm64-darwin-22
@@ -229,4 +263,4 @@ DEPENDENCIES
229
263
  rubocop-config-umbrellio
230
264
 
231
265
  BUNDLED WITH
232
- 2.4.13
266
+ 2.4.19
data/README.md CHANGED
@@ -33,11 +33,11 @@ end
33
33
  ```
34
34
 
35
35
  If you want to implement Rails monkey patches for `Rails.application.config_for` and ability to
36
- separate `database.yml` file you need to apply `#init_rails_monkey_patch!` method in your
36
+ separate `database.yml` file you need to apply `#init_rails_patch!` method in your
37
37
  `application.yml` file before application initialization.
38
38
 
39
39
  ```ruby
40
- ConfigDefault.init_rails_monkey_patch!
40
+ ConfigDefault.init_rails_patch!
41
41
  ```
42
42
 
43
43
  ## Usage
@@ -1,12 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ module ConfigDefault::RailsApplicationConfigurationPatch
4
+ def load_database_yaml
5
+ ConfigDefault.load(:database, key: nil)
6
+ end
7
+
8
+ def database_configuration
9
+ load_database_yaml
10
+ end
11
+ end
12
+
13
+ module ConfigDefault::RailsApplicationPatch
14
+ def config_for(name, env: Rails.env)
15
+ data = ConfigDefault.load(name, key: env, deep_symbolize_keys: true)
16
+ ActiveSupport::OrderedOptions.new.merge(data)
17
+ end
18
+ end
19
+
3
20
  module ConfigDefault::Init
4
21
  extend self
5
22
 
6
- def init_rails_monkey_patch!
23
+ def init_rails_patch!
7
24
  return unless Object.const_defined?(:Rails)
8
25
 
9
- Rails::Application.prepend(ConfigDefault::RailsApplicationExtension)
10
- Rails::Application::Configuration.prepend(ConfigDefault::RailsApplicationConfigurationExtension)
26
+ Rails::Application.prepend(ConfigDefault::RailsApplicationPatch)
27
+ Rails::Application::Configuration.prepend(ConfigDefault::RailsApplicationConfigurationPatch)
11
28
  end
12
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ConfigDefault
4
- VERSION = "0.2.5"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -6,8 +6,6 @@ require "config_default/version"
6
6
  require "config_default/config"
7
7
  require "config_default/init"
8
8
  require "config_default/struct"
9
- require "config_default/rails_application_extension"
10
- require "config_default/rails_application_configuration_extension"
11
9
 
12
10
  module ConfigDefault
13
11
  extend self
@@ -20,8 +18,8 @@ module ConfigDefault
20
18
  yield(config) if block_given?
21
19
  end
22
20
 
23
- def init_rails_monkey_patch!
24
- ConfigDefault::Init.init_rails_monkey_patch!
21
+ def init_rails_patch!
22
+ ConfigDefault::Init.init_rails_patch!
25
23
  end
26
24
 
27
25
  def load(name, key: Rails.env, symbolize_keys: false, deep_symbolize_keys: false)
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.5
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stepan Kirushkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-09 00:00:00.000000000 Z
11
+ date: 2023-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -47,8 +47,6 @@ files:
47
47
  - lib/config_default.rb
48
48
  - lib/config_default/config.rb
49
49
  - lib/config_default/init.rb
50
- - lib/config_default/rails_application_configuration_extension.rb
51
- - lib/config_default/rails_application_extension.rb
52
50
  - lib/config_default/struct.rb
53
51
  - lib/config_default/version.rb
54
52
  homepage: https://github.com/skirushkin/config_default
@@ -73,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
71
  - !ruby/object:Gem::Version
74
72
  version: '0'
75
73
  requirements: []
76
- rubygems_version: 3.4.13
74
+ rubygems_version: 3.4.19
77
75
  signing_key:
78
76
  specification_version: 4
79
77
  summary: A simple way to manage default and env configuration in Rails.
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ConfigDefault::RailsApplicationConfigurationExtension
4
- def load_database_yaml
5
- ConfigDefault.load(:database, key: nil)
6
- end
7
-
8
- def database_configuration
9
- load_database_yaml
10
- end
11
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ConfigDefault::RailsApplicationExtension
4
- def config_for(name, env: Rails.env)
5
- data = ConfigDefault.load(name, key: env, deep_symbolize_keys: true)
6
- ActiveSupport::OrderedOptions.new.merge(data)
7
- end
8
- end