egg 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dotenv_util.rb +23 -2
- data/lib/egg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d58b8dead4880b093bab77fd6778a5bf9c7a65e
|
4
|
+
data.tar.gz: 3d7eaca180c80110f3d5a072731153c38142a81f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1c47ba956d668acddfdc3455627f543e06227277fb9f60172f8b52e2e7473515bf4b48ac0fa5ebceda7905f62d2367c750db806e4a5a679bd40398a24223afc
|
7
|
+
data.tar.gz: 266a52d7302d056563fe2156d3d9e89a2706ffebbc361d8521a5c340f61934ad2363541aa032a6df4b00aae75f0b13af529ec80af3c55e7deda044c6fa9751b4
|
data/lib/dotenv_util.rb
CHANGED
@@ -2,6 +2,26 @@
|
|
2
2
|
|
3
3
|
# Provides Generic support for manipulating Dotenv files
|
4
4
|
class DotenvUtil
|
5
|
+
|
6
|
+
# Retrieved from https://github.com/bkeepers/dotenv/blob/master/lib/dotenv/parser.rb
|
7
|
+
LINE = /
|
8
|
+
\A
|
9
|
+
\s*
|
10
|
+
(?:export\s+)? # optional export
|
11
|
+
([\w\.]+) # key
|
12
|
+
(?:\s*=\s*|:\s+?) # separator
|
13
|
+
( # optional value begin
|
14
|
+
'(?:\'|[^'])*' # single quoted value
|
15
|
+
| # or
|
16
|
+
"(?:\"|[^"])*" # double quoted value
|
17
|
+
| # or
|
18
|
+
[^#\n]+ # unquoted value
|
19
|
+
)? # value end
|
20
|
+
\s*
|
21
|
+
(?:\#.*)? # optional comment
|
22
|
+
\z
|
23
|
+
/x
|
24
|
+
|
5
25
|
attr_reader :env_text, :env
|
6
26
|
def initialize(env_file)
|
7
27
|
@env_text = env_file
|
@@ -14,7 +34,8 @@ class DotenvUtil
|
|
14
34
|
|
15
35
|
def generate_env
|
16
36
|
env.collect do |key, val|
|
17
|
-
%(
|
37
|
+
val = %("#{val}") if val =~ /\s/
|
38
|
+
"#{key}=#{val}"
|
18
39
|
end.join("\n")
|
19
40
|
end
|
20
41
|
|
@@ -22,7 +43,7 @@ class DotenvUtil
|
|
22
43
|
|
23
44
|
def parse_env_file
|
24
45
|
env_text.split.each_with_object({}) do |line, hash|
|
25
|
-
match = line.match(
|
46
|
+
match = line.match(LINE)
|
26
47
|
next unless match
|
27
48
|
hash.store(*match.captures)
|
28
49
|
hash
|
data/lib/egg/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: egg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Thuringer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-09-
|
12
|
+
date: 2017-09-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|