dotenv 3.1.5 → 3.1.6

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: '0538a4a253670835a8677a2aedfd452bf30ddd8518eef0ca6a0ba448bf7ddebf'
4
- data.tar.gz: 6070c643cedccf246d9e24304a42da54736a573f1c15da6343a061f1f525e1be
3
+ metadata.gz: 9ef0c37e3854d57f689650f8dd106baf862506689c27a3151f19d1e56c8c205d
4
+ data.tar.gz: 933c17a9b3974de22f762da60230f449a8b7b75b94949995301905d146289591
5
5
  SHA512:
6
- metadata.gz: f5206862c11d4ee45343f1d1d9a66570f82df8fdf16fb403bd354d20de56de6958d49b1061688a18fbf2cbd5f06f5aabd7d3b073bfa7f3469523b8fff2495e33
7
- data.tar.gz: d25a177df394c9050b9d0c10d06f929bf652ef24f2b7599841734ae92d7e1ebbe388400aec5adfb36eb14e33088a723af969792a966b8cffa48b11da63596bbd
6
+ metadata.gz: 9a8fed1ea223636257222b690ca9320328d382671fe4023015ddd3aebbd0c778b8f904dab59e80c89309fc01c97e7bb0981c3c2b61833a4884b0c3744608a54b
7
+ data.tar.gz: 1cbe9de7f7587cb500464130cc1069f064630eff8ba905fc438080830aec6d7bd193dd5b97b22f71446f78313e1840c4fd147677be2b134e00853f58dafe8ec2
data/lib/dotenv/parser.rb CHANGED
@@ -52,11 +52,11 @@ module Dotenv
52
52
  @string.scan(LINE) do
53
53
  match = $LAST_MATCH_INFO
54
54
 
55
- # Skip parsing values that will be ignored
56
- next if ignore?(match[:key])
57
-
58
- # Check for exported variable with no value
59
- if match[:export] && !match[:value]
55
+ if existing?(match[:key])
56
+ # Use value from already defined variable
57
+ @hash[match[:key]] = ENV[match[:key]]
58
+ elsif match[:export] && !match[:value]
59
+ # Check for exported variable with no value
60
60
  if !@hash.member?(match[:key])
61
61
  raise FormatError, "Line #{match.to_s.inspect} has an unset variable"
62
62
  end
@@ -70,8 +70,8 @@ module Dotenv
70
70
 
71
71
  private
72
72
 
73
- # Determine if the key can be ignored.
74
- def ignore?(key)
73
+ # Determine if a variable is already defined and should not be overwritten.
74
+ def existing?(key)
75
75
  !@overwrite && key != "DOTENV_LINEBREAK_MODE" && ENV.key?(key)
76
76
  end
77
77
 
@@ -1,3 +1,3 @@
1
1
  module Dotenv
2
- VERSION = "3.1.5".freeze
2
+ VERSION = "3.1.6".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotenv
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.5
4
+ version: 3.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keepers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-12 00:00:00.000000000 Z
11
+ date: 2024-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -85,7 +85,7 @@ licenses:
85
85
  - MIT
86
86
  metadata:
87
87
  changelog_uri: https://github.com/bkeepers/dotenv/releases
88
- post_install_message:
88
+ post_install_message:
89
89
  rdoc_options: []
90
90
  require_paths:
91
91
  - lib
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubygems_version: 3.5.22
104
- signing_key:
104
+ signing_key:
105
105
  specification_version: 4
106
106
  summary: Loads environment variables from `.env`.
107
107
  test_files: []