config 3.1.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -2
- data/README.md +31 -2
- data/config.gemspec +1 -1
- data/lib/config/options.rb +2 -2
- data/lib/config/version.rb +1 -1
- data/lib/config.rb +5 -5
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85332d4ed746064fee534937bdc24149fcedfcc311270527b098da57c42d6a70
|
4
|
+
data.tar.gz: 704036655a9f40ddadbbc6fe8ca3854d2a74e613ee67a972e59adf4de78eaf95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10eb564da50890bc25b7286950c73d4f88e19ab226163379b07a9f63ce4dce245592bb427949970937025c54af611f6278906e4c658b7baae3ae21cbf16892b8
|
7
|
+
data.tar.gz: 06a00c9ad9e3a5d7bd30664de4ab7821c3ae09f9edd9bc3d385a11ece34cdaf09c62bfac11fa6e14cf64596132d6c5481ed50d3f6bcf0849532adb3fd1abc855
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## 4.0.0
|
4
4
|
|
5
|
-
|
5
|
+
### BREAKING CHANGES
|
6
|
+
|
7
|
+
* Rails versions `< 5.2` are no longer supported ([#316](https://github.com/rubyconfig/config/pull/316))
|
8
|
+
* Ruby versions `< 2.6` are no longer supported ([#316](https://github.com/rubyconfig/config/pull/316))
|
9
|
+
* 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:
|
10
|
+
* 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`.
|
11
|
+
* 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
12
|
|
7
13
|
## 3.1.1
|
8
14
|
|
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 ||= []
|
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)
|
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.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-
|
13
|
+
date: 2022-02-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: deep_merge
|
@@ -258,7 +258,7 @@ 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
|
- - ">="
|
@@ -266,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
266
|
version: '0'
|
267
267
|
requirements: []
|
268
268
|
rubygems_version: 3.1.6
|
269
|
-
signing_key:
|
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: []
|