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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b61de3729ba9e766c12cfb3247e5b717c326287574e73720c6ef42f0ffbc52d
4
- data.tar.gz: 2b9dc359ff3a179723a8a97495805adcabe3678cc929df469c89515f749d85ee
3
+ metadata.gz: b8859c0ab034334ff5e0644d6ae4942ae5e938866833fc1f83120971367094df
4
+ data.tar.gz: 11ce9d878b46fa16b0bce00ac11bfb855210144d5caba47bcc6eb07de6e1bdbd
5
5
  SHA512:
6
- metadata.gz: 247c373e29ba49354aed9f7390ee757b78ef8d65be866826420b2f5d537d23d88c6e0c27749a5942d31029e562285884c42ec99c6edba9d627267e6540332283
7
- data.tar.gz: 828f64937db6dc959d118a4e9d69d443fa2a335ed20082646bd4d11bc1da7fbfe68b5893a30bffdbba0d4e3be060394139e7ea79197ec02ca335f280e53d3441
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.1...HEAD
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
 
@@ -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 && !VALID_TYPES.include?(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
- case opts[:type]
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Envalit
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: envalit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - bugloper