config_default 0.1.1 → 0.2.2

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: 8986cd898691eacd74aec36524a3eacd38433629b6ba8e71638619b33dd9f817
4
- data.tar.gz: 87e0031a77052c3f9e42b87a2c670874cca926a6e1d0803c0c9c113d717f441f
3
+ metadata.gz: 22a68604e91e09d6852ff82a00591cd121667b0fa0c5ed55a89e2c9c583c6684
4
+ data.tar.gz: 4e927c83a5531bf50132ade3d27a11a5c8dea03ab8373a7082797c6748c5ef15
5
5
  SHA512:
6
- metadata.gz: f86e0e505bea0492833852ef4957c73ed8b3ab1b1f43e81e114cce90923fe737fb457ddf0259c5234a079b5458e6b1a6325c4dd560d2ad9c64526c63894bb432
7
- data.tar.gz: 68a825fe3fd12616f413d28a20b712b9d8783d18bbc3b88615999502581fcbb58a3f74b714149c7d07ea627a8f721f9f8ff4ade4026a7fe7cf8eed7a7ef1800f
6
+ metadata.gz: 4e0ea59583d2bdebfce8d140ee9299b1b6a2039f952fae3fc11bfd5a2b8cda16a7166df8b0d47398be05be69dbc9181f3bb5dcd791f251e19a88db45061bc59a
7
+ data.tar.gz: 7e00d91352e0b2763748388ef8da77f2776d4df23de4f885c41b22aea2c3885a6e3e57dc3c6fb00d2a397d2a328717ce39cb01f44c4b08e89eb2433b77854bfd
@@ -24,7 +24,7 @@ jobs:
24
24
 
25
25
  strategy:
26
26
  matrix:
27
- ruby: [2.5, 2.6, 2.7, 3.0]
27
+ ruby: [2.7, 3.0, 3.1]
28
28
 
29
29
  steps:
30
30
  - uses: actions/checkout@v2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.2
2
+
3
+ - Move config struct option definition from `#method_missing` to `#define_singleton_method`
4
+
1
5
  ## 0.1.1
2
6
 
3
7
  - Remove Rails dependency.
data/Gemfile.lock CHANGED
@@ -1,83 +1,91 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- config_default (0.1.1)
5
- activesupport (~> 6)
4
+ config_default (0.2.2)
5
+ activesupport (>= 6)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (6.1.4.1)
11
- actionpack (= 6.1.4.1)
12
- activesupport (= 6.1.4.1)
10
+ actioncable (7.0.1)
11
+ actionpack (= 7.0.1)
12
+ activesupport (= 7.0.1)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (6.1.4.1)
16
- actionpack (= 6.1.4.1)
17
- activejob (= 6.1.4.1)
18
- activerecord (= 6.1.4.1)
19
- activestorage (= 6.1.4.1)
20
- activesupport (= 6.1.4.1)
15
+ actionmailbox (7.0.1)
16
+ actionpack (= 7.0.1)
17
+ activejob (= 7.0.1)
18
+ activerecord (= 7.0.1)
19
+ activestorage (= 7.0.1)
20
+ activesupport (= 7.0.1)
21
21
  mail (>= 2.7.1)
22
- actionmailer (6.1.4.1)
23
- actionpack (= 6.1.4.1)
24
- actionview (= 6.1.4.1)
25
- activejob (= 6.1.4.1)
26
- activesupport (= 6.1.4.1)
22
+ net-imap
23
+ net-pop
24
+ net-smtp
25
+ actionmailer (7.0.1)
26
+ actionpack (= 7.0.1)
27
+ actionview (= 7.0.1)
28
+ activejob (= 7.0.1)
29
+ activesupport (= 7.0.1)
27
30
  mail (~> 2.5, >= 2.5.4)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
28
34
  rails-dom-testing (~> 2.0)
29
- actionpack (6.1.4.1)
30
- actionview (= 6.1.4.1)
31
- activesupport (= 6.1.4.1)
32
- rack (~> 2.0, >= 2.0.9)
35
+ actionpack (7.0.1)
36
+ actionview (= 7.0.1)
37
+ activesupport (= 7.0.1)
38
+ rack (~> 2.0, >= 2.2.0)
33
39
  rack-test (>= 0.6.3)
