config_default 0.2.5 → 0.3.1

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: 175dc5b4b199aaf4aae09af5ca3da95703a3a25d9699937cb0bd3b9a1c72868b
4
+ data.tar.gz: 11d65678fb73c61e856e71daf8e760e6437d12b0bb20008408354d91564adaf4
5
5
  SHA512:
6
- metadata.gz: 4d060c70fe676be1172615599c64ba5c59f3b03c3b9313c5758e5724dd256c02def5b05697f44b39c17c1fdc352753f1dc6b32cc74e41ac51cd446f440683252
7
- data.tar.gz: 2a8133cb3fe79507af9dc42c9d86aaa96e8d47f5cf1a82b67ff58eddb5027adb8e4a81f2364fc566659f2b22497dd60a5078d0ca668dd836155f09180f1b70c5
6
+ metadata.gz: 1669e9cacd6e5dfd35d0adf2f7b86bde90a607fab534b99c227f83d35d1dd89ca1b55c403bd721dc79262dcc35dd769d8e464227e71a74045a9a81dd3fe4cc6f
7
+ data.tar.gz: 7014315c985528650a0b930a761664fe59c33dca909409456d5133470790635139aeabe4e6e7e9f4800328e4ab2a02df29a40ebe8fe3e4eff358315ed9632bf8
@@ -1,4 +1,4 @@
1
- name: Test
1
+ name: CI
2
2
 
3
3
  on:
4
4
  push:
@@ -24,7 +24,7 @@ jobs:
24
24
 
25
25
  strategy:
26
26
  matrix:
27
- ruby: [2.7, 3.0, 3.1, 3.2]
27
+ ruby: [3.0, 3.1, 3.2]
28
28
 
29
29
  steps:
30
30
  - uses: actions/checkout@v2
@@ -34,3 +34,20 @@ jobs:
34
34
  bundler-cache: true
35
35
  - name: Run rspec
36
36
  run: bundle exec rspec
37
+
38
+ release:
39
+ runs-on: ubuntu-latest
40
+
41
+ environment: release
42
+
43
+ if: github.event_name == 'push' && github.ref == 'refs/heads/master'
44
+
45
+ steps:
46
+ - uses: actions/checkout@v3
47
+
48
+ - name: Release Gem
49
+ uses: skirushkin/publish-rubygems-action@main
50
+ env:
51
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
52
+ GIT_EMAIL: stepan.kirushkin@gmail.com
53
+ GIT_NAME: Stepan Kirushkin
data/Gemfile.lock CHANGED
@@ -1,91 +1,109 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- config_default (0.2.5)
4
+ config_default (0.3.1)
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.3)
11
+ actionpack (= 7.1.3)
12
+ activesupport (= 7.1.3)
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.3)
17
+ actionpack (= 7.1.3)
18
+ activejob (= 7.1.3)
19
+ activerecord (= 7.1.3)
20
+ activestorage (= 7.1.3)
21
+ activesupport (= 7.1.3)
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.3)
27
+ actionpack (= 7.1.3)
28
+ actionview (= 7.1.3)
29
+ activejob (= 7.1.3)
30
+ activesupport (= 7.1.3)
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.3)
37
+ actionview (= 7.1.3)
38
+ activesupport (= 7.1.3)
39
+ nokogiri (>= 1.8.5)
40
+ racc
41
+ rack (>= 2.2.4)
42
+ rack-session (>= 1.0.1)
39
43
  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)
44
+ rails-dom-testing (~> 2.2)
45
+ rails-html-sanitizer (~> 1.6)
46
+ actiontext (7.1.3)
47
+ actionpack (= 7.1.3)
48
+ activerecord (= 7.1.3)
49
+ activestorage (= 7.1.3)
50
+ activesupport (= 7.1.3)
47
51
  globalid (>= 0.6.0)
48
52
  nokogiri (>= 1.8.5)
49
- actionview (7.0.5)
50
- activesupport (= 7.0.5)
53
+ actionview (7.1.3)
54
+ activesupport (= 7.1.3)
51
55
  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)
56
+ erubi (~> 1.11)
57
+ rails-dom-testing (~> 2.2)
58
+ rails-html-sanitizer (~> 1.6)
59
+ activejob (7.1.3)
60
+ activesupport (= 7.1.3)
57
61
  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)
62
+ activemodel (7.1.3)
63
+ activesupport (= 7.1.3)
64
+ activerecord (7.1.3)
65
+ activemodel (= 7.1.3)
66
+ activesupport (= 7.1.3)
67
+ timeout (>= 0.4.0)
68
+ activestorage (7.1.3)
69
+ actionpack (= 7.1.3)
70
+ activejob (= 7.1.3)
71
+ activerecord (= 7.1.3)
72
+ activesupport (= 7.1.3)
68
73
  marcel (~> 1.0)
