complex_config 0.24.0 → 0.25.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/CHANGES.md +17 -1
- data/README.md +20 -0
- data/VERSION +1 -1
- data/complex_config.gemspec +4 -4
- data/lib/complex_config/plugins/money.rb +2 -1
- data/lib/complex_config/version.rb +1 -1
- data/spec/complex_config/plugins_spec.rb +53 -22
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a31f4ffa0d9542e26c19f2a3e6e664e996ebc69d4c700832159bbf4448d3e881
|
|
4
|
+
data.tar.gz: c81b874b5e802bb66b888727ed63c0573be0ee68e9b141d4ef54478b352d6406
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6de56cb12568bbb945ddc06fae9065e98de0e09ba48d18a7bb1c0ec05b47e5e8995f1413a46fb425f0e02392b427ad35f763dd7d668d00a0565ea998b85484f9
|
|
7
|
+
data.tar.gz: abb1787b14b12a6565134a95480cff03cc69efac45cbb455c6ddb774a5911fa891b90d91e02c6518b43817e3cc56b9880f8af40f22d213a8e6f5b03081ac375f
|
data/CHANGES.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
## 2025-12-19 v0.25.0
|
|
2
|
+
|
|
3
|
+
- Added support for Ruby **4.0**-rc-alpine image in test matrix
|
|
4
|
+
- Enhanced `ComplexConfig::Plugins::MONEY` plugin to support configurable
|
|
5
|
+
default currency via `COMPLEX_CONFIG_MONEY_DEFAULT_CURRENCY` environment
|
|
6
|
+
variable
|
|
7
|
+
- Changed money gem usage from `Money.new(cents)` to `Money.from_cents(cents,
|
|
8
|
+
currency.upcase)` for proper currency handling
|
|
9
|
+
- Updated plugin to default to **EUR** currency when no environment variable is set
|
|
10
|
+
- Added comprehensive test coverage for default **EUR** and custom **BTC**
|
|
11
|
+
currency scenarios
|
|
12
|
+
- Implemented proper environment variable isolation in tests using `around`
|
|
13
|
+
blocks
|
|
14
|
+
- Updated `s.rubygems_version` from **3.7.2** to **4.0.2**
|
|
15
|
+
- Updated `gem_hadar` development dependency from version **2.8** to **2.10**
|
|
16
|
+
- Changed `bundle update` to `bundle update --all` in `.all_images.yml` to
|
|
17
|
+
ensure all gems are updated
|
|
2
18
|
|
|
3
19
|
## 2025-11-24 v0.24.0
|
|
4
20
|
|
data/README.md
CHANGED
|
@@ -674,6 +674,26 @@ module ComplexConfig::Plugins
|
|
|
674
674
|
end
|
|
675
675
|
```
|
|
676
676
|
|
|
677
|
+
### MONEY Plugin Configuration
|
|
678
|
+
|
|
679
|
+
The `MONEY` plugin supports configurable default currencies through the
|
|
680
|
+
`COMPLEX_CONFIG_MONEY_DEFAULT_CURRENCY` environment variable:
|
|
681
|
+
|
|
682
|
+
```ruby
|
|
683
|
+
# Default behavior - uses EUR if no environment variable is set
|
|
684
|
+
MONEY = -> id, currency = ENV.fetch('COMPLEX_CONFIG_MONEY_DEFAULT_CURRENCY', 'EUR') do
|
|
685
|
+
if cents = ask_and_send("#{id}_in_cents")
|
|
686
|
+
Money.from_cents(cents, currency.upcase)
|
|
687
|
+
else
|
|
688
|
+
skip
|
|
689
|
+
end
|
|
690
|
+
end
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
**Important Note**: Modern versions of the `money` gem require explicit
|
|
694
|
+
currency specification. The plugin now uses `Money.from_cents(cents, currency)`
|
|
695
|
+
instead of `Money.new(cents)` to ensure proper currency handling.
|
|
696
|
+
|
|
677
697
|
## Download 📥
|
|
678
698
|
|
|
679
699
|
The homepage of this library is located at
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.25.0
|
data/complex_config.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: complex_config 0.
|
|
2
|
+
# stub: complex_config 0.25.0 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "complex_config".freeze
|
|
6
|
-
s.version = "0.
|
|
6
|
+
s.version = "0.25.0".freeze
|
|
7
7
|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
9
|
s.require_paths = ["lib".freeze]
|
|
@@ -17,13 +17,13 @@ Gem::Specification.new do |s|
|
|
|
17
17
|
s.homepage = "https://github.com/flori/complex_config".freeze
|
|
18
18
|
s.licenses = ["Apache-2.0".freeze]
|
|
19
19
|
s.rdoc_options = ["--title".freeze, "ComplexConfig -- configuration library".freeze, "--main".freeze, "README.md".freeze]
|
|
20
|
-
s.rubygems_version = "
|
|
20
|
+
s.rubygems_version = "4.0.2".freeze
|
|
21
21
|
s.summary = "configuration library".freeze
|
|
22
22
|
s.test_files = ["spec/complex_config/config_spec.rb".freeze, "spec/complex_config/encryption_spec.rb".freeze, "spec/complex_config/key_source_spec.rb".freeze, "spec/complex_config/plugins_spec.rb".freeze, "spec/complex_config/provider_spec.rb".freeze, "spec/complex_config/settings_spec.rb".freeze, "spec/complex_config/shortcuts_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
|
23
23
|
|
|
24
24
|
s.specification_version = 4
|
|
25
25
|
|
|
26
|
-
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.
|
|
26
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.10".freeze])
|
|
27
27
|
s.add_development_dependency(%q<rake>.freeze, [">= 0".freeze])
|
|
28
28
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
|
|
29
29
|
s.add_development_dependency(%q<rspec>.freeze, [">= 0".freeze])
|
|
@@ -8,8 +8,9 @@ rescue LoadError
|
|
|
8
8
|
else
|
|
9
9
|
module ComplexConfig::Plugins
|
|
10
10
|
MONEY = -> id do
|
|
11
|
+
currency = ENV.fetch('COMPLEX_CONFIG_MONEY_DEFAULT_CURRENCY', 'EUR')
|
|
11
12
|
if cents = ask_and_send("#{id}_in_cents")
|
|
12
|
-
Money.
|
|
13
|
+
Money.from_cents(cents, currency.upcase)
|
|
13
14
|
else
|
|
14
15
|
skip
|
|
15
16
|
end
|
|
@@ -6,40 +6,71 @@ describe ComplexConfig::Plugins do
|
|
|
6
6
|
ComplexConfig::Provider
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
context described_class::URI do
|
|
19
|
-
it 'can return an URL string' do
|
|
20
|
-
expect(settings.foo.test_url).to eq 'http://www.ping.de'
|
|
9
|
+
context 'with EUR default' do
|
|
10
|
+
let :settings do
|
|
11
|
+
ComplexConfig::Settings[
|
|
12
|
+
foo: {
|
|
13
|
+
test_url: 'http://www.ping.de',
|
|
14
|
+
cash_in_cents: 100.to_money('EUR').cents
|
|
15
|
+
}
|
|
16
|
+
]
|
|
21
17
|
end
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
around do |example|
|
|
20
|
+
old = ENV['COMPLEX_CONFIG_MONEY_DEFAULT_CURRENCY']
|
|
21
|
+
ENV.delete('COMPLEX_CONFIG_MONEY_DEFAULT_CURRENCY')
|
|
22
|
+
example.run
|
|
23
|
+
ensure
|
|
24
|
+
ENV['COMPLEX_CONFIG_MONEY_DEFAULT_CURRENCY'] = old
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
context described_class::URI do
|
|
28
|
+
it 'can return an URL string' do
|
|
29
|
+
expect(settings.foo.test_url).to eq 'http://www.ping.de'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'can return an URI' do
|
|
33
|
+
expect(settings.foo.test_uri).to eq URI.parse('http://www.ping.de')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'can return an URI' do
|
|
37
|
+
expect(settings.foo[:test_uri]).to eq URI.parse('http://www.ping.de')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'can skips if blub' do
|
|
41
|
+
expect { settings.foo.nix_uri }.to raise_error(ComplexConfig::AttributeMissing)
|
|
42
|
+
end
|
|
29
43
|
end
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
context described_class::MONEY do
|
|
46
|
+
it 'can return a Fixnum' do
|
|
47
|
+
expect(settings.foo.cash_in_cents).to eq 100_00
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'can return a Money instance' do
|
|
51
|
+
expect(settings.foo.cash).to eq 100.to_money('EUR')
|
|
52
|
+
end
|
|
33
53
|
end
|
|
34
54
|
end
|
|
35
55
|
|
|
36
|
-
context
|
|
37
|
-
|
|
38
|
-
|
|
56
|
+
context 'with BTC' do
|
|
57
|
+
let :settings do
|
|
58
|
+
ComplexConfig::Settings[
|
|
59
|
+
foo: {
|
|
60
|
+
test_url: 'http://www.ping.de',
|
|
61
|
+
cash_in_cents: 100.to_money('BTC').cents
|
|
62
|
+
}
|
|
63
|
+
]
|
|
39
64
|
end
|
|
40
65
|
|
|
66
|
+
around do |example|
|
|
67
|
+
old, ENV['COMPLEX_CONFIG_MONEY_DEFAULT_CURRENCY'] = ENV['COMPLEX_CONFIG_MONEY_DEFAULT_CURRENCY'], 'BTC'
|
|
68
|
+
example.run
|
|
69
|
+
ensure
|
|
70
|
+
ENV['COMPLEX_CONFIG_MONEY_DEFAULT_CURRENCY'] = old
|
|
71
|
+
end
|
|
41
72
|
it 'can return a Money instance' do
|
|
42
|
-
expect(settings.foo.cash).to eq 100.to_money
|
|
73
|
+
expect(settings.foo.cash).to eq 100.to_money('BTC')
|
|
43
74
|
end
|
|
44
75
|
end
|
|
45
76
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: complex_config
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.25.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '2.
|
|
18
|
+
version: '2.10'
|
|
19
19
|
type: :development
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '2.
|
|
25
|
+
version: '2.10'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: rake
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -269,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
269
269
|
- !ruby/object:Gem::Version
|
|
270
270
|
version: '0'
|
|
271
271
|
requirements: []
|
|
272
|
-
rubygems_version:
|
|
272
|
+
rubygems_version: 4.0.2
|
|
273
273
|
specification_version: 4
|
|
274
274
|
summary: configuration library
|
|
275
275
|
test_files:
|