config 5.0.0 → 5.2.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 +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +2 -0
- data/config.gemspec +5 -0
- data/lib/config/integrations/heroku.rb +2 -2
- data/lib/config/options.rb +11 -1
- data/lib/config/version.rb +1 -1
- data/lib/config.rb +6 -4
- data/lib/generators/config/install_generator.rb +6 -6
- data/lib/generators/config/templates/config.rb +5 -0
- metadata +7 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e9473a6dc953514afb09fbefa950f14cf7fe20e9cf461740e682404dc06ea726
|
|
4
|
+
data.tar.gz: 2dcd6fb8e88fbc2b04c152a424ad4877804e0c7e5607fc4d1b9be6000b02bf92
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '049ac670db93d0c93e7d3fe60688ae3edda405e9f28b67d2464d660ccd9a6dbbfd5d66e57d1d25b1b3fa763956d719e5fe252e7d5147e0bfc4da0f458b0f726f'
|
|
7
|
+
data.tar.gz: 20774a5e9bfcbc377cd1969a133129b1259ccd9d211651312fce5e69a98999766ccb11ca1521e661f168086bfcd310f87840c141d2acd923b5fe708bf3fd8a26
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.2.0
|
|
4
|
+
|
|
5
|
+
### New features
|
|
6
|
+
|
|
7
|
+
* Allow to use custom filename && directory name to store configs ([#341](https://github.com/rubyconfig/config/pull/341))
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
* Prevent name collision with private methods from ancestors ([#351](https://github.com/rubyconfig/config/pull/351))
|
|
12
|
+
|
|
13
|
+
## 5.1.0
|
|
14
|
+
|
|
15
|
+
* Fix conflicts with Rails 7 active_support methods ([#347](https://github.com/rubyconfig/config/pull/347))
|
|
16
|
+
|
|
3
17
|
## 5.0.0
|
|
4
18
|
|
|
5
19
|
### BREAKING CHANGES
|
data/README.md
CHANGED
|
@@ -270,6 +270,8 @@ After installing `Config` in Rails, you will find automatically generated file t
|
|
|
270
270
|
|
|
271
271
|
* `const_name` - name of the object holing you settings. Default: `'Settings'`
|
|
272
272
|
* `evaluate_erb_in_yaml` - evaluate ERB in YAML config files. Set to false if the config file contains ERB that should not be evaluated at load time. Default: `true`
|
|
273
|
+
* `file_name` - name of the file to store general keys accessible in all environments. Default: `'settings'` - located at `config/settings.yml`
|
|
274
|
+
* `dir_name` - name of the directory to store environment-specific files. Default: `'settings'` - located at `config/settings/`
|
|
273
275
|
|
|
274
276
|
### Merge customization
|
|
275
277
|
|
data/config.gemspec
CHANGED
|
@@ -20,6 +20,11 @@ Please consider donating to our open collective to help us maintain this project
|
|
|
20
20
|
\n
|
|
21
21
|
Donate: \e[34mhttps://opencollective.com/rubyconfig/donate\e[0m\n"
|
|
22
22
|
|
|
23
|
+
s.metadata = {
|
|
24
|
+
'changelog_uri' => "https://github.com/rubyconfig/config/blob/master/CHANGELOG.md",
|
|
25
|
+
'source_code_uri' => 'https://github.com/rubyconfig/config',
|
|
26
|
+
'bug_tracker_uri' => 'https://github.com/rubyconfig/config/issues'
|
|
27
|
+
}
|
|
23
28
|
s.files = `git ls-files`.split($/)
|
|
24
29
|
s.files.select! { |file| /(^lib\/|^\w+.md$|\.gemspec$)/ =~ file }
|
|
25
30
|
|
|
@@ -14,8 +14,8 @@ module Config
|
|
|
14
14
|
def vars
|
|
15
15
|
# Load only local options to Heroku
|
|
16
16
|
Config.load_and_set_settings(
|
|
17
|
-
Rails.root.join("config", "
|
|
18
|
-
Rails.root.join("config",
|
|
17
|
+
Rails.root.join("config", "#{Config.file_name}.local.yml").to_s,
|
|
18
|
+
Rails.root.join("config", Config.dir_name, "#{environment}.local.yml").to_s,
|
|
19
19
|
Rails.root.join("config", "environments", "#{environment}.local.yml").to_s
|
|
20
20
|
)
|
|
21
21
|
|
data/lib/config/options.rb
CHANGED
|
@@ -114,11 +114,15 @@ module Config
|
|
|
114
114
|
# Some keywords that don't play nicely with OpenStruct
|
|
115
115
|
SETTINGS_RESERVED_NAMES = %w[select collect test count zip min max exit! table].freeze
|
|
116
116
|
|
|
117
|
+
# Some keywords that don't play nicely with Rails 7.*
|
|
118
|
+
RAILS_RESERVED_NAMES = %w[maximum minimum].freeze
|
|
119
|
+
|
|
117
120
|
# An alternative mechanism for property access.
|
|
118
121
|
# This let's you do foo['bar'] along with foo.bar.
|
|
119
122
|
def [](param)
|
|
120
123
|
return super if SETTINGS_RESERVED_NAMES.include?(param)
|
|
121
|
-
|
|
124
|
+
return super if RAILS_RESERVED_NAMES.include?(param)
|
|
125
|
+
public_send("#{param}")
|
|
122
126
|
end
|
|
123
127
|
|
|
124
128
|
def []=(param, value)
|
|
@@ -131,6 +135,12 @@ module Config
|
|
|
131
135
|
end
|
|
132
136
|
end
|
|
133
137
|
|
|
138
|
+
RAILS_RESERVED_NAMES.each do |name|
|
|
139
|
+
define_method name do
|
|
140
|
+
self[name]
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
134
144
|
def key?(key)
|
|
135
145
|
@table.key?(key)
|
|
136
146
|
end
|
data/lib/config/version.rb
CHANGED
data/lib/config.rb
CHANGED
|
@@ -19,6 +19,8 @@ module Config
|
|
|
19
19
|
env_converter: :downcase,
|
|
20
20
|
env_parse_values: true,
|
|
21
21
|
fail_on_missing: false,
|
|
22
|
+
file_name: 'settings',
|
|
23
|
+
dir_name: 'settings',
|
|
22
24
|
# deep_merge options
|
|
23
25
|
knockout_prefix: nil,
|
|
24
26
|
merge_nil_values: true,
|
|
@@ -58,8 +60,8 @@ module Config
|
|
|
58
60
|
|
|
59
61
|
def self.setting_files(config_root, env)
|
|
60
62
|
[
|
|
61
|
-
File.join(config_root,
|
|
62
|
-
File.join(config_root,
|
|
63
|
+
File.join(config_root, "#{Config.file_name}.yml").to_s,
|
|
64
|
+
File.join(config_root, Config.dir_name, "#{env}.yml").to_s,
|
|
63
65
|
File.join(config_root, 'environments', "#{env}.yml").to_s,
|
|
64
66
|
*local_setting_files(config_root, env)
|
|
65
67
|
].freeze
|
|
@@ -67,8 +69,8 @@ module Config
|
|
|
67
69
|
|
|
68
70
|
def self.local_setting_files(config_root, env)
|
|
69
71
|
[
|
|
70
|
-
(File.join(config_root,
|
|
71
|
-
File.join(config_root,
|
|
72
|
+
(File.join(config_root, "#{Config.file_name}.local.yml").to_s if env != 'test'),
|
|
73
|
+
File.join(config_root, Config.dir_name, "#{env}.local.yml").to_s,
|
|
72
74
|
File.join(config_root, 'environments', "#{env}.local.yml").to_s
|
|
73
75
|
].compact
|
|
74
76
|
end
|
|
@@ -12,18 +12,18 @@ module Config
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def copy_settings
|
|
15
|
-
template "settings.yml", "config
|
|
16
|
-
template "settings.local.yml", "config
|
|
17
|
-
directory "settings", "config
|
|
15
|
+
template "settings.yml", "config/#{Config.file_name}.yml"
|
|
16
|
+
template "settings.local.yml", "config/#{Config.file_name}.local.yml"
|
|
17
|
+
directory "settings", "config/#{Config.dir_name}"
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def modify_gitignore
|
|
21
21
|
create_file '.gitignore' unless File.exist? '.gitignore'
|
|
22
22
|
|
|
23
23
|
append_to_file '.gitignore' do
|
|
24
|
-
"\n"
|
|
25
|
-
"config
|
|
26
|
-
"config
|
|
24
|
+
"\n" +
|
|
25
|
+
"config/#{Config.file_name}.local.yml\n" +
|
|
26
|
+
"config/#{Config.dir_name}/*.local.yml\n" +
|
|
27
27
|
"config/environments/*.local.yml\n"
|
|
28
28
|
end
|
|
29
29
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: config
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Piotr Kuczynski
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2024-03-01 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: deep_merge
|
|
@@ -261,7 +261,10 @@ files:
|
|
|
261
261
|
homepage: https://github.com/rubyconfig/config
|
|
262
262
|
licenses:
|
|
263
263
|
- MIT
|
|
264
|
-
metadata:
|
|
264
|
+
metadata:
|
|
265
|
+
changelog_uri: https://github.com/rubyconfig/config/blob/master/CHANGELOG.md
|
|
266
|
+
source_code_uri: https://github.com/rubyconfig/config
|
|
267
|
+
bug_tracker_uri: https://github.com/rubyconfig/config/issues
|
|
265
268
|
post_install_message: "\n\e[33mThanks for installing Config\e[0m\nPlease consider
|
|
266
269
|
donating to our open collective to help us maintain this project.\n\n\nDonate: \e[34mhttps://opencollective.com/rubyconfig/donate\e[0m\n"
|
|
267
270
|
rdoc_options:
|
|
@@ -279,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
279
282
|
- !ruby/object:Gem::Version
|
|
280
283
|
version: '0'
|
|
281
284
|
requirements: []
|
|
282
|
-
rubygems_version: 3.4.
|
|
285
|
+
rubygems_version: 3.4.22
|
|
283
286
|
signing_key:
|
|
284
287
|
specification_version: 4
|
|
285
288
|
summary: Effortless multi-environment settings in Rails, Sinatra, Padrino and others
|