config 3.1.1 → 4.1.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 +15 -2
- data/README.md +31 -2
- data/config.gemspec +1 -1
- data/lib/config/options.rb +2 -2
- data/lib/config/sources/yaml_source.rb +4 -4
- data/lib/config/version.rb +1 -1
- data/lib/config.rb +6 -6
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3cac0bdae533f9149702c94c130eb5ff67615fe379cfa6327f5ca35cd70158d
|
4
|
+
data.tar.gz: 8b6f02dc57a929b9b6f577b006b6fd93691ab2fe2ed03924b96ca4d68ec26d1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d65e0cfebb1a8340128aaf3bd38e177aca37f9e45eca1e2c131a388570e5141b1ac7f6ec4acd266dbfc9ac8abaade6dc3385f4abe2bd8432b641927c2df0e9ee
|
7
|
+
data.tar.gz: 6fca6f8a1bdfd9fd6f11253238a557ada04b37ec949a9f9433bc61c4732150f0397248ec236211dabbc71ea8cc1286f1f74d31e0f643363b7b020733cc94ae8a
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## 4.1.0
|
4
4
|
|
5
|
-
|
5
|
+
### Bug fixes
|
6
|
+
|
7
|
+
* Only load `Railtie` integration if `Rails::Railtie` is defined ([#319](https://github.com/rubyconfig/config/pull/319))
|
8
|
+
* Fix indentation warning in Ruby 3.1 ([#322](https://github.com/rubyconfig/config/pull/322))
|
9
|
+
|
10
|
+
## 4.0.0
|
11
|
+
|
12
|
+
### BREAKING CHANGES
|
13
|
+
|
14
|
+
* Rails versions `< 5.2` are no longer supported ([#316](https://github.com/rubyconfig/config/pull/316))
|
15
|
+
* Ruby versions `< 2.6` are no longer supported ([#316](https://github.com/rubyconfig/config/pull/316))
|
16
|
+
* 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:
|
17
|
+
* 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`.
|
18
|
+
* 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
19
|
|
7
20
|
## 3.1.1
|
8
21
|
|
data/README.md
CHANGED
@@ -24,16 +24,18 @@ Config helps you easily manage environment specific settings in an easy and usab
|
|
24
24
|
Current version supports and is [tested](.github/workflows/tests.yml#L19) for the following interpreters and frameworks:
|
25
25
|
|
26
26
|
* Interpreters
|
27
|
-
* [Ruby](https://www.ruby-lang.org) `>= 2.
|
27
|
+
* [Ruby](https://www.ruby-lang.org) `>= 2.6`
|
28
28
|
* [JRuby](https://www.jruby.org) `>= 9.2`
|
29
29
|
* [TruffleRuby](https://github.com/oracle/truffleruby) `>= 19.3`
|
30
30
|
* Application frameworks
|
31
|
-
* Rails `>=
|
31
|
+
* Rails `>= 5.2`
|
32
32
|
* Padrino
|
33
33
|
* Sinatra
|
34
34
|
|
35
35
|
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
36
|
|
37
|
+
For Ruby `2.4` or `2.5` or Rails `4.2`, `5.0`, or `5.1` use version `3.x` of this gem.
|
38
|
+
|
37
39
|
## Installing
|
38
40
|
|
39
41
|
### Installing on Rails
|
@@ -533,6 +535,33 @@ You are very warmly welcome to help. Please follow our [contribution guidelines]
|
|
533
535
|
|
534
536
|
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
537
|
|
538
|
+
### Running specs
|
539
|
+
|
540
|
+
Setup
|
541
|
+
|
542
|
+
```sh
|
543
|
+
bundle install
|
544
|
+
bundle exec appraisal install
|
545
|
+
```
|
546
|
+
|
547
|
+
List defined appraisals:
|
548
|
+
|
549
|
+
```sh
|
550
|
+
bundle exec appraisal list
|
551
|
+
```
|
552
|
+
|
553
|
+
Run specs for specific appraisal:
|
554
|
+
|
555
|
+
```sh
|
556
|
+
bundle exec appraisal rails-6.1 rspec
|
557
|
+
```
|
558
|
+
|
559
|
+
Run specs for all appraisals:
|
560
|
+
|
561
|
+
```sh
|
562
|
+
bundle exec appraisal rspec
|
563
|
+
```
|
564
|
+
|
536
565
|
## Authors
|
537
566
|
|
538
567
|
* [Piotr Kuczynski](http://github.com/pkuczynski)
|
data/config.gemspec
CHANGED
@@ -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.
|
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'
|
data/lib/config/options.rb
CHANGED
@@ -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 ||= []
|
@@ -22,10 +22,10 @@ module Config
|
|
22
22
|
|
23
23
|
result || {}
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
data/lib/config/version.rb
CHANGED
data/lib/config.rb
CHANGED
@@ -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(*
|
38
|
+
def self.load_files(*sources)
|
39
39
|
config = Options.new
|
40
40
|
|
41
41
|
# add settings sources
|
42
|
-
[
|
43
|
-
config.add_source!(
|
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(*
|
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(
|
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)
|
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:
|
4
|
+
version: 4.1.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-
|
13
|
+
date: 2022-11-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: deep_merge
|
@@ -258,15 +258,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
258
258
|
requirements:
|
259
259
|
- - ">="
|
260
260
|
- !ruby/object:Gem::Version
|
261
|
-
version: 2.
|
261
|
+
version: 2.6.0
|
262
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
263
|
requirements:
|
264
264
|
- - ">="
|
265
265
|
- !ruby/object:Gem::Version
|
266
266
|
version: '0'
|
267
267
|
requirements: []
|
268
|
-
rubygems_version: 3.
|
269
|
-
signing_key:
|
268
|
+
rubygems_version: 3.2.26
|
269
|
+
signing_key:
|
270
270
|
specification_version: 4
|
271
271
|
summary: Effortless multi-environment settings in Rails, Sinatra, Pandrino and others
|
272
272
|
test_files: []
|