69
- mini_mime (>= 1.1.0)
70
- activesupport (7.0.5)
74
+ activesupport (7.1.3)
75
+ base64
76
+ bigdecimal
71
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
78
+ connection_pool (>= 2.2.5)
79
+ drb
72
80
  i18n (>= 1.6, < 2)
73
81
  minitest (>= 5.1)
82
+ mutex_m
74
83
  tzinfo (~> 2.0)
75
84
  ast (2.4.2)
85
+ base64 (0.2.0)
86
+ bigdecimal (3.1.6)
76
87
  builder (3.2.4)
77
88
  coderay (1.1.3)
78
- concurrent-ruby (1.2.2)
89
+ concurrent-ruby (1.2.3)
90
+ connection_pool (2.4.1)
79
91
  crass (1.0.6)
80
- date (3.3.3)
81
- diff-lcs (1.5.0)
92
+ date (3.3.4)
93
+ diff-lcs (1.5.1)
94
+ drb (2.2.0)
95
+ ruby2_keywords
82
96
  erubi (1.12.0)
83
- globalid (1.1.0)
84
- activesupport (>= 5.0)
97
+ globalid (1.2.1)
98
+ activesupport (>= 6.1)
85
99
  i18n (1.14.1)
86
100
  concurrent-ruby (~> 1.0)
87
- json (2.6.3)
88
- loofah (2.21.3)
101
+ io-console (0.7.2)
102
+ irb (1.11.1)
103
+ rdoc
104
+ reline (>= 0.4.2)
105
+ json (2.7.1)
106
+ loofah (2.22.0)
89
107
  crass (~> 1.0.2)
90
108
  nokogiri (>= 1.12.0)
91
109
  mail (2.8.1)
@@ -95,79 +113,93 @@ GEM
95
113
  net-smtp
96
114
  marcel (1.0.2)
97
115
  method_source (1.0.0)
98
- mini_mime (1.1.2)
99
- minitest (5.18.0)
100
- net-imap (0.3.4)
116
+ mini_mime (1.1.5)
117
+ minitest (5.22.0)
118
+ mutex_m (0.2.0)
119
+ net-imap (0.4.10)
101
120
  date
102
121
  net-protocol
103
122
  net-pop (0.1.2)
104
123
  net-protocol
105
- net-protocol (0.2.1)
124
+ net-protocol (0.2.2)
106
125
  timeout
107
- net-smtp (0.3.3)
126
+ net-smtp (0.4.0.1)
108
127
  net-protocol
109
- nio4r (2.5.9)
110
- nokogiri (1.15.2-arm64-darwin)
128
+ nio4r (2.7.0)
129
+ nokogiri (1.16.2-arm64-darwin)
111
130
  racc (~> 1.4)
112
- nokogiri (1.15.2-x86_64-darwin)
131
+ nokogiri (1.16.2-x86_64-darwin)
113
132
  racc (~> 1.4)
114
- nokogiri (1.15.2-x86_64-linux)
133
+ nokogiri (1.16.2-x86_64-linux)
115
134
  racc (~> 1.4)
116
- parallel (1.23.0)
117
- parser (3.2.2.3)
135
+ parallel (1.24.0)
136
+ parser (3.3.0.5)
118
137
  ast (~> 2.4.1)
119
138
  racc
120
139
  pry (0.14.2)
121
140
  coderay (~> 1.1)
122
141
  method_source (~> 1.0)
123
- racc (1.7.0)
124
- rack (2.2.7)
142
+ psych (5.1.2)
143
+ stringio
144
+ racc (1.7.3)
145
+ rack (3.0.9)
146
+ rack-session (2.0.0)
147
+ rack (>= 3.0.0)
125
148
  rack-test (2.1.0)
126
149
  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)
150
+ rackup (2.1.0)
151
+ rack (>= 3)
152
+ webrick (~> 1.8)
153
+ rails (7.1.3)
154
+ actioncable (= 7.1.3)
155
+ actionmailbox (= 7.1.3)
156
+ actionmailer (= 7.1.3)
157
+ actionpack (= 7.1.3)
158
+ actiontext (= 7.1.3)
159
+ actionview (= 7.1.3)
160
+ activejob (= 7.1.3)
161
+ activemodel (= 7.1.3)
162
+ activerecord (= 7.1.3)
163
+ activestorage (= 7.1.3)
164
+ activesupport (= 7.1.3)
139
165
  bundler (>= 1.15.0)
