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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0992bc73a32f12b64e16572e15cbde78e9767730ed5aae4ea2e986e8ef98d81f'
4
- data.tar.gz: 3c9209567d61c87b38a6077550a9c489f3b3b5d441c247ca6563a17ac91f3923
3
+ metadata.gz: b9da8f2d53f6ac0a52f98d5e5c8ae9a2bf80556737a2a040cb0d21f1e6dd94b5
4
+ data.tar.gz: 973029ac871fe3e7880c91a812d2140a570c1298dfced693820ce10f877e40de
5
5
  SHA512:
6
- metadata.gz: c3109086cd8ad5b552bca4d4f219fe2a6e670eb66430c034010be2e8e60bda81c177e80f0a0c32be01c13c3509252d924e4aa40c4916039a9867c6801045eb64
7
- data.tar.gz: 2b59d23bde10b3d1521b681aa04cad979d127c965610c1e9995f12b3e14fa4d0bbb6e56485fbe5ff2bf3cc3eb12fc8c16b156b59ea04c38b41f95ca73881c913
6
+ metadata.gz: 50390ce0eb353dd3baf5c3a42391e57c5f75dc216dc965e5dd07ec508196a75e52fedf15747389a7d403568f127929b62c1d190467c3b60a578270a76e396991
7
+ data.tar.gz: 3ea3c50031729d18f21d619f17f7463ceb9a5409415e97b84bd98038dcf2f1ba44f6a9cd884fbc4f3c61cf408b1fd5ebafdf9f4939231acae388e232d28bbfd8
@@ -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, :exec_args, :parser_args, :filenames
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(*@exec_args) unless @exec_args.empty?
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, @flag_matchers)
34
- @parser_args, @exec_args = split_argv(argv.join(" "), @flag_matchers)
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, flag_matchers)
41
- add_files_option(parser, flag_matchers)
42
- add_help_option(parser, flag_matchers)
43
- add_version_option(parser, flag_matchers)
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, flag_matchers)
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, flag_matchers)
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, flag_matchers)
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]"
@@ -1,3 +1,3 @@
1
1
  module Dotenv
2
- VERSION = "2.7.1".freeze
2
+ VERSION = "2.7.2".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: 2.7.1
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-02-24 00:00:00.000000000 Z
11
+ date: 2019-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake