environment_config 1.5.0 → 2.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: 6d705d12aa4261630c8ae6f827e4c42f4796b234b883dbfd651da8846c0728de
4
- data.tar.gz: 890af9756be803ba6e9631a9043fc46145e8188594193edb4492e80f948f9510
3
+ metadata.gz: 9309ff0522f135e768a568c6ed44becb8f91d81bbb86d28f37ced6ccfee4f6df
4
+ data.tar.gz: 38a2f3494e4c2699b475fdc4227686311c1ef283d58e970b2dc354a0cc85cd18
5
5
  SHA512:
6
- metadata.gz: 73b6c9ce44379a1a42b4f727fe3ac2c9914a4f1328c1e342c548e609713529d9fa7444c05e3b89e5a3ab1f0a272acfa17d0d60a706e7ee472a542e3fa985715b
7
- data.tar.gz: 041fb583ddfe304d2ccf9dc3872bea8421ddb5f846f726ee81fc5299abff0e141507283c954523622d55cafefaf8436528c7346a67bae18b0d74c15991010e33
6
+ metadata.gz: 57268988b76a40ae1c1700c01545dbe81e4cc857c1b681ecf0b9dae06aa3d88cf0a53739d02c4594cef41911a1b259420ebe4b307b337c1ad63e8404cf7f7557
7
+ data.tar.gz: 70ad6af750dfd00a221fd49de79219dc47d6d053c65ca844da8dace36d4037a96912299402f3701b4a0bc761e3c8fe2d1d6f15b89f04e6cb51fa405ac88e7554
data/.gitlab-ci.yml CHANGED
@@ -1,4 +1,4 @@
1
- image: ruby:2.4.2
1
+ image: ruby:3.0
2
2
 
3
3
  stages:
4
4
  - test
@@ -13,7 +13,20 @@ rubocop:
13
13
  script:
14
14
  - bundle exec rubocop
15
15
 
16
- rspec:
16
+ rspec_3.0:
17
+ image: ruby:3.1
18
+ stage: test
19
+ script:
20
+ - bundle exec rspec
21
+
22
+ rspec_3.1:
23
+ image: ruby:3.1
24
+ stage: test
25
+ script:
26
+ - bundle exec rspec
27
+
28
+ rspec_latest:
29
+ image: ruby:latest
17
30
  stage: test
18
31
  script:
19
32
  - bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 2.0.0
2
+
3
+ * Breaking: Dropped support for Ruby versions below 3
4
+ * Fix support for Ruby versions 3 and above in some cases (e.g. support for Base64 encoded environment variables)
5
+
1
6
  ## 1.5.0
2
7
 
3
8
  * Add support for a new datatype `integer_list`
@@ -21,8 +21,9 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ['lib']
23
23
 
24
- spec.add_development_dependency 'aroundhome_cops', '~> 2.0'
24
+ spec.required_ruby_version = '~> 3.0'
25
+
26
+ spec.add_development_dependency 'aroundhome_cops', '~> 5.0'
25
27
  spec.add_development_dependency 'pry'
26
28
  spec.add_development_dependency 'rspec', '~> 3.6'
27
- spec.add_development_dependency 'rubocop', '0.86'
28
29
  end
@@ -12,11 +12,11 @@ class EnvironmentConfig
12
12
  @config = EnvironmentConfig.new
13
13
  end
14
14
 
15
- def method_missing(method_name, *args)
15
+ def method_missing(method_name, *args, **opts)
16
16
  if Types.known_type?(method_name)
17
17
  type = method_name
18
18
  key = args.shift
19
- convert_and_store(type, key, *args)
19
+ convert_and_store(type, key, *args, **opts)
20
20
  else
21
21
  super
22
22
  end
@@ -28,13 +28,13 @@ class EnvironmentConfig
28
28
 
29
29
  private
30
30
 
31
- def convert_and_store(type, key, *args)
32
- value = TypedEnv.fetch(type, key, *args)
31
+ def convert_and_store(type, key, *args, **opts)
32
+ value = TypedEnv.fetch(type, key, *args, **opts)
33
33
  store(key, value)
34
34
  end
35
35
 
36
36
  def store(key, value)
37
- key = key[@strip_prefix.size..-1] if @strip_prefix && key.start_with?(@strip_prefix)
37
+ key = key[@strip_prefix.size..] if @strip_prefix && key.start_with?(@strip_prefix)
38
38
  config.store(key.downcase, value)
39
39
  end
40
40
  end
@@ -7,8 +7,8 @@ require 'base64'
7
7
  class EnvironmentConfig
8
8
  class TypedEnv
9
9
  class << self
10
- def fetch(type, key, *args)
11
- Types.convert(type, key, fetch_raw(key, *args))
10
+ def fetch(type, key, *args, **opts)
11
+ Types.convert(type, key, fetch_raw(key, *args, **opts))
12
12
  end
13
13
 
14
14
  private
@@ -30,9 +30,9 @@ class EnvironmentConfig
30
30
  type.convert(value)
31
31
  rescue Types::TypeError => e
32
32
  raise ArgumentError,
33
- "Environment variable #{key} could not be read as #{type_name}." \
34
- " Expected: #{e.expected_message}" \
35
- " Got: #{e.value}"
33
+ "Environment variable #{key} could not be read as #{type_name}. " \
34
+ "Expected: #{e.expected_message} " \
35
+ "Got: #{e.value}"
36
36
  end
37
37
 
38
38
  def type_names
@@ -46,7 +46,7 @@ class EnvironmentConfig
46
46
  private
47
47
 
48
48
  def type_map
49
- @type_map ||= ALL.map { |type| [type.name, type] }.to_h
49
+ @type_map ||= ALL.to_h { |type| [type.name, type] }
50
50
  end
51
51
  end
52
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class EnvironmentConfig
4
- VERSION = '1.5.0'
4
+ VERSION = '2.0.0'
5
5
  end
@@ -40,7 +40,7 @@ class EnvironmentConfig
40
40
  end
41
41
 
42
42
  def to_symbol_hash
43
- @store.map { |k, v| [k.to_sym, v] }.to_h
43
+ @store.transform_keys(&:to_sym)
44
44
  end
45
45
 
46
46
  def store(key, value)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: environment_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - be Around GmbH
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-17 00:00:00.000000000 Z
11
+ date: 2023-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aroundhome_cops
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '5.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.6'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: '0.86'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '='
67
- - !ruby/object:Gem::Version
68
- version: '0.86'
69
55
  description:
70
56
  email:
71
57
  - oss@aroundhome.de
@@ -108,17 +94,16 @@ require_paths:
108
94
  - lib
109
95
  required_ruby_version: !ruby/object:Gem::Requirement
110
96
  requirements:
111
- - - ">="
97
+ - - "~>"
112
98
  - !ruby/object:Gem::Version
113
- version: '0'
99
+ version: '3.0'
114
100
  required_rubygems_version: !ruby/object:Gem::Requirement
115
101
  requirements:
116
102
  - - ">="
117
103
  - !ruby/object:Gem::Version
118
104
  version: '0'
119
105
  requirements: []
120
- rubyforge_project:
121
- rubygems_version: 2.7.3
106
+ rubygems_version: 3.2.33
122
107
  signing_key:
123
108
  specification_version: 4
124
109
  summary: Gem to unify reading configuration from env variables.