config 5.1.0 → 5.2.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: 0e7864a2d30e62a39dbeb3c3eff43e07568a844b391e8c5f51f49c0712a2786b
4
- data.tar.gz: b79745abcd726d5665aff0069ef3bef63250af5df0157f7515d0f67b65bfc9f6
3
+ metadata.gz: e9473a6dc953514afb09fbefa950f14cf7fe20e9cf461740e682404dc06ea726
4
+ data.tar.gz: 2dcd6fb8e88fbc2b04c152a424ad4877804e0c7e5607fc4d1b9be6000b02bf92
5
5
  SHA512:
6
- metadata.gz: 27b2ac548df27cb149bfb6f60753179d36d6bf2fa3caa0cb7a5f5e456450840357272c4c53bba986ad8f62d12f79960e87183faa2cd48f0afecdb695c802730a
7
- data.tar.gz: 71c11e19fe808da90a497616ff635e00e0a3a86c971b751cf5e9bdebe34d86272a9197ca1b8104f7a1b0d2d98677ecb56bb681168c7a08d9bbc4e7cf9b914913
6
+ metadata.gz: '049ac670db93d0c93e7d3fe60688ae3edda405e9f28b67d2464d660ccd9a6dbbfd5d66e57d1d25b1b3fa763956d719e5fe252e7d5147e0bfc4da0f458b0f726f'
7
+ data.tar.gz: 20774a5e9bfcbc377cd1969a133129b1259ccd9d211651312fce5e69a98999766ccb11ca1521e661f168086bfcd310f87840c141d2acd923b5fe708bf3fd8a26
data/CHANGELOG.md CHANGED
@@ -1,8 +1,18 @@
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
+
3
13
  ## 5.1.0
4
14
 
5
- * Fix conflicts with Rails 7 active_support methods ([#347](https://github.com/rubyconfig/config/pull/339))
15
+ * Fix conflicts with Rails 7 active_support methods ([#347](https://github.com/rubyconfig/config/pull/347))
6
16
 
7
17
  ## 5.0.0
8
18
 
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", "settings.local.yml").to_s,
18
- Rails.root.join("config", "settings", "#{environment}.local.yml").to_s,
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
 
@@ -122,7 +122,7 @@ module Config
122
122
  def [](param)
123
123
  return super if SETTINGS_RESERVED_NAMES.include?(param)
124
124
  return super if RAILS_RESERVED_NAMES.include?(param)
125
- send("#{param}")
125
+ public_send("#{param}")
126
126
  end
127
127
 
128
128
  def []=(param, value)
@@ -1,3 +1,3 @@
1
1
  module Config
2
- VERSION = '5.1.0'.freeze
2
+ VERSION = '5.2.0'.freeze
3
3
  end
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, 'settings.yml').to_s,
62
- File.join(config_root, 'settings', "#{env}.yml").to_s,
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, 'settings.local.yml').to_s if env != 'test'),
71
- File.join(config_root, 'settings', "#{env}.local.yml").to_s,
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/settings.yml"
16
- template "settings.local.yml", "config/settings.local.yml"
17
- directory "settings", "config/settings"
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/settings.local.yml\n" +
26
- "config/settings/*.local.yml\n" +
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
@@ -55,4 +55,9 @@ Config.setup do |config|
55
55
  # Evaluate ERB in YAML config files at load time.
56
56
  #
57
57
  # config.evaluate_erb_in_yaml = true
58
+
59
+ # Name of directory and file to store config keys
60
+ #
61
+ # config.file_name = 'settings'
62
+ # config.dir_name = 'settings'
58
63
  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.1.0
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: 2023-12-18 00:00:00.000000000 Z
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.10
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