140
- railties (= 7.0.5)
141
- rails-dom-testing (2.0.3)
142
- activesupport (>= 4.2.0)
166
+ railties (= 7.1.3)
167
+ rails-dom-testing (2.2.0)
168
+ activesupport (>= 5.0.0)
169
+ minitest
143
170
  nokogiri (>= 1.6)
144
171
  rails-html-sanitizer (1.6.0)
145
172
  loofah (~> 2.21)
146
173
  nokogiri (~> 1.14)
147
- railties (7.0.5)
148
- actionpack (= 7.0.5)
149
- activesupport (= 7.0.5)
150
- method_source
174
+ railties (7.1.3)
175
+ actionpack (= 7.1.3)
176
+ activesupport (= 7.1.3)
177
+ irb
178
+ rackup (>= 1.0.0)
151
179
  rake (>= 12.2)
152
- thor (~> 1.0)
153
- zeitwerk (~> 2.5)
180
+ thor (~> 1.0, >= 1.2.2)
181
+ zeitwerk (~> 2.6)
154
182
  rainbow (3.1.1)
155
- rake (13.0.6)
156
- regexp_parser (2.8.0)
157
- rexml (3.2.5)
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)
183
+ rake (13.1.0)
184
+ rdoc (6.6.2)
185
+ psych (>= 4.0.0)
186
+ regexp_parser (2.9.0)
187
+ reline (0.4.2)
188
+ io-console (~> 0.5)
189
+ rexml (3.2.6)
190
+ rspec (3.13.0)
191
+ rspec-core (~> 3.13.0)
192
+ rspec-expectations (~> 3.13.0)
193
+ rspec-mocks (~> 3.13.0)
194
+ rspec-core (3.13.0)
195
+ rspec-support (~> 3.13.0)
196
+ rspec-expectations (3.13.0)
165
197
  diff-lcs (>= 1.2.0, < 2.0)
166
- rspec-support (~> 3.12.0)
167
- rspec-mocks (3.12.5)
198
+ rspec-support (~> 3.13.0)
199
+ rspec-mocks (3.13.0)
168
200
  diff-lcs (>= 1.2.0, < 2.0)
169
- rspec-support (~> 3.12.0)
170
- rspec-support (3.12.0)
201
+ rspec-support (~> 3.13.0)
202
+ rspec-support (3.13.0)
171
203
  rubocop (1.50.2)
172
204
  json (~> 2.3)
173
205
  parallel (~> 1.10)
@@ -178,9 +210,9 @@ GEM
178
210
  rubocop-ast (>= 1.28.0, < 2.0)
179
211
  ruby-progressbar (~> 1.7)
180
212
  unicode-display_width (>= 2.4.0, < 3.0)
181
- rubocop-ast (1.29.0)
213
+ rubocop-ast (1.30.0)
182
214
  parser (>= 3.2.1.0)
183
- rubocop-capybara (2.18.0)
215
+ rubocop-capybara (2.20.0)
184
216
  rubocop (~> 1.41)
185
217
  rubocop-config-umbrellio (1.50.0.85)
186
218
  rubocop (~> 1.50.0)
@@ -204,15 +236,18 @@ GEM
204
236
  rubocop-sequel (0.3.4)
205
237
  rubocop (~> 1.0)
206
238
  ruby-progressbar (1.13.0)
207
- thor (1.2.2)
208
- timeout (0.3.2)
239
+ ruby2_keywords (0.0.5)
240
+ stringio (3.1.0)
241
+ thor (1.3.0)
242
+ timeout (0.4.1)
209
243
  tzinfo (2.0.6)
210
244
  concurrent-ruby (~> 1.0)
211
- unicode-display_width (2.4.2)
212
- websocket-driver (0.7.5)
245
+ unicode-display_width (2.5.0)
246
+ webrick (1.8.1)
247
+ websocket-driver (0.7.6)
213
248
  websocket-extensions (>= 0.1.0)
214
249
  websocket-extensions (0.1.5)
215
- zeitwerk (2.6.8)
250
+ zeitwerk (2.6.13)
216
251
 
217
252
  PLATFORMS
218
253
  arm64-darwin-22
@@ -229,4 +264,4 @@ DEPENDENCIES
229
264
  rubocop-config-umbrellio
230
265
 
231
266
  BUNDLED WITH
232
- 2.4.13
267
+ 2.5.5
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.1"
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.1
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: 2024-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -33,7 +33,7 @@ executables: []
33
33
  extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
- - ".github/workflows/main.yml"
36
+ - ".github/workflows/ci.yml"
37
37
  - ".gitignore"
38
38
  - ".rubocop.yml"
39
39
  - CHANGELOG.md
@@ -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.5.3
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