config 2.2.1 → 5.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 554478f496c7582db5d4a3965d44499cde1b9d739002cf9e828eb0578de3b356
4
- data.tar.gz: d3d21afa1efa34e03d958e4ae347de44ff00f2e1f45ffdeceef8785bfcb41b61
3
+ metadata.gz: 9695bee8465b0c65165242a23d7df19a04047c78d131587f87b5c0e356930a6c
4
+ data.tar.gz: 13b9ee27af8ad78c2450111854c1f8498b1019d0cd8c358eaa986bd0d01b8541
5
5
  SHA512:
6
- metadata.gz: bde322b8eb560783917d36ebcaea664d10b255ccdf915b86fa8330b3e7ed50aba4c3f66ba265f5b2bd896a679bd74ccc6add60e2f5d92a088fb8c1d61cafce75
7
- data.tar.gz: 81895a02cdda30016f6dc80d2f6a5d3e01669d884ee177ec5bbdc910938a4e3f5964749416694afa99b375316735ba98c1a375ee90430a847b6ee5cd68e64809
6
+ metadata.gz: a15b3c5112f4f776f2df92d28fa4ac8d6d0dc92eeb294b863b0be055696d8a3cc7de4abbd44aab28cd31c9e2d716e8debbcae84a439758bd1ac9d5c4415da264
7
+ data.tar.gz: 65b04c96cf9e826fccceeff15a5897c19e2a617ab131922c1ab395dfe4aad8fe6320c5c5916b07f80c75c98369460cd9a252201d684da667a37a543edea4651e
data/CHANGELOG.md CHANGED
@@ -1,8 +1,113 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 5.4.0
4
4
 