34
40
  rails-dom-testing (~> 2.0)
35
41
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
- actiontext (6.1.4.1)
37
- actionpack (= 6.1.4.1)
38
- activerecord (= 6.1.4.1)
39
- activestorage (= 6.1.4.1)
40
- activesupport (= 6.1.4.1)
42
+ actiontext (7.0.1)
43
+ actionpack (= 7.0.1)
44
+ activerecord (= 7.0.1)
45
+ activestorage (= 7.0.1)
46
+ activesupport (= 7.0.1)
47
+ globalid (>= 0.6.0)
41
48
  nokogiri (>= 1.8.5)
42
- actionview (6.1.4.1)
43
- activesupport (= 6.1.4.1)
49
+ actionview (7.0.1)
50
+ activesupport (= 7.0.1)
44
51
  builder (~> 3.1)
45
52
  erubi (~> 1.4)
46
53
  rails-dom-testing (~> 2.0)
47
54
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.1.4.1)
49
- activesupport (= 6.1.4.1)
55
+ activejob (7.0.1)
56
+ activesupport (= 7.0.1)
50
57
  globalid (>= 0.3.6)
51
- activemodel (6.1.4.1)
52
- activesupport (= 6.1.4.1)
53
- activerecord (6.1.4.1)
54
- activemodel (= 6.1.4.1)
55
- activesupport (= 6.1.4.1)
56
- activestorage (6.1.4.1)
57
- actionpack (= 6.1.4.1)
58
- activejob (= 6.1.4.1)
59
- activerecord (= 6.1.4.1)
60
- activesupport (= 6.1.4.1)
61
- marcel (~> 1.0.0)
58
+ activemodel (7.0.1)
59
+ activesupport (= 7.0.1)
60
+ activerecord (7.0.1)
61
+ activemodel (= 7.0.1)
62
+ activesupport (= 7.0.1)
63
+ activestorage (7.0.1)
64
+ actionpack (= 7.0.1)
65
+ activejob (= 7.0.1)
66
+ activerecord (= 7.0.1)
67
+ activesupport (= 7.0.1)
68
+ marcel (~> 1.0)
62
69
  mini_mime (>= 1.1.0)
63
- activesupport (6.1.4.1)
70
+ activesupport (7.0.1)
64
71
  concurrent-ruby (~> 1.0, >= 1.0.2)
65
72
  i18n (>= 1.6, < 2)
66
73
  minitest (>= 5.1)
67
74
  tzinfo (~> 2.0)
68
- zeitwerk (~> 2.3)
69
75
  ast (2.4.2)
70
76
  builder (3.2.4)
71
77
  coderay (1.1.3)
72
78
  concurrent-ruby (1.1.9)
73
79
  crass (1.0.6)
74
- diff-lcs (1.4.4)
80
+ diff-lcs (1.5.0)
81
+ digest (3.1.0)
75
82
  erubi (1.10.0)
76
- globalid (0.5.2)
83
+ globalid (1.0.0)
77
84
  activesupport (>= 5.0)
78
85
  i18n (1.8.11)
79
86
  concurrent-ruby (~> 1.0)
80
- loofah (2.12.0)
87
+ io-wait (0.2.1)
88
+ loofah (2.13.0)
81
89
  crass (~> 1.0.2)
82
90
  nokogiri (>= 1.5.9)
83
91
  mail (2.7.1)
@@ -85,14 +93,29 @@ GEM
85
93
  marcel (1.0.2)
86
94
  method_source (1.0.0)
87
95
  mini_mime (1.1.2)
88
- minitest (5.14.4)
96
+ minitest (5.15.0)
97
+ net-imap (0.2.3)
98
+ digest
99
+ net-protocol
100
+ strscan
101
+ net-pop (0.1.1)
102
+ digest
103
+ net-protocol
104
+ timeout
105
+ net-protocol (0.1.2)
106
+ io-wait
107
+ timeout
108
+ net-smtp (0.3.1)
109
+ digest
110
+ net-protocol
111
+ timeout
89
112
  nio4r (2.5.8)
90
- nokogiri (1.12.5-x86_64-darwin)
113
+ nokogiri (1.13.1-x86_64-darwin)
91
114
  racc (~> 1.4)
