dotenv 2.7.1 → 2.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dotenv/cli.rb +11 -32
- data/lib/dotenv/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9da8f2d53f6ac0a52f98d5e5c8ae9a2bf80556737a2a040cb0d21f1e6dd94b5
|
4
|
+
data.tar.gz: 973029ac871fe3e7880c91a812d2140a570c1298dfced693820ce10f877e40de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50390ce0eb353dd3baf5c3a42391e57c5f75dc216dc965e5dd07ec508196a75e52fedf15747389a7d403568f127929b62c1d190467c3b60a578270a76e396991
|
7
|
+
data.tar.gz: 3ea3c50031729d18f21d619f17f7463ceb9a5409415e97b84bd98038dcf2f1ba44f6a9cd884fbc4f3c61cf408b1fd5ebafdf9f4939231acae388e232d28bbfd8
|
data/lib/dotenv/cli.rb
CHANGED
@@ -6,12 +6,11 @@ module Dotenv
|
|
6
6
|
# The CLI is a class responsible of handling all the command line interface
|
7
7
|
# logic.
|
8
8
|
class CLI
|
9
|
-
attr_reader :argv, :
|
9
|
+
attr_reader :argv, :filenames
|
10
10
|
|
11
11
|
def initialize(argv = [])
|
12
12
|
@argv = argv.dup
|
13
13
|
@filenames = []
|
14
|
-
@flag_matchers = []
|
15
14
|
end
|
16
15
|
|
17
16
|
def run
|
@@ -22,7 +21,7 @@ module Dotenv
|
|
22
21
|
rescue Errno::ENOENT => e
|
23
22
|
abort e.message
|
24
23
|
else
|
25
|
-
exec(*@
|
24
|
+
exec(*@argv) unless @argv.empty?
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
@@ -30,58 +29,38 @@ module Dotenv
|
|
30
29
|
|
31
30
|
def parse_argv!(argv)
|
32
31
|
parser = create_option_parser
|
33
|
-
add_options(parser
|
34
|
-
|
35
|
-
parser.parse! @parser_args
|
32
|
+
add_options(parser)
|
33
|
+
parser.order!(argv)
|
36
34
|
|
37
35
|
@filenames
|
38
36
|
end
|
39
37
|
|
40
|
-
def add_options(parser
|
41
|
-
add_files_option(parser
|
42
|
-
add_help_option(parser
|
43
|
-
add_version_option(parser
|
38
|
+
def add_options(parser)
|
39
|
+
add_files_option(parser)
|
40
|
+
add_help_option(parser)
|
41
|
+
add_version_option(parser)
|
44
42
|
end
|
45
43
|
|
46
|
-
def add_files_option(parser
|
47
|
-
flag_matchers.push("-f \\S+")
|
44
|
+
def add_files_option(parser)
|
48
45
|
parser.on("-f FILES", Array, "List of env files to parse") do |list|
|
49
46
|
@filenames = list
|
50
47
|
end
|
51
48
|
end
|
52
49
|
|
53
|
-
def add_help_option(parser
|
54
|
-
flag_matchers.push("-h", "--help")
|
50
|
+
def add_help_option(parser)
|
55
51
|
parser.on("-h", "--help", "Display help") do
|
56
52
|
puts parser
|
57
53
|
exit
|
58
54
|
end
|
59
55
|
end
|
60
56
|
|
61
|
-
def add_version_option(parser
|
62
|
-
flag_matchers.push("-v", "--version")
|
57
|
+
def add_version_option(parser)
|
63
58
|
parser.on("-v", "--version", "Show version") do
|
64
59
|
puts "dotenv #{Dotenv::VERSION}"
|
65
60
|
exit
|
66
61
|
end
|
67
62
|
end
|
68
63
|
|
69
|
-
# Detect dotenv flags vs executable args so we can parse properly and still
|
70
|
-
# take advantage of OptionParser for dotenv flags
|
71
|
-
def split_argv(arg_string, matchers)
|
72
|
-
matcher = /^((?:#{matchers.join("|")})\s?)?(.+)?$/
|
73
|
-
data = matcher.match(arg_string)
|
74
|
-
dotenv_args = []
|
75
|
-
exec_args = []
|
76
|
-
|
77
|
-
unless data.nil?
|
78
|
-
dotenv_args = (!data[1].nil? ? data[1].split(" ") : [])
|
79
|
-
exec_args = (!data[2].nil? ? data[2].split(" ") : [])
|
80
|
-
end
|
81
|
-
|
82
|
-
[dotenv_args, exec_args]
|
83
|
-
end
|
84
|
-
|
85
64
|
def create_option_parser
|
86
65
|
OptionParser.new do |parser|
|
87
66
|
parser.banner = "Usage: dotenv [options]"
|
data/lib/dotenv/version.rb
CHANGED
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: 2.7.
|
4
|
+
version: 2.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Keepers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|