envalit 0.1.1 → 0.1.2
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 +9 -1
- data/lib/envalit/loader.rb +7 -3
- data/lib/envalit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b8859c0ab034334ff5e0644d6ae4942ae5e938866833fc1f83120971367094df
|
|
4
|
+
data.tar.gz: 11ce9d878b46fa16b0bce00ac11bfb855210144d5caba47bcc6eb07de6e1bdbd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a95231ff12e9e16d379b6fbf48e2dc6c7ed83c1fabe35208946d9787744084ca8aea259df5fe2189af033cf9164c0bda37a8505eb66aa71792045039994e05d4
|
|
7
|
+
data.tar.gz: eec5286048bd29295193072a6e7c614d1d67f565a94094d35deb2d4cc3ca2b044305e91eb8481d2a9ffde88512c9ee86ebe64dc710cafc2741b2c4672b995681
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.2] - 2024-04-08
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Fixed type validation to support both symbol and string type definitions
|
|
14
|
+
- Improved type normalization for better flexibility
|
|
15
|
+
- Enhanced error handling for invalid types
|
|
16
|
+
|
|
10
17
|
## [0.1.1] - 2024-04-08
|
|
11
18
|
|
|
12
19
|
### Changed
|
|
@@ -30,7 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
30
37
|
- Helpful error messages with fix suggestions
|
|
31
38
|
- Integration with dotenv for .env file handling
|
|
32
39
|
|
|
33
|
-
[Unreleased]: https://github.com/bugloper/envalit/compare/v0.1.
|
|
40
|
+
[Unreleased]: https://github.com/bugloper/envalit/compare/v0.1.2...HEAD
|
|
41
|
+
[0.1.2]: https://github.com/bugloper/envalit/compare/v0.1.1...v0.1.2
|
|
34
42
|
[0.1.1]: https://github.com/bugloper/envalit/compare/v0.1.0...v0.1.1
|
|
35
43
|
[0.1.0]: https://github.com/bugloper/envalit/releases/tag/v0.1.0
|
|
36
44
|
|
data/lib/envalit/loader.rb
CHANGED
|
@@ -108,7 +108,10 @@ module Envalit
|
|
|
108
108
|
# @return [void]
|
|
109
109
|
def validate_options(options)
|
|
110
110
|
type = options[:type]
|
|
111
|
-
return unless type
|
|
111
|
+
return unless type
|
|
112
|
+
|
|
113
|
+
normalized_type = type.to_s.downcase.to_sym
|
|
114
|
+
return if VALID_TYPES.include?(normalized_type)
|
|
112
115
|
|
|
113
116
|
raise ArgumentError,
|
|
114
117
|
"#{ERROR_COLOR}Invalid type: #{type}. Valid types are: #{VALID_TYPES.join(', ')}#{RESET_COLOR}"
|
|
@@ -169,9 +172,10 @@ module Envalit
|
|
|
169
172
|
# @return [void]
|
|
170
173
|
def check_invalid_types
|
|
171
174
|
invalid_vars = @schema.select do |key, opts|
|
|
172
|
-
next false if ENV[key].nil?
|
|
175
|
+
next false if ENV[key].nil? || !opts[:type]
|
|
173
176
|
|
|
174
|
-
|
|
177
|
+
type = opts[:type].to_s.downcase.to_sym
|
|
178
|
+
case type
|
|
175
179
|
when :integer
|
|
176
180
|
!ENV[key].match?(/\A-?\d+\z/)
|
|
177
181
|
when :float
|
data/lib/envalit/version.rb
CHANGED