92
- nokogiri (1.12.5-x86_64-linux)
115
+ nokogiri (1.13.1-x86_64-linux)
93
116
  racc (~> 1.4)
94
117
  parallel (1.21.0)
95
- parser (3.0.2.0)
118
+ parser (3.1.0.0)
96
119
  ast (~> 2.4.1)
97
120
  pry (0.14.1)
98
121
  coderay (~> 1.1)
@@ -101,35 +124,35 @@ GEM
101
124
  rack (2.2.3)
102
125
  rack-test (1.1.0)
103
126
  rack (>= 1.0, < 3)
104
- rails (6.1.4.1)
105
- actioncable (= 6.1.4.1)
106
- actionmailbox (= 6.1.4.1)
107
- actionmailer (= 6.1.4.1)
108
- actionpack (= 6.1.4.1)
109
- actiontext (= 6.1.4.1)
110
- actionview (= 6.1.4.1)
111
- activejob (= 6.1.4.1)
112
- activemodel (= 6.1.4.1)
113
- activerecord (= 6.1.4.1)
114
- activestorage (= 6.1.4.1)
115
- activesupport (= 6.1.4.1)
127
+ rails (7.0.1)
128
+ actioncable (= 7.0.1)
129
+ actionmailbox (= 7.0.1)
130
+ actionmailer (= 7.0.1)
131
+ actionpack (= 7.0.1)
132
+ actiontext (= 7.0.1)
133
+ actionview (= 7.0.1)
134
+ activejob (= 7.0.1)
135
+ activemodel (= 7.0.1)
136
+ activerecord (= 7.0.1)
137
+ activestorage (= 7.0.1)
138
+ activesupport (= 7.0.1)
116
139
  bundler (>= 1.15.0)
117
- railties (= 6.1.4.1)
118
- sprockets-rails (>= 2.0.0)
140
+ railties (= 7.0.1)
119
141
  rails-dom-testing (2.0.3)
120
142
  activesupport (>= 4.2.0)
121
143
  nokogiri (>= 1.6)
122
144
  rails-html-sanitizer (1.4.2)
123
145
  loofah (~> 2.3)
124
- railties (6.1.4.1)
125
- actionpack (= 6.1.4.1)
126
- activesupport (= 6.1.4.1)
146
+ railties (7.0.1)
147
+ actionpack (= 7.0.1)
148
+ activesupport (= 7.0.1)
127
149
  method_source
128
- rake (>= 0.13)
150
+ rake (>= 12.2)
129
151
  thor (~> 1.0)
130
- rainbow (3.0.0)
152
+ zeitwerk (~> 2.5)
153
+ rainbow (3.1.1)
131
154
  rake (13.0.6)
132
- regexp_parser (2.1.1)
155
+ regexp_parser (2.2.0)
133
156
  rexml (3.2.5)
134
157
  rspec (3.10.0)
135
158
  rspec-core (~> 3.10.0)
@@ -137,61 +160,55 @@ GEM
137
160
  rspec-mocks (~> 3.10.0)
138
161
  rspec-core (3.10.1)
139
162
  rspec-support (~> 3.10.0)
140
- rspec-expectations (3.10.1)
163
+ rspec-expectations (3.10.2)
141
164
  diff-lcs (>= 1.2.0, < 2.0)
142
165
  rspec-support (~> 3.10.0)
143
166
  rspec-mocks (3.10.2)
144
167
  diff-lcs (>= 1.2.0, < 2.0)
145
168
  rspec-support (~> 3.10.0)
146
169
  rspec-support (3.10.3)
147
- rubocop (1.17.0)
170
+ rubocop (1.25.0)
148
171
  parallel (~> 1.10)
149
- parser (>= 3.0.0.0)
172
+ parser (>= 3.1.0.0)
150
173
  rainbow (>= 2.2.2, < 4.0)
151
174
  regexp_parser (>= 1.8, < 3.0)
152
175
  rexml
153
- rubocop-ast (>= 1.7.0, < 2.0)
176
+ rubocop-ast (>= 1.15.1, < 2.0)
154
177
  ruby-progressbar (~> 1.7)
155
178
  unicode-display_width (>= 1.4.0, < 3.0)
