config 3.1.1 → 5.0.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: df10a2302fd2bd1f1199e97150b44d3f58a28915533dd7579bf58ed6fb77d7dd
4
- data.tar.gz: 3fe17720f82d92766fd81b6f4dfcdeea1824ca7aa8a71302d4430496cf5921a1
3
+ metadata.gz: 63588fb0e3226125aacd3d3e8223a61b8bbe3b8dad14388fd6c4e7389a1fbebb
4
+ data.tar.gz: 63db33abec5829b54e5e41ee328891556ae63dfd27bdf04048592ac945ed7a8c
5
5
  SHA512:
6
- metadata.gz: b9818ca58226256e90282c8dd1e92d1cac9ad77331e31a8073e811a5be36ada096914030da47ac8df2e57a8dcfcaa0d4d20b5a58ffd934602ac9b02356b53f51
7
- data.tar.gz: 680d6f2b9002d1ede073b391ff747c47fe5bf13f87689dbed1e59b3f8a3abb031449069593e8de01086b62631a43936e3f461008340ed88d23b39a35ab29a2d2
6
+ metadata.gz: 3761476e2956deb7423c360d041c622de50cf79fc763271fa2dd8754f104408579fdddafe735044f115cc39100ba21de725ce7d2c19f9d1e178aaddb74487b42
7
+ data.tar.gz: af8a9adfd80ce42580e18097ac108796e3c3e52ed7068348b7aff8e4050557e273a036728d4898891b118e5ae6b6909e283593a1b3630ec9f22b504592dd82d1
data/CHANGELOG.md CHANGED
@@ -1,8 +1,39 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 5.0.0
4
4
 
5
- ...
5
+ ### BREAKING CHANGES
6
+
7
+ * 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.
8
+
9
+ ## 4.2.1
10
+
11
+ ### Bug fixes
12
+
13
+ * Address edge case with `table` config param ([#339](https://github.com/rubyconfig/config/pull/339))
14
+
15
+ ## 4.2.0
16
+
17
+ ### Bug fixes
18
+
19
+ * Remove use of method `File.exists?` to fix use in Ruby 3.0 ([#318](https://github.com/rubyconfig/config/pull/318))
20
+
21
+ ## 4.1.0
22
+
23
+ ### Bug fixes
24
+
25
+ * Only load `Railtie` integration if `Rails::Railtie` is defined ([#319](https://github.com/rubyconfig/config/pull/319))
26
+ * Fix indentation warning in Ruby 3.1 ([#322](https://github.com/rubyconfig/config/pull/322))
27
+
28
+ ## 4.0.0
29
+
30
+ ### BREAKING CHANGES
31
+
32
+ * Rails versions `< 5.2` are no longer supported ([#316](https://github.com/rubyconfig/config/pull/316))
33
+ * Ruby versions `< 2.6` are no longer supported ([#316](https://github.com/rubyconfig/config/pull/316))
34
+ * 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:
35
+ * 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`.
36
+ * 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`.
6
37
 
7
38
  ## 3.1.1
8
39
 
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
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![Version](https://img.shields.io/gem/v/config)](https://rubygems.org/gems/config)
4
4
  [![Downloads Total](https://img.shields.io/gem/dt/config)](https://rubygems.org/gems/config)
5
- [![Build](https://img.shields.io/github/workflow/status/rubyconfig/config/tests)](https://rubygems.org/gems/config)
6
5
  [![Tests](https://github.com/rubyconfig/config/workflows/tests/badge.svg)](https://github.com/rubyconfig/config/actions?query=branch%3Amaster)
7
6
  [![Financial Contributors on Open Collective](https://opencollective.com/rubyconfig/all/badge.svg?label=backers)](https://opencollective.com/rubyconfig)
8
7
 
@@ -24,16 +23,18 @@ Config helps you easily manage environment specific settings in an easy and usab
24
23
  Current version supports and is [tested](.github/workflows/tests.yml#L19) for the following interpreters and frameworks:
25
24
 
26
25
  * Interpreters
27
- * [Ruby](https://www.ruby-lang.org) `>= 2.4`
26
+ * [Ruby](https://www.ruby-lang.org) `>= 2.6`
28
27
  * [JRuby](https://www.jruby.org) `>= 9.2`
29
28
  * [TruffleRuby](https://github.com/oracle/truffleruby) `>= 19.3`
30
29
  * Application frameworks
31
- * Rails `>= 4.2`, `5` and `6`
30
+ * Rails `>= 5.2`
32
31
  * Padrino
33
32
  * Sinatra
34
33
 
35
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).
36
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
+
37
38
  ## Installing
38
39
 
39
40
  ### Installing on Rails
@@ -533,6 +534,33 @@ You are very warmly welcome to help. Please follow our [contribution guidelines]
533
534
 
534
535
  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.
535
536
 
537
+ ### Running specs
538
+
539
+ Setup
540
+
541
+ ```sh
542
+ bundle install
543
+ bundle exec appraisal install
544
+ ```
545
+
546
+ List defined appraisals:
547
+
548
+ ```sh
549
+ bundle exec appraisal list
550
+ ```
551
+
552
+ Run specs for specific appraisal:
553
+
554
+ ```sh
555
+ bundle exec appraisal rails-6.1 rspec
556
+ ```
557
+
558
+ Run specs for all appraisals:
559
+
560
+ ```sh
561
+ bundle exec appraisal rspec
562
+ ```
563
+
536
564
  ## Authors
537
565
 
538
566
  * [Piotr Kuczynski](http://github.com/pkuczynski)
data/config.gemspec CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |s|
8
8
  s.date = Time.now.strftime '%F'
9
9
  s.authors = ['Piotr Kuczynski', 'Fred Wu', 'Jacques Crocker']
10
10
  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'
11
+ s.summary = 'Effortless multi-environment settings in Rails, Sinatra, Padrino and others'
12
12
  s.description = 'Easiest way to manage multi-environment settings in any ruby project or framework: ' +
13
- 'Rails, Sinatra, Pandrino and others'
13
+ 'Rails, Sinatra, Padrino and others'
14
14
  s.homepage = 'https://github.com/rubyconfig/config'
15
15
  s.license = 'MIT'
16
16
  s.extra_rdoc_files = %w[README.md CHANGELOG.md CONTRIBUTING.md LICENSE.md]
@@ -24,7 +24,7 @@ Donate: \e[34mhttps://opencollective.com/rubyconfig/donate\e[0m\n"
24
24
  s.files.select! { |file| /(^lib\/|^\w+.md$|\.gemspec$)/ =~ file }
25
25
 
26
26
  s.require_paths = ['lib']
27
- s.required_ruby_version = '>= 2.4.0'
27
+ s.required_ruby_version = '>= 2.6.0'
28
28
 
29
29
  s.add_dependency 'deep_merge', '~> 1.2', '>= 1.2.1'
30
30
  s.add_dependency 'dry-validation', '~> 1.0', '>= 1.0.0'
@@ -32,7 +32,7 @@ Donate: \e[34mhttps://opencollective.com/rubyconfig/donate\e[0m\n"
32
32
  s.add_development_dependency 'rake', '~> 12.0', '>= 12.0.0'
33
33
 
34
34
  # Testing
35
- s.add_development_dependency 'appraisal', '~> 2.3', '>= 2.3.0'
35
+ s.add_development_dependency 'appraisal', '~> 2.5', '>= 2.5.0'
36
36
  s.add_development_dependency 'rspec', '~> 3.9', '>= 3.9.0'
37
37
 
38
38
  # Default RSpec run will test against latest Rails app
@@ -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,7 +24,7 @@ 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 ||= []
@@ -112,7 +112,7 @@ module Config
112
112
  end
113
113
 
114
114
  # Some keywords that don't play nicely with OpenStruct
115
- SETTINGS_RESERVED_NAMES = %w[select collect test count zip min max exit!].freeze
115
+ SETTINGS_RESERVED_NAMES = %w[select collect test count zip min max exit! table].freeze
116
116
 
117
117
  # An alternative mechanism for property access.
118
118
  # This let's you do foo['bar'] along with foo.bar.
@@ -132,11 +132,11 @@ module Config
132
132
  end
133
133
 
134
134
  def key?(key)
135
- table.key?(key)
135
+ @table.key?(key)
136
136
  end
137
137
 
138
138
  def has_key?(key)
139
- table.has_key?(key)
139
+ @table.has_key?(key)
140
140
  end
141
141
 
142
142
  def method_missing(method_name, *args)
@@ -22,10 +22,10 @@ module Config
22
22
 
23
23
  result || {}
24
24
 
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}"
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}"
29
29
  end
30
30
  end
31
31
  end
@@ -1,3 +1,3 @@
1
1
  module Config
2
- VERSION = '3.1.1'.freeze
2
+ VERSION = '5.0.0'.freeze
3
3
  end
data/lib/config.rb CHANGED
@@ -6,7 +6,7 @@ require 'config/sources/yaml_source'
6
6
  require 'config/sources/hash_source'
7
7
  require 'config/sources/env_source'
8
8
  require 'config/validation/schema'
9
- require 'deep_merge'
9
+ require 'deep_merge/core'
10
10
 
11
11
  module Config
12
12
  extend Config::Validation::Schema
@@ -35,12 +35,12 @@ module Config
35
35
 
36
36
  # Create a populated Options instance from a settings file. If a second file is given, then the sections of that
37
37
  # file will overwrite existing sections of the first file.
38
- def self.load_files(*files)
38
+ def self.load_files(*sources)
39
39
  config = Options.new
40
40
 
41
41
  # add settings sources
42
- [files].flatten.compact.uniq.each do |file|
43
- config.add_source!(file.to_s)
42
+ [sources].flatten.compact.each do |source|
43
+ config.add_source!(source)
44
44
  end
45
45
 
46
46
  config.add_source!(Sources::EnvSource.new(ENV)) if Config.use_env
@@ -50,10 +50,10 @@ module Config
50
50
  end
51
51
 
52
52
  # Loads and sets the settings constant!
53
- def self.load_and_set_settings(*files)
53
+ def self.load_and_set_settings(*sources)
54
54
  name = Config.const_name
55
55
  Object.send(:remove_const, name) if Object.const_defined?(name)
56
- Object.const_set(name, Config.load_files(files))
56
+ Object.const_set(name, Config.load_files(sources))
57
57
  end
58
58
 
59
59
  def self.setting_files(config_root, env)
@@ -79,7 +79,7 @@ module Config
79
79
  end
80
80
 
81
81
  # Rails integration
82
- require('config/integrations/rails/railtie') if defined?(::Rails)
82
+ require('config/integrations/rails/railtie') if defined?(::Rails::Railtie)
83
83
 
84
84
  # Sinatra integration
85
85
  require('config/integrations/sinatra') if defined?(::Sinatra)
@@ -18,7 +18,7 @@ module Config
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
24
  "\n" +
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: 3.1.1
4
+ version: 5.0.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: 2022-01-04 00:00:00.000000000 Z
13
+ date: 2023-10-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: deep_merge
@@ -78,20 +78,20 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '2.3'
81
+ version: '2.5'
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
- version: 2.3.0
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
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '2.3'
91
+ version: '2.5'
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: 2.3.0
94
+ version: 2.5.0
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: rspec
97
97
  requirement: !ruby/object:Gem::Requirement
@@ -118,42 +118,56 @@ dependencies:
118
118
  requirements:
119
119
  - - ">="
120
120
  - !ruby/object:Gem::Version
121
- version: 1.4.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.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.1.4
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.1.4
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: '5.0'
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: '5.0'
156
+ version: 6.0.3
157
+ - !ruby/object:Gem::Dependency
158
+ name: sprockets-rails
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - "~>"
162
+ - !ruby/object:Gem::Version
163
+ version: 3.4.2
164
+ type: :development
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - "~>"
169
+ - !ruby/object:Gem::Version
170
+ version: 3.4.2
157
171
  - !ruby/object:Gem::Dependency
158
172
  name: psych
159
173
  requirement: !ruby/object:Gem::Requirement
@@ -203,7 +217,7 @@ dependencies:
203
217
  - !ruby/object:Gem::Version
204
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
@@ -258,15 +272,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
272
  requirements:
259
273
  - - ">="
260
274
  - !ruby/object:Gem::Version
261
- version: 2.4.0
275
+ version: 2.6.0
262
276
  required_rubygems_version: !ruby/object:Gem::Requirement
263
277
  requirements:
264
278
  - - ">="
265
279
  - !ruby/object:Gem::Version
266
280
  version: '0'
267
281
  requirements: []
268
- rubygems_version: 3.1.6
269
- signing_key:
282
+ rubygems_version: 3.4.10
283
+ signing_key:
270
284
  specification_version: 4
271
- summary: Effortless multi-environment settings in Rails, Sinatra, Pandrino and others
285
+ summary: Effortless multi-environment settings in Rails, Sinatra, Padrino and others
272
286
  test_files: []