5
- ...
5
+ ### New features
6
+
7
+ * Add configuration option `environment` to override the use of `Rails.env` ([#356](https://github.com/rubyconfig/config/pull/356))
8
+
9
+ ## 5.3.0
10
+
11
+ * Remove `dry-validation` from dependencies ([#333](https://github.com/rubyconfig/config/pull/333))
12
+
13
+ ## 5.2.0
14
+
15
+ ### New features
16
+
17
+ * Allow to use custom filename && directory name to store configs ([#341](https://github.com/rubyconfig/config/pull/341))
18
+
19
+ ### Bug fixes
20
+
21
+ * Prevent name collision with private methods from ancestors ([#351](https://github.com/rubyconfig/config/pull/351))
22
+
23
+ ## 5.1.0
24
+
25
+ * Fix conflicts with Rails 7 active_support methods ([#347](https://github.com/rubyconfig/config/pull/347))
26
+
27
+ ## 5.0.0
28
+
29
+ ### BREAKING CHANGES
30
+
31
+ * No longer load `deep_merge`'s monkey patch for `Hash#deep_merge` and `Hash#deep_merge!` ([#342](https://github.com/rubyconfig/config/pull/342)). If you rely on those methods and are not using Rails / Active Support, you can load the monkey patch via `require 'deep_merge/deep_merge_hash'`. This change fixes Rails 7.x support.
32
+
33
+ ## 4.2.1
34
+
35
+ ### Bug fixes
36
+
37
+ * Address edge case with `table` config param ([#339](https://github.com/rubyconfig/config/pull/339))
38
+
39
+ ## 4.2.0
40
+
41
+ ### Bug fixes
42
+
43
+ * Remove use of method `File.exists?` to fix use in Ruby 3.0 ([#318](https://github.com/rubyconfig/config/pull/318))
44
+
45
+ ## 4.1.0
46
+
47
+ ### Bug fixes
48
+
49
+ * Only load `Railtie` integration if `Rails::Railtie` is defined ([#319](https://github.com/rubyconfig/config/pull/319))
50
+ * Fix indentation warning in Ruby 3.1 ([#322](https://github.com/rubyconfig/config/pull/322))
51
+
52
+ ## 4.0.0
53
+
54
+ ### BREAKING CHANGES
55
+
56
+ * Rails versions `< 5.2` are no longer supported ([#316](https://github.com/rubyconfig/config/pull/316))
57
+ * Ruby versions `< 2.6` are no longer supported ([#316](https://github.com/rubyconfig/config/pull/316))
58
+ * Support `HashSource` and `EnvSource` instances in `Config.load_files` and `Config.load_and_set_settings`. ([#315](https://github.com/rubyconfig/config/pull/315)). There are a few subtle breaking changes:
59
+ * Previously, `Config.load_files` (called from `Config.load_and_set_settings`) would call `.to_s` on each of its arguments. Now, this responsibility is defered to YAMLSource. In effect, if your application passes String or Pathname objects to `Config.load_files`, no changes are necessary, but if you were somehow relying on the `.to_s` call for some other type of object, you'll now need to call `.to_s` on that object before passing it to `Config`.
60
+ * Before this change, `Config.load_files` would call `uniq` on its argument array. This call has been removed, so duplicate file paths are not removed before further processing. In some cases, this can cause differences in behavior since later config files override the values in earlier ones. In most cases, it's best to ensure that duplicate paths are not passed to `Config.load_files`.
61
+
62
+ ## 3.1.1
63
+
64
+ ### Bug fixes
65
+
66
+ * Allow the use of unsafe YAML parsing features when using psych >= 4 ([#306](https://github.com/railsconfig/config/issues/306))
67
+
68
+ ## 3.1.0
69
+
70
+ ### New features
71
+
72
+ * Evaluating ERB in YAML files can now be disabled with `Config.evaluate_erb_in_yaml = false`. The default value for this option is `true` for backwards-compatibility. ([#303](https://github.com/rubyconfig/config/pull/303))
73
+
74
+ ## 3.0.0
75
+
76
+ ### BREAKING CHANGES
77
+
78
+ * After upgrade behaviour of `to_h` would change and match behaviour of `to_hash`. Check [#217](https://github.com/rubyconfig/config/issues/217#issuecomment-741953382) for more details.
79
+ * `Config::Options#load_env!` and `Config::Options#reload_env!` have been removed. If you need to reload settings after modifying the `ENV` hash, use `Config.reload!` or `Config::Options#reload!` instead.
80
+
81
+ ### Bug fixes
82
+
83
+ * Added alias `to_h` for `to_hash` ([#277](https://github.com/railsconfig/config/issues/277))
84
+
85
+ ### Changes
86
+
87
+ * Add `Config::Sources::EnvSource` for loading settings from flat `Hash`es with `String` keys and `String` values, such as from AWS SecretsManager ([#299](https://github.com/railsconfig/config/pull/299))
88
+
89
+ ## 2.2.3
90
+
91
+ ### Bug fixes
92
+
93
+ * Revert added alias to_h for to_hash ([#277](https://github.com/railsconfig/config/issues/277))
94
+
95
+ ### Changes
96
+
97
+ * Raise explicit error on environment variable conflicts ([#293](https://github.com/railsconfig/config/issues/293))
98
+
99
+ ## 2.2.2
100
+
101
+ ### Bug fixes
102
+
103
+ * Added alias to_h for to_hash ([#277](https://github.com/railsconfig/config/issues/277))
104
+ * Prevent unnecessary doubled loading of environment variables ([#291](https://github.com/rubyconfig/config/pull/291))
105
+ * Return `Hash` from `Config::Options#as_json` instead of `Array` of pairs when using ActiveSupport Core Extensions ([#292](https://github.com/rubyconfig/config/pull/292))
106
+
107
+ ### Changes
108
+
109
+ * Add JRuby 9.2 to the test matrix ([#228](https://github.com/railsconfig/config/issues/228))
110
+ * Add exit! to reserved keywords ([#289](https://github.com/railsconfig/config/issues/289))
6
111
 
7
112
  ## 2.2.1
8
113
 
@@ -16,7 +121,7 @@
16
121
 
17
122
  * Fix missing new_ostruct_member in Ruby 2.7 ([#255](https://github.com/rubyconfig/config/pull/255))
18
123
  * Fix validation contract documentation ([#260](https://github.com/rubyconfig/config/pull/260))
19
- * Fix validation contract documentation ([#260](https://github.com/rubyconfig/config/pull/260))
124
+ * Excluded test application's *.md files from the gem build ([#267](https://github.com/rubyconfig/config/pull/267))
20
125
 
21
126
  ### Changes
22
127
 
data/CONTRIBUTING.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Install appraisal
4
4
 
5
5
  ```bash
6
- gem install bundler -v 1.17.3
6
+ gem install bundler
7
7
  gem install appraisal
8
8
  ```
9
9
 
@@ -16,13 +16,19 @@ bundle install
16
16
  Bootstrap
17
17
 
18
18
  ```bash
19
- appraisal install
19
+ bundle exec appraisal install
20
+ ```
21
+
22
+ If you need to create new test app for specific rails version
23
+
24
+ ```bash
25
+ bundle exec appraisal rails-7.0 rails new spec/app/rails_7.0
20
26
  ```
21
27
 
22
28
  Run the test suite:
23
29
 
24
30
  ```bash
25
- appraisal rspec
31
+ bundle exec appraisal rspec
26
32
  ```
27
33
 
28
34
  If you modified any of the documentation files verify their format:
data/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # Config
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/config.svg)](http://badge.fury.io/rb/config)
3
+ [![Version](https://img.shields.io/gem/v/config)](https://rubygems.org/gems/config)
4
+ [![Downloads Total](https://img.shields.io/gem/dt/config)](https://rubygems.org/gems/config)
4
5
  [![Tests](https://github.com/rubyconfig/config/workflows/tests/badge.svg)](https://github.com/rubyconfig/config/actions?query=branch%3Amaster)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/85c206c13dce7de090af/maintainability)](https://codeclimate.com/github/rubyconfig/config/maintainability)
6
- [![Test Coverage](https://api.codeclimate.com/v1/badges/85c206c13dce7de090af/test_coverage)](https://codeclimate.com/github/rubyconfig/config/test_coverage)
7
6
  [![Financial Contributors on Open Collective](https://opencollective.com/rubyconfig/all/badge.svg?label=backers)](https://opencollective.com/rubyconfig)
8
7
 
9
8
  ## Summary
@@ -21,16 +20,21 @@ Config helps you easily manage environment specific settings in an easy and usab
21
20
 
22
21
  ## Compatibility
23
22
 
23
+ Current version supports and is [tested](.github/workflows/tests.yml#L19) for the following interpreters and frameworks:
24
+
24
25
  * Interpreters
25
- * [Ruby](https://www.ruby-lang.org/en/) `>= 2.4`
26
- * [TruffleRuby](https://github.com/oracle/truffleruby) `>= 19.0.0`
26
+ * [Ruby](https://www.ruby-lang.org) `>= 2.6`
27
+ * [JRuby](https://www.jruby.org) `>= 9.2`
28
+ * [TruffleRuby](https://github.com/oracle/truffleruby) `>= 19.3`
27
29
  * Application frameworks
28
- * Rails `>= 4.2` and `5`
30
+ * Rails `>= 5.2`
29
31
  * Padrino
30
32
  * Sinatra
31
33
 
32
34
  For Ruby `2.0` to `2.3` or Rails `3` to `4.1` use version `1.x` of this gem. For older versions of Rails or Ruby use [AppConfig](http://github.com/fredwu/app_config).
33
35
 
36
+ For Ruby `2.4` or `2.5` or Rails `4.2`, `5.0`, or `5.1` use version `3.x` of this gem.
37
+
34
38
  ## Installing
35
39
 
36
40
  ### Installing on Rails
@@ -42,12 +46,15 @@ Add `gem 'config'` to your `Gemfile` and run `bundle install` to install it. The
42
46
  which will generate customizable config file `config/initializers/config.rb` and set of default settings files:
43
47
 
44
48
  config/settings.yml
49
+ config/settings.local.yml
45
50
  config/settings/development.yml
46
51
  config/settings/production.yml
47
52
  config/settings/test.yml
48
53
 
49
54
  You can now edit them to adjust to your needs.
50
55
 
56
+ > Note: By default, the config environment will match the Rails environment (`Rails.env`). This can be changed by setting `config.environment`.
57
+
51
58
  ### Installing on Padrino
52
59
 
53
60
  Add the gem to your `Gemfile` and run `bundle install` to install it. Then edit `app.rb` and register `Config`
@@ -186,8 +193,9 @@ Settings.add_source!("#{Rails.root}/config/settings/local.yml")
186
193
  Settings.reload!
187
194
  ```
188
195
 
189
- > Note: this is an example usage, it is easier to just use the default local files `settings.local.yml,
190
- settings/#{Rails.env}.local.yml and environments/#{Rails.env}.local.yml` for your developer specific settings.
196
+ > Note: this is an example usage, it is easier to just use the default local
197
+ > files `settings.local.yml`, `settings/#{Rails.env}.local.yml` and
198
+ > `environments/#{Rails.env}.local.yml` for your developer specific settings.
191
199
 
192
200
  You also have the option to add a raw hash as a source. One use case might be storing settings in the database or in environment variables that overwrite what is in the YML files.
193
201
 
@@ -200,7 +208,9 @@ You may pass a hash to `prepend_source!` as well.
200
208
 
201
209
  ## Embedded Ruby (ERB)
202
210
 
203
- Embedded Ruby is allowed in the configuration files. Consider the two following config files.
211
+ Embedded Ruby is allowed in the YAML configuration files. ERB will be evaluated at load time by default, and when the `evaluate_erb_in_yaml` configuration is set to `true`.
212
+
213
+ Consider the two following config files.
204
214
 
205
215
  * ```#{Rails.root}/config/settings.yml```
206
216
 
@@ -261,6 +271,9 @@ After installing `Config` in Rails, you will find automatically generated file t
261
271
  ### General
262
272
 
263
273
  * `const_name` - name of the object holing you settings. Default: `'Settings'`
274
+ * `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`
275
+ * `file_name` - name of the file to store general keys accessible in all environments. Default: `'settings'` - located at `config/settings.yml`
276
+ * `dir_name` - name of the directory to store environment-specific files. Default: `'settings'` - located at `config/settings/`
264
277
 
265
278
  ### Merge customization
266
279
 
@@ -415,6 +428,21 @@ ENV['Settings.section.server'] = 'google.com'
415
428
 
416
429
  It won't work with arrays, though.
417
430
 
431
+ It is considered an error to use environment variables to simutaneously assign a "flat" value and a multi-level value to a key.
432
+
433
+ ```ruby
434
+ # Raises an error when settings are loaded
435
+ ENV['BACKEND_DATABASE'] = 'development'
436
+ ENV['BACKEND_DATABASE_USER'] = 'postgres'
437
+ ```
438
+
439
+ Instead, specify keys of equal depth in the environment variable names:
440
+
441
+ ```ruby
442
+ ENV['BACKEND_DATABASE_NAME'] = 'development'
443
+ ENV['BACKEND_DATABASE_USER'] = 'postgres'
444
+ ```
445
+
418
446
  ### Working with Heroku
419
447
 
420
448
  Heroku uses ENV object to store sensitive settings. You cannot upload such files to Heroku because it's ephemeral filesystem gets recreated from the git sources on each instance refresh. To use config with Heroku just set the `use_env` var to `true` as mentioned above.
@@ -460,12 +488,83 @@ Settings.section.server # => 'google.com'
460
488
  Settings.section.ssl_enabled # => false
461
489
  ```
462
490
 
491
+ ### Working with AWS Secrets Manager
492
+
493
+ It is possible to parse variables stored in an AWS Secrets Manager Secret as if they were environment variables by using `Config::Sources::EnvSource`.
494
+
495
+ For example, the plaintext secret might look like this:
496
+
497
+ ```json
498
+ {
499
+ "Settings.foo": "hello",
500
+ "Settings.bar": "world",
501
+ }
502
+ ```
503
+
504
+ In order to load those settings, fetch the settings from AWS Secrets Manager, parse the plaintext as JSON, pass the resulting `Hash` into a new `EnvSource`, load the new source, and reload.
505
+
506
+ ```ruby
507
+ # fetch secrets from AWS
508
+ client = Aws::SecretsManager::Client.new
509
+ response = client.get_secret_value(secret_id: "#{ENV['ENVIRONMENT']}/my_application")
510
+ secrets = JSON.parse(response.secret_string)
511
+
512
+ # load secrets into config
513
+ secret_source = Config::Sources::EnvSource.new(secrets)
514
+ Settings.add_source!(secret_source)
515
+ Settings.reload!
516
+ ```
517
+
518
+ In this case, the following settings will be available:
519
+
520
+ ```ruby
521
+ Settings.foo # => "hello"
522
+ Settings.bar # => "world"
523
+ ```
524
+
525
+ By default, `EnvSource` will use configuration for `env_prefix`, `env_separator`, `env_converter`, and `env_parse_values`, but any of these can be overridden in the constructor.
526
+
527
+ ```ruby
528
+ secret_source = Config::Sources::EnvSource.new(secrets,
529
+ prefix: 'MyConfig',
530
+ separator: '__',
531
+ converter: nil,
532
+ parse_values: false)
533
+ ```
534
+
463
535
  ## Contributing
464
536
 
465
537
  You are very warmly welcome to help. Please follow our [contribution guidelines](CONTRIBUTING.md)
466
538
 
467
539
  Any and all contributions offered in any form, past present or future are understood to be in complete agreement and acceptance with [MIT](LICENSE) license.
468
540
 
541
+ ### Running specs
542
+
543
+ Setup
544
+
545
+ ```sh
546
+ bundle install
547
+ bundle exec appraisal install
548
+ ```
549
+
550
+ List defined appraisals:
551
+
552
+ ```sh
553
+ bundle exec appraisal list
554
+ ```
555
+
556
+ Run specs for specific appraisal:
557
+
558
+ ```sh
559
+ bundle exec appraisal rails-6.1 rspec
560
+ ```
561
+
562
+ Run specs for all appraisals:
563
+
564
+ ```sh
565
+ bundle exec appraisal rspec
566
+ ```
567
+
469
568
  ## Authors
470
569
 
471
570
  * [Piotr Kuczynski](http://github.com/pkuczynski)
@@ -497,4 +596,4 @@ Support this project by becoming a [sponsor](https://opencollective.com/rubyconf
497
596
 
498
597
  ## License
499
598
 
500
- Copyright (C) Piotr Kuczynski. Released under the [MIT License](LICENSE).
599
+ Copyright (C) Piotr Kuczynski. Released under the [MIT License](LICENSE.md).
data/config.gemspec CHANGED
@@ -1,6 +1,5 @@
1
- $:.push File.expand_path('../lib', __FILE__)
2
-
3
- require 'config/version'
1
+ require_relative 'lib/config/version'
2
+ require_relative 'lib/config/dry_validation_requirements'
4
3
 
5
4
  Gem::Specification.new do |s|
6
5
  s.name = 'config'
@@ -8,46 +7,52 @@ Gem::Specification.new do |s|
8
7
  s.date = Time.now.strftime '%F'
9
8
  s.authors = ['Piotr Kuczynski', 'Fred Wu', 'Jacques Crocker']
10
9
  s.email = %w[piotr.kuczynski@gmail.com ifredwu@gmail.com railsjedi@gmail.com]
11
- s.summary = 'Effortless multi-environment settings in Rails, Sinatra, Pandrino and others'
10
+ s.summary = 'Effortless multi-environment settings in Rails, Sinatra, Padrino and others'
12
11
  s.description = 'Easiest way to manage multi-environment settings in any ruby project or framework: ' +
13
- 'Rails, Sinatra, Pandrino and others'
12
+ 'Rails, Sinatra, Padrino and others'
14
13
  s.homepage = 'https://github.com/rubyconfig/config'
15
14
  s.license = 'MIT'
16
15
  s.extra_rdoc_files = %w[README.md CHANGELOG.md CONTRIBUTING.md LICENSE.md]
17
16
  s.rdoc_options = ['--charset=UTF-8']
18
- s.post_install_message = "\n\e[33mThanks for installing Config\e[0m 🙏
17
+ s.post_install_message = "\n\e[33mThanks for installing Config\e[0m
19
18
  Please consider donating to our open collective to help us maintain this project.
20
19
  \n
21
- 👉 Donate: \e[34mhttps://opencollective.com/rubyconfig/donate\e[0m\n"
20
+ Donate: \e[34mhttps://opencollective.com/rubyconfig/donate\e[0m\n"
22
21
 
22
+ s.metadata = {
23
+ 'changelog_uri' => "https://github.com/rubyconfig/config/blob/master/CHANGELOG.md",
24
+ 'source_code_uri' => 'https://github.com/rubyconfig/config',
25
+ 'bug_tracker_uri' => 'https://github.com/rubyconfig/config/issues'
26
+ }
23
27
  s.files = `git ls-files`.split($/)
24
28
  s.files.select! { |file| /(^lib\/|^\w+.md$|\.gemspec$)/ =~ file }
25
29
 
26
30
  s.require_paths = ['lib']
27
- s.required_ruby_version = '>= 2.4.0'
31
+ s.required_ruby_version = '>= 2.6.0'
28
32
 
29
33
  s.add_dependency 'deep_merge', '~> 1.2', '>= 1.2.1'
30
- s.add_dependency 'dry-validation', '~> 1.0', '>= 1.0.0'
31
34
 
35
+ s.add_development_dependency 'dry-validation', *Config::DryValidationRequirements::VERSIONS
32
36
  s.add_development_dependency 'rake', '~> 12.0', '>= 12.0.0'
33
37
 
34
38
  # Testing
35
- s.add_development_dependency 'appraisal', '~> 2.2', '>= 2.2.0'
36
- s.add_development_dependency 'rspec', '~> 3.7', '>= 3.7.0'
39
+ s.add_development_dependency 'appraisal', '~> 2.5', '>= 2.5.0'
40
+ s.add_development_dependency 'rspec', '~> 3.9', '>= 3.9.0'
37
41
 
38
42
  # Default RSpec run will test against latest Rails app
39
43
  unless ENV['APPRAISAL_INITIALIZED'] || ENV['GITHUB_ACTIONS']
40
- File.read(Dir['gemfiles/rails*.gemfile'].sort.last).scan(/gem "(.*?)", "(.*?)"/m) do |name, version|
44
+ gems_to_install = /gem "(.*?)", "(.*?)"(?!, platform: (?!\[:ruby\]))/
45
+ File.read(Dir['gemfiles/rails*.gemfile'].sort.last).scan(gems_to_install) do |name, version|
41
46
  s.add_development_dependency name, version
42
47
  end
43
48
  end
44
49
 
45
50
  if ENV['GITHUB_ACTIONS']
46
51
  # Code coverage is needed only in CI
47
- s.add_development_dependency 'simplecov', '~> 0.17.1' if RUBY_ENGINE == 'ruby'
52
+ s.add_development_dependency 'simplecov', '~> 0.18.5' if RUBY_ENGINE == 'ruby'
48
53
  else
49
54
  # Static code analysis to be used locally
50
- s.add_development_dependency 'mdl', '~> 0.8', '>= 0.8.0'
51
- s.add_development_dependency 'rubocop', '~> 0.78.0'
55
+ s.add_development_dependency 'mdl', '~> 0.9', '>= 0.9.0'
56
+ s.add_development_dependency 'rubocop', '~> 0.85.0'
52
57
  end
53
58
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Config
4
+ module DryValidationRequirements
5
+ VERSIONS = ['~> 1.0', '>= 1.0.0'].freeze
6
+
7
+ def self.load_dry_validation!
8
+ return if defined?(@load_dry_validation)
9
+
10
+ begin
11
+ require 'dry/validation/version'
12
+ version = Gem::Version.new(Dry::Validation::VERSION)
13
+ unless VERSIONS.all? { |req| Gem::Requirement.new(req).satisfied_by?(version) }
14
+ raise LoadError
15
+ end
16
+ rescue LoadError
17
+ raise ::Config::Error, 'Could not find a dry-validation version' \
18
+ ' matching requirements' \
19
+ " (#{VERSIONS.map(&:inspect) * ','})"
20
+ end
21
+
22
+ require 'dry/validation'
23
+ @load_dry_validation = true
24
+ nil
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,4 @@
1
+ module Config
2
+ class Error < StandardError
3
+ end
4
+ end
@@ -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
 
@@ -9,7 +9,7 @@ module Config
9
9
 
10
10
  # Parse the settings before any of the initializers
11
11
  Config.load_and_set_settings(
12
- Config.setting_files(::Rails.root.join('config'), ::Rails.env)
12
+ Config.setting_files(::Rails.root.join('config'), Config.environment.nil? ? ::Rails.env : Config.environment.to_sym)
13
13
  )
14
14
  end
15
15
 
@@ -16,7 +16,7 @@ module Config
16
16
 
17
17
  def add_source!(source)
18
18
  # handle yaml file paths
19
- source = (Sources::YAMLSource.new(source)) if source.is_a?(String)
19
+ source = (Sources::YAMLSource.new(source)) if source.is_a?(String) || source.is_a?(Pathname)
20
20
  source = (Sources::HashSource.new(source)) if source.is_a?(Hash)
21
21
 
22
22
  @config_sources ||= []
@@ -24,49 +24,13 @@ module Config
24
24
  end
25
25
 
26
26
  def prepend_source!(source)
27
- source = (Sources::YAMLSource.new(source)) if source.is_a?(String)
27
+ source = (Sources::YAMLSource.new(source)) if source.is_a?(String) || source.is_a?(Pathname)
28
28
  source = (Sources::HashSource.new(source)) if source.is_a?(Hash)
29
29
 
30
30
  @config_sources ||= []
31
31
  @config_sources.unshift(source)
32
32
  end
33
33
 
34
- def reload_env!
35
- return self if ENV.nil? || ENV.empty?
36
-
37
- hash = Hash.new
38
-
39
- ENV.each do |variable, value|
40
- separator = Config.env_separator
41
- prefix = (Config.env_prefix || Config.const_name).to_s.split(separator)
42
-
43
- keys = variable.to_s.split(separator)
44
-
45
- next if keys.shift(prefix.size) != prefix
46
-
47
- keys.map! { |key|
48
- case Config.env_converter
49
- when :downcase then
50
- key.downcase.to_sym
51
- when nil then
52
- key.to_sym
53
- else
54
- raise "Invalid ENV variables name converter: #{Config.env_converter}"
55
- end
56
- }
57
-
58
- leaf = keys[0...-1].inject(hash) { |h, key|
59
- h[key] ||= {}
60
- }
61
-
62
- leaf[keys.last] = Config.env_parse_values ? __value(value) : value
63
- end
64
-
65
- merge!(hash)
66
- end
67
-
68
- alias :load_env! :reload_env!
69
-
70
34
  # look through all our sources and rebuild the configuration
71
35
  def reload!
72
36
  conf = {}
@@ -91,7 +55,6 @@ module Config
91
55
  # swap out the contents of the OStruct with a hash (need to recursively convert)
92
56
  marshal_load(__convert(conf).marshal_dump)
93
57
 
94
- reload_env! if Config.use_env
95
58
  validate!
96
59
 
97
60
  self
@@ -118,6 +81,8 @@ module Config
118
81
  result
119
82
  end
120
83
 
84
+ alias :to_h :to_hash
85
+
121
86
  def each(*args, &block)
122
87
  marshal_dump.each(*args, &block)
123
88
  end
@@ -127,6 +92,10 @@ module Config
127
92
  to_hash.to_json(*args)
128
93
  end
129
94
 
95
+ def as_json(options = nil)
96
+ to_hash.as_json(options)
97
+ end
98
+
130
99
  def merge!(hash)
131
100
  current = to_hash
132
101
  DeepMerge.deep_merge!(
@@ -143,13 +112,17 @@ module Config
143
112
  end
144
113
 
145
114
  # Some keywords that don't play nicely with OpenStruct
146
- SETTINGS_RESERVED_NAMES = %w[select collect test count zip min max].freeze
115
+ SETTINGS_RESERVED_NAMES = %w[select collect test count zip min max exit! table].freeze
116
+
117
+ # Some keywords that don't play nicely with Rails 7.*
118
+ RAILS_RESERVED_NAMES = %w[maximum minimum].freeze
147
119
 
148
120
  # An alternative mechanism for property access.
149
121
  # This let's you do foo['bar'] along with foo.bar.
150
122
  def [](param)
151
123
  return super if SETTINGS_RESERVED_NAMES.include?(param)
152
- send("#{param}")
124
+ return super if RAILS_RESERVED_NAMES.include?(param)
125
+ public_send("#{param}")
153
126
  end
154
127
 
155
128
  def []=(param, value)
@@ -162,12 +135,18 @@ module Config
162
135
  end
163
136
  end
164
137
 
138
+ RAILS_RESERVED_NAMES.each do |name|
139
+ define_method name do
140
+ self[name]
141
+ end
142
+ end
143
+
165
144
  def key?(key)
166
- table.key?(key)
145
+ @table.key?(key)
167
146
  end
168
147
 
169
148
  def has_key?(key)
170
- table.has_key?(key)
149
+ @table.has_key?(key)
171
150
  end
172
151
 
173
152
  def method_missing(method_name, *args)
@@ -212,17 +191,5 @@ module Config
212
191
  end
213
192
  s
214
193
  end
215
-
216
- # Try to convert string to a correct type
217
- def __value(v)
218
- case v
219
- when 'false'
220
- false
221
- when 'true'
222
- true
223
- else
224
- Integer(v) rescue Float(v) rescue v
225
- end
226
- end
227
194
  end
228
195
  end
@@ -0,0 +1,73 @@
1
+ module Config
2
+ module Sources
3
+ # Allows settings to be loaded from a "flat" hash with string keys, like ENV.
4
+ class EnvSource
5
+ attr_reader :prefix
6
+ attr_reader :separator
7
+ attr_reader :converter
8
+ attr_reader :parse_values
9
+
10
+ def initialize(env,
11
+ prefix: Config.env_prefix || Config.const_name,
12
+ separator: Config.env_separator,
13
+ converter: Config.env_converter,
14
+ parse_values: Config.env_parse_values)
15
+ @env = env
16
+ @prefix = prefix.to_s.split(separator)
17
+ @separator = separator
18
+ @converter = converter
19
+ @parse_values = parse_values
20
+ end
21
+
22
+ def load
23
+ return {} if @env.nil? || @env.empty?
24
+
25
+ hash = Hash.new
26
+
27
+ @env.each do |variable, value|
28
+ keys = variable.to_s.split(separator)
29
+
30
+ next if keys.shift(prefix.size) != prefix
31
+
32
+ keys.map! { |key|
33
+ case converter
34
+ when :downcase then
35
+ key.downcase
36
+ when nil then
37
+ key
38
+ else
39
+ raise "Invalid ENV variables name converter: #{converter}"
40
+ end
41
+ }
42
+
43
+ leaf = keys[0...-1].inject(hash) { |h, key|
44
+ h[key] ||= {}
45
+ }
46
+
47
+ unless leaf.is_a?(Hash)
48
+ conflicting_key = (prefix + keys[0...-1]).join(separator)
49
+ raise "Environment variable #{variable} conflicts with variable #{conflicting_key}"
50
+ end
51
+
52
+ leaf[keys.last] = parse_values ? __value(value) : value
53
+ end
54
+
55
+ hash
56
+ end
57
+
58
+ private
59
+
60
+ # Try to convert string to a correct type
61
+ def __value(v)
62
+ case v
63
+ when 'false'
64
+ false
65
+ when 'true'
66
+ true
67
+ else
68
+ Integer(v) rescue Float(v) rescue v
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -5,21 +5,27 @@ module Config
5
5
  module Sources
6
6
  class YAMLSource
7
7
  attr_accessor :path
8
+ attr_reader :evaluate_erb
8
9
 
9
- def initialize(path)
10
+ def initialize(path, evaluate_erb: Config.evaluate_erb_in_yaml)
10
11
  @path = path.to_s
12
+ @evaluate_erb = !!evaluate_erb
11
13
  end
12
14
 
13
15
  # returns a config hash from the YML file
14
16
  def load
15
- result = YAML.load(ERB.new(IO.read(@path)).result) if @path and File.exist?(@path)
17
+ if @path and File.exist?(@path)
18
+ file_contents = IO.read(@path)
19
+ file_contents = ERB.new(file_contents).result if evaluate_erb
20
+ result = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(file_contents) : YAML.load(file_contents)
21
+ end
16
22
 
17
23
  result || {}
18
24
 
19
- rescue Psych::SyntaxError => e
20
- raise "YAML syntax error occurred while parsing #{@path}. " \
21
- "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \
22
- "Error: #{e.message}"
25
+ rescue Psych::SyntaxError => e
26
+ raise "YAML syntax error occurred while parsing #{@path}. " \
27
+ "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \
28
+ "Error: #{e.message}"
23
29
  end
24
30
  end
25
31
  end
@@ -1,6 +1,8 @@
1
+ require_relative "../error"
2
+
1
3
  module Config
2
4
  module Validation
3
- class Error < StandardError
5
+ class Error < ::Config::Error
4
6
 
5
7
  def self.format(v_res)
6
8
  v_res.errors.group_by(&:path).map do |path, messages|
@@ -1,3 +1,6 @@
1
+ require_relative '../dry_validation_requirements'
2
+ require_relative '../error'
3
+
1
4
  module Config
2
5
  module Validation
3
6
  module Schema
@@ -9,7 +12,7 @@ module Config
9
12
  def schema(&block)
10
13
  if block_given?
11
14
  # Delay require until optional schema validation is requested
12
- require 'dry-validation'
15
+ Config::DryValidationRequirements.load_dry_validation!
13
16
  @schema = Dry::Schema.define(&block)
14
17
  else
15
18
  @schema
@@ -4,6 +4,10 @@ module Config
4
4
  module Validation
5
5
  module Validate
6
6
  def validate!
7
+ return unless Config.validation_contract || Config.schema
8
+
9
+ Config::DryValidationRequirements.load_dry_validation!
10
+
7
11
  validate_using!(Config.validation_contract)
8
12
  validate_using!(Config.schema)
9
13
  end
@@ -1,3 +1,3 @@
1
1
  module Config
2
- VERSION = '2.2.1'.freeze
2
+ VERSION = '5.4.0'.freeze
3
3
  end
data/lib/config.rb CHANGED
@@ -1,11 +1,12 @@
1
- require 'config/compatibility'
2
1
  require 'config/options'
3
2
  require 'config/configuration'
3
+ require 'config/dry_validation_requirements'
4
4
  require 'config/version'
5
5
  require 'config/sources/yaml_source'
6
6
  require 'config/sources/hash_source'
7
+ require 'config/sources/env_source'
7
8
  require 'config/validation/schema'
8
- require 'deep_merge'
9
+ require 'deep_merge/core'
9
10
 
10
11
  module Config
11
12
  extend Config::Validation::Schema
@@ -18,12 +19,16 @@ module Config
18
19
  env_converter: :downcase,
19
20
  env_parse_values: true,
20
21
  fail_on_missing: false,
22
+ file_name: 'settings',
23
+ dir_name: 'settings',
21
24
  # deep_merge options
22
25
  knockout_prefix: nil,
23
26
  merge_nil_values: true,
24
27
  overwrite_arrays: true,
25
28
  merge_hash_arrays: false,
26
- validation_contract: nil
29
+ validation_contract: nil,
30
+ evaluate_erb_in_yaml: true,
31
+ environment: nil
27
32
  )
28
33
 
29
34
  def self.setup
@@ -33,30 +38,31 @@ module Config
33
38
 
34
39
  # Create a populated Options instance from a settings file. If a second file is given, then the sections of that
35
40
  # file will overwrite existing sections of the first file.
36
- def self.load_files(*files)
41
+ def self.load_files(*sources)
37
42
  config = Options.new
38
43
 
39
44
  # add settings sources
40
- [files].flatten.compact.uniq.each do |file|
41
- config.add_source!(file.to_s)
45
+ [sources].flatten.compact.each do |source|
46
+ config.add_source!(source)
42
47
  end
43
48
 
49
+ config.add_source!(Sources::EnvSource.new(ENV)) if Config.use_env
50
+
44
51
  config.load!
45
- config.load_env! if use_env
46
52
  config
47
53
  end
48
54
 
49
55
  # Loads and sets the settings constant!
50
- def self.load_and_set_settings(*files)
56
+ def self.load_and_set_settings(*sources)
51
57
  name = Config.const_name
52
58
  Object.send(:remove_const, name) if Object.const_defined?(name)
53
- Object.const_set(name, Config.load_files(files))
59
+ Object.const_set(name, Config.load_files(sources))
54
60
  end
55
61
 
56
62
  def self.setting_files(config_root, env)
57
63
  [
58
- File.join(config_root, 'settings.yml').to_s,
59
- File.join(config_root, 'settings', "#{env}.yml").to_s,
64
+ File.join(config_root, "#{Config.file_name}.yml").to_s,
65
+ File.join(config_root, Config.dir_name, "#{env}.yml").to_s,
60
66
  File.join(config_root, 'environments', "#{env}.yml").to_s,
61
67
  *local_setting_files(config_root, env)
62
68
  ].freeze
@@ -64,8 +70,8 @@ module Config
64
70
 
65
71
  def self.local_setting_files(config_root, env)
66
72
  [
67
- (File.join(config_root, 'settings.local.yml').to_s if env != 'test'),
68
- File.join(config_root, 'settings', "#{env}.local.yml").to_s,
73
+ (File.join(config_root, "#{Config.file_name}.local.yml").to_s if env != 'test'),
74
+ File.join(config_root, Config.dir_name, "#{env}.local.yml").to_s,
69
75
  File.join(config_root, 'environments', "#{env}.local.yml").to_s
70
76
  ].compact
71
77
  end
@@ -76,7 +82,7 @@ module Config
76
82
  end
77
83
 
78
84
  # Rails integration
79
- require('config/integrations/rails/railtie') if defined?(::Rails)
85
+ require('config/integrations/rails/railtie') if defined?(::Rails::Railtie)
80
86
 
81
87
  # Sinatra integration
82
88
  require('config/integrations/sinatra') if defined?(::Sinatra)
@@ -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
- create_file '.gitignore' unless File.exists? '.gitignore'
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
@@ -15,6 +15,11 @@ Config.setup do |config|
15
15
  #
16
16
  # config.overwrite_arrays = true
17
17
 
18
+ # Defines current environment, affecting which settings file will be loaded.
19
+ # Default: `Rails.env`
20
+ #
21
+ # config.environment = ENV.fetch('ENVIRONMENT', :development)
22
+
18
23
  # Load environment variables from the `ENV` object and override any settings defined in files.
19
24
  #
20
25
  # config.use_env = false
@@ -52,4 +57,12 @@ Config.setup do |config|
52
57
  # required(:email).filled(format?: EMAIL_REGEX)
53
58
  # end
54
59
 
60
+ # Evaluate ERB in YAML config files at load time.
61
+ #
62
+ # config.evaluate_erb_in_yaml = true
63
+
64
+ # Name of directory and file to store config keys
65
+ #
66
+ # config.file_name = 'settings'
67
+ # config.dir_name = 'settings'
55
68
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Kuczynski
8
8
  - Fred Wu
9
9
  - Jacques Crocker
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-01-08 00:00:00.000000000 Z
13
+ date: 2024-03-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: deep_merge
@@ -36,174 +36,188 @@ dependencies:
36
36
  name: dry-validation
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: 1.0.0
42
39
  - - "~>"
43
40
  - !ruby/object:Gem::Version
44
41
  version: '1.0'
45
- type: :runtime
46
- prerelease: false
47
- version_requirements: !ruby/object:Gem::Requirement
48
- requirements:
49
42
  - - ">="
50
43
  - !ruby/object:Gem::Version
51
44
  version: 1.0.0
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
52
49
  - - "~>"
53
50
  - !ruby/object:Gem::Version
54
51
  version: '1.0'
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: 12.0.0
62
59
  - - "~>"
63
60
  - !ruby/object:Gem::Version
64
61
  version: '12.0'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 12.0.0
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: 12.0.0
72
69
  - - "~>"
73
70
  - !ruby/object:Gem::Version
74
71
  version: '12.0'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 12.0.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: appraisal
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: 2.2.0
82
79
  - - "~>"
83
80
  - !ruby/object:Gem::Version
84
- version: '2.2'
81
+ version: '2.5'
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 2.5.0
85
85
  type: :development
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- version: 2.2.0
92
89
  - - "~>"
93
90
  - !ruby/object:Gem::Version
94
- version: '2.2'
91
+ version: '2.5'
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 2.5.0
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: rspec
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- version: 3.7.0
102
99
  - - "~>"
103
100
  - !ruby/object:Gem::Version
104
- version: '3.7'
101
+ version: '3.9'
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: 3.9.0
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: 3.7.0
112
109
  - - "~>"
113
110
  - !ruby/object:Gem::Version
114
- version: '3.7'
111
+ version: '3.9'
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 3.9.0
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: bootsnap
117
117
  requirement: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - "~>"
119
+ - - ">="
120
120
  - !ruby/object:Gem::Version
121
- version: '1.4'
121
+ version: 1.16.0
122
122
  type: :development
123
123
  prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - "~>"
126
+ - - ">="
127
127
  - !ruby/object:Gem::Version
128
- version: '1.4'
128
+ version: 1.16.0
129
129
  - !ruby/object:Gem::Dependency
130
130
  name: rails
131
131
  requirement: !ruby/object:Gem::Requirement
132
132
  requirements:
133
133
  - - '='
134
134
  - !ruby/object:Gem::Version
135
- version: 6.0.2.1
135
+ version: 7.1.0
136
136
  type: :development
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - '='
141
141
  - !ruby/object:Gem::Version
142
- version: 6.0.2.1
142
+ version: 7.1.0
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: rspec-rails
145
145
  requirement: !ruby/object:Gem::Requirement
146
146
  requirements:
147
147
  - - "~>"
148
148
  - !ruby/object:Gem::Version
149
- version: '3.7'
149
+ version: 6.0.3
150
150
  type: :development
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
153
153
  requirements:
154
154
  - - "~>"
155
155
  - !ruby/object:Gem::Version
156
- version: '3.7'
156
+ version: 6.0.3
157
157
  - !ruby/object:Gem::Dependency
158
- name: sqlite3
158
+ name: sprockets-rails
159
159
  requirement: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - - "~>"
162
162
  - !ruby/object:Gem::Version
163
- version: 1.4.0
163
+ version: 3.4.2
164
164
  type: :development
165
165
  prerelease: false
166
166
  version_requirements: !ruby/object:Gem::Requirement
167
167
  requirements:
168
168
  - - "~>"
169
169
  - !ruby/object:Gem::Version
170
- version: 1.4.0
170
+ version: 3.4.2
171
171
  - !ruby/object:Gem::Dependency
172
- name: mdl
172
+ name: psych
173
173
  requirement: !ruby/object:Gem::Requirement
174
174
  requirements:
175
175
  - - ">="
176
176
  - !ruby/object:Gem::Version
177
- version: 0.8.0
178
- - - "~>"
179
- - !ruby/object:Gem::Version
180
- version: '0.8'
177
+ version: '4'
181
178
  type: :development
182
179
  prerelease: false
183
180
  version_requirements: !ruby/object:Gem::Requirement
184
181
  requirements:
185
182
  - - ">="
186
183
  - !ruby/object:Gem::Version
187
- version: 0.8.0
184
+ version: '4'
185
+ - !ruby/object:Gem::Dependency
186
+ name: mdl
187
+ requirement: !ruby/object:Gem::Requirement
188
+ requirements:
188
189
  - - "~>"
189
190
  - !ruby/object:Gem::Version
190
- version: '0.8'
191
+ version: '0.9'
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: 0.9.0
195
+ type: :development
196
+ prerelease: false
197
+ version_requirements: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '0.9'
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ version: 0.9.0
191
205
  - !ruby/object:Gem::Dependency
192
206
  name: rubocop
193
207
  requirement: !ruby/object:Gem::Requirement
194
208
  requirements:
195
209
  - - "~>"
196
210
  - !ruby/object:Gem::Version
197
- version: 0.78.0
211
+ version: 0.85.0
198
212
  type: :development
199
213
  prerelease: false
200
214
  version_requirements: !ruby/object:Gem::Requirement
201
215
  requirements:
202
216
  - - "~>"
203
217
  - !ruby/object:Gem::Version
204
- version: 0.78.0
218
+ version: 0.85.0
205
219
  description: 'Easiest way to manage multi-environment settings in any ruby project
206
- or framework: Rails, Sinatra, Pandrino and others'
220
+ or framework: Rails, Sinatra, Padrino and others'
207
221
  email:
208
222
  - piotr.kuczynski@gmail.com
209
223
  - ifredwu@gmail.com
@@ -222,13 +236,15 @@ files:
222
236
  - README.md
223
237
  - config.gemspec
224
238
  - lib/config.rb
225
- - lib/config/compatibility.rb
226
239
  - lib/config/configuration.rb
240
+ - lib/config/dry_validation_requirements.rb
241
+ - lib/config/error.rb
227
242
  - lib/config/integrations/heroku.rb
228
243
  - lib/config/integrations/rails/railtie.rb
229
244
  - lib/config/integrations/sinatra.rb
230
245
  - lib/config/options.rb
231
246
  - lib/config/rack/reloader.rb
247
+ - lib/config/sources/env_source.rb
232
248
  - lib/config/sources/hash_source.rb
233
249
  - lib/config/sources/yaml_source.rb
234
250
  - lib/config/tasks/heroku.rake
@@ -246,10 +262,12 @@ files:
246
262
  homepage: https://github.com/rubyconfig/config
247
263
  licenses:
248
264
  - MIT
249
- metadata: {}
250
- post_install_message: "\n\e[33mThanks for installing Config\e[0m \U0001F64F\nPlease
251
- consider donating to our open collective to help us maintain this project.\n\n\n\U0001F449
252
- \ Donate: \e[34mhttps://opencollective.com/rubyconfig/donate\e[0m\n"
265
+ metadata:
266
+ changelog_uri: https://github.com/rubyconfig/config/blob/master/CHANGELOG.md
267
+ source_code_uri: https://github.com/rubyconfig/config
268
+ bug_tracker_uri: https://github.com/rubyconfig/config/issues
269
+ post_install_message: "\n\e[33mThanks for installing Config\e[0m\nPlease consider
270
+ donating to our open collective to help us maintain this project.\n\n\nDonate: \e[34mhttps://opencollective.com/rubyconfig/donate\e[0m\n"
253
271
  rdoc_options:
254
272
  - "--charset=UTF-8"
255
273
  require_paths:
@@ -258,15 +276,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
276
  requirements:
259
277
  - - ">="
260
278
  - !ruby/object:Gem::Version
261
- version: 2.4.0
279
+ version: 2.6.0
262
280
  required_rubygems_version: !ruby/object:Gem::Requirement
263
281
  requirements:
264
282
  - - ">="
265
283
  - !ruby/object:Gem::Version
266
284
  version: '0'
267
285
  requirements: []
268
- rubygems_version: 3.0.4
269
- signing_key:
286
+ rubygems_version: 3.4.22
287
+ signing_key:
270
288
  specification_version: 4
271
- summary: Effortless multi-environment settings in Rails, Sinatra, Pandrino and others
289
+ summary: Effortless multi-environment settings in Rails, Sinatra, Padrino and others
272
290
  test_files: []
@@ -1,3 +0,0 @@
1
- if defined?(RbConfig) && defined?(Config)
2
- Object.send :remove_const, :Config
3
- end