156
- rubocop-ast (1.13.0)
179
+ rubocop-ast (1.15.1)
157
180
  parser (>= 3.0.1.1)
158
- rubocop-config-umbrellio (1.17.0.53)
159
- rubocop (= 1.17.0)
160
- rubocop-performance (= 1.10.0)
161
- rubocop-rails (= 2.9.1)
162
- rubocop-rake (= 0.5.1)
163
- rubocop-rspec (= 2.2.0)
164
- rubocop-sequel (= 0.2.0)
165
- rubocop-performance (1.10.0)
166
- rubocop (>= 0.90.0, < 2.0)
181
+ rubocop-config-umbrellio (1.25.0.61)
182
+ rubocop (~> 1.25.0)
183
+ rubocop-performance (~> 1.13.0)
184
+ rubocop-rails (~> 2.13.0)
185
+ rubocop-rake (~> 0.6.0)
186
+ rubocop-rspec (~> 2.7.0)
187
+ rubocop-sequel (~> 0.3.3)
188
+ rubocop-performance (1.13.2)
189
+ rubocop (>= 1.7.0, < 2.0)
167
190
  rubocop-ast (>= 0.4.0)
168
- rubocop-rails (2.9.1)
191
+ rubocop-rails (2.13.2)
169
192
  activesupport (>= 4.2.0)
170
193
  rack (>= 1.1)
171
- rubocop (>= 0.90.0, < 2.0)
172
- rubocop-rake (0.5.1)
173
- rubocop
174
- rubocop-rspec (2.2.0)
194
+ rubocop (>= 1.7.0, < 2.0)
195
+ rubocop-rake (0.6.0)
175
196
  rubocop (~> 1.0)
176
- rubocop-ast (>= 1.1.0)
177
- rubocop-sequel (0.2.0)
197
+ rubocop-rspec (2.7.0)
198
+ rubocop (~> 1.19)
199
+ rubocop-sequel (0.3.3)
178
200
  rubocop (~> 1.0)
179
201
  ruby-progressbar (1.11.0)
180
- sprockets (4.0.2)
181
- concurrent-ruby (~> 1.0)
182
- rack (> 1, < 3)
183
- sprockets-rails (3.4.0)
184
- actionpack (>= 5.2)
185
- activesupport (>= 5.2)
186
- sprockets (>= 3.0.0)
187
- thor (1.1.0)
202
+ strscan (3.0.1)
203
+ thor (1.2.1)
204
+ timeout (0.2.0)
188
205
  tzinfo (2.0.4)
189
206
  concurrent-ruby (~> 1.0)
190
207
  unicode-display_width (2.1.0)
191
208
  websocket-driver (0.7.5)
192
209
  websocket-extensions (>= 0.1.0)
193
210
  websocket-extensions (0.1.5)
194
- zeitwerk (2.5.1)
211
+ zeitwerk (2.5.3)
195
212
 
196
213
  PLATFORMS
197
214
  x86_64-darwin-20
data/README.md CHANGED
@@ -9,7 +9,7 @@ Maybe in future I'll remove Rails dependency (cause it's never cool) and leave o
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'config_default'
12
+ gem "config_default"
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -33,6 +33,14 @@ ConfigDefault.configure do |config|
33
33
  end
34
34
  ```
35
35
 
36
+ If you want to implement Rails monkey patches for `Rails.application.config_for` and ability to
37
+ separate `database.yml` file you need to apply `#init_rails_monkey_patch!` method in your
38
+ `application.yml` file before application initialization.
39
+
40
+ ```ruby
41
+ ConfigDefault.init_rails_monkey_patch!
42
+ ```
43
+
36
44
  ## Usage
37
45
 
38
46
  ### Default behaviour
@@ -104,7 +112,7 @@ config = ConfigDefault.load(:app, key: nil) # Will not use key at all and result
104
112
  config = ConfigDefault.load(:app, key: "preprod") # Will search preprod key in file
105
113
  ```
106
114
 
107
- ### Struct using
115
+ ### `#load_struct` method
108
116
 
109
117
  If you want to use configuration as a struct object you can use `#load_struct` method.
110
118
  Let's see an example with `database.yaml` config above:
@@ -156,6 +164,24 @@ config.first.second.to_hash
156
164
  # => { "third" => "option" }
157
165
  ```
158
166
 
167
+ ### Using `ConfigDefault::Struct` without configuration load
168
+
169
+ You can use `ConfigDefault::Struct` to achive ability to create config object from Hash objects.
170
+ Here an example of creation struct object on the fly:
171
+
172
+ ```ruby
173
+ config_on_the_fly = { first: { second: { third: "option" } } }
174
+ config = ConfigDefault::Struct.new(attributes: config_on_the_fly, recursive: true)
175
+ config.first.to_hash
176
+ # => { "second" => { "third" => "option" } }
177
+ config.first.second.third
178
+ # => "option"
179
+ config.first.lolkek
180
+ # => StandardError: There is no option :lolkek in configuration.
181
+ ```
182
+
183
+ `ConfigDefault::Struct` supports `recursive` and `allow_nil` options.
184
+
159
185
  ## Contributing
160
186
 
161
187
  Bug reports and pull requests are welcome on GitHub at https://github.com/skirushkin/config_default.
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConfigDefault::Init
4
+ extend self
5
+
6
+ def init_rails_monkey_patch!
7
+ return unless Object.const_defined?(:Rails)
8
+
9
+ Rails::Application.prepend(ConfigDefault::RailsApplicationExtension)
10
+ Rails::Application::Configuration.prepend(ConfigDefault::RailsApplicationConfigurationExtension)
11
+ end
12
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Rails::Application::ConfigurationExtension
3
+ module ConfigDefault::RailsApplicationConfigurationExtension
4
4
  def load_database_yaml
5
5
  ConfigDefault.load(:database, key: nil)
6
6
  end
@@ -9,5 +9,3 @@ module Rails::Application::ConfigurationExtension
9
9
  load_database_yaml
10
10
  end
11
11
  end
12
-
13
- Rails::Application::Configuration.prepend(Rails::Application::ConfigurationExtension)
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Rails::ApplicationExtension
3
+ module ConfigDefault::RailsApplicationExtension
4
4
  def config_for(name, env: Rails.env)
5
5
  data = ConfigDefault.load(name, key: env, deep_symbolize_keys: true)
6
6
  ActiveSupport::OrderedOptions.new.merge(data)
7
7
  end
8
8
  end
9
-
10
- Rails::Application.prepend(Rails::ApplicationExtension)
@@ -1,17 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ConfigDefault::Struct
4
- def initialize(attributes = {}, recursive: false, allow_nil: false)
4
+ RESERVED_METHODS = %i[method_missing respond_to_missing? to_hash].freeze
5
+
6
+ def initialize(attributes:, recursive: false, allow_nil: false)
5
7
  @attributes = ActiveSupport::HashWithIndifferentAccess.new(attributes)
6
8
  @allow_nil = allow_nil
7
9
  @recursive = recursive
8
10
 
9
- if @recursive
10
- @attributes.each do |key, value|
11
- next unless value.is_a?(Hash)
12
- @attributes[key] = self.class.new(value, recursive: @recursive, allow_nil: @allow_nil)
13
- end
14
- end
11
+ make_recursive!
12
+ define_methods!
15
13
 
16
14
  @attributes.freeze
17
15
  end
@@ -21,8 +19,8 @@ class ConfigDefault::Struct
21
19
  end
22
20
 
23
21
  def method_missing(method, *_args)
24
- return @attributes[method] if @attributes.key?(method)
25
- raise StandardError.new("There is no option :#{method} in configuration.") unless @allow_nil
22
+ return if @allow_nil
23
+ raise StandardError.new("There is no option :#{method} in configuration.")
26
24
  end
27
25
 
28
26
  def respond_to_missing?(*_args)
@@ -41,4 +39,26 @@ class ConfigDefault::Struct
41
39
 
42
40
  dup
43
41
  end
42
+
43
+ private
44
+
45
+ def make_recursive!
46
+ return unless @recursive
47
+
48
+ @attributes.each do |key, value|
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
+ )
55
+ end
56
+ end
57
+
58
+ def define_methods!
59
+ @attributes.each do |key, value|
60
+ next if RESERVED_METHODS.include?(key.to_sym)
61
+ define_singleton_method(key) { value }
62
+ end
63
+ end
44
64
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ConfigDefault
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.2"
5
5
  end
@@ -4,8 +4,10 @@ require "active_support/core_ext/hash"
4
4
 
5
5
  require "config_default/version"
6
6
  require "config_default/config"
7
+ require "config_default/init"
7
8
  require "config_default/struct"
8
- require "config_default/rails_monkey_patch"
9
+ require "config_default/rails_application_extension"
10
+ require "config_default/rails_application_configuration_extension"
9
11
 
10
12
  module ConfigDefault
11
13
  extend self
@@ -18,11 +20,15 @@ module ConfigDefault
18
20
  yield(config) if block_given?
19
21
  end
20
22
 
23
+ def init_rails_monkey_patch!
24
+ ConfigDefault::Init.init_rails_monkey_patch!
25
+ end
26
+
21
27
  def load(name, key: Rails.env, symbolize_keys: false, deep_symbolize_keys: false)
22
- base_config = load_file("#{name}.#{config.postfix}")
28
+ default_config = load_file("#{name}.#{config.postfix}")
23
29
  config = load_file(name)
24
30
 
25
- data = base_config.deep_merge(config)
31
+ data = default_config.deep_merge(config)
26
32
  data = key ? data[key] : data
27
33
 
28
34
  if deep_symbolize_keys
@@ -42,9 +48,10 @@ module ConfigDefault
42
48
  end
43
49
 
44
50
  def load_struct(name, key: Rails.env, recursive: false, allow_nil: false)
45
- attributes = load(name, key: key)
46
- ConfigDefault::Struct.new(attributes, recursive: recursive, allow_nil: allow_nil)
51
+ ConfigDefault::Struct.new(
52
+ attributes: load(name, key: key),
53
+ recursive: recursive,
54
+ allow_nil: allow_nil,
55
+ )
47
56
  end
48
57
  end
49
-
50
- ConfigDefault::RailsMonkeyPatch.call
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_default
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stepan Kirushkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-20 00:00:00.000000000 Z
11
+ date: 2022-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '6'
27
27
  description: |2
@@ -44,18 +44,11 @@ files:
44
44
  - Rakefile
45
45
  - bin/console
46
46
  - bin/setup
47
- - config/database.default.yml
48
- - config/database.yml
49
- - config/example1.default.yml
50
- - config/example1.yml
51
- - config/example2.default.yml
52
- - config/example3.yml
53
- - config/nested.yml
54
47
  - lib/config_default.rb
55
48
  - lib/config_default/config.rb
56
- - lib/config_default/rails/application/configuration_extension.rb
57
- - lib/config_default/rails/application_extension.rb
58
- - lib/config_default/rails_monkey_patch.rb
49
+ - lib/config_default/init.rb
50
+ - lib/config_default/rails_application_configuration_extension.rb
51
+ - lib/config_default/rails_application_extension.rb
59
52
  - lib/config_default/struct.rb
60
53
  - lib/config_default/version.rb
61
54
  homepage: https://github.com/skirushkin/config_default
@@ -1,2 +0,0 @@
1
- development:
2
- host: localhost
data/config/database.yml DELETED
@@ -1,2 +0,0 @@
1
- development:
2
- database: example
@@ -1,3 +0,0 @@
1
- development:
2
- first: one
3
- second: two
data/config/example1.yml DELETED
@@ -1,2 +0,0 @@
1
- development:
2
- second: example
@@ -1,2 +0,0 @@
1
- development:
2
- first: one
data/config/example3.yml DELETED
@@ -1,2 +0,0 @@
1
- development:
2
- second: two
data/config/nested.yml DELETED
@@ -1,4 +0,0 @@
1
- development:
2
- first:
3
- second:
4
- third: "three"
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ConfigDefault::RailsMonkeyPatch
4
- extend self
5
-
6
- def call
7
- return unless Object.const_defined?("Rails")
8
- return unless Object.const_defined?("Rails::Application")
9
- return unless Object.const_defined?("Rails::Application::Configuration")
10
-
11
- require "config_default/rails/application_extension"
12
- require "config_default/rails/application/configuration_extension"
13
- end
14
- end