gli 2.21.2 → 2.21.3

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: 33feccb199126e4e39e227aaddd88d3d0a270bc3954a2e47a20f3613049eec3b
4
- data.tar.gz: f1530371f4226510065a4acdc3d884bedee3e877979428c06579747863e02c8d
3
+ metadata.gz: 2f66f71d97f5bb59503b88b120369d123015ae612088de9a6987ad34686bcafa
4
+ data.tar.gz: cf4bf46c072cae3e57997f0a309e7addebe288fbef32317aee374b1eaaf9859c
5
5
  SHA512:
6
- metadata.gz: ca8f6b6130a39c4074b90633fdb4ae6261cfeff78f41928d8afae1e2fe1a7e6bb7429536569b891e44084a3ae719a204e1ebea8dea7052d5b257c9f50bff85b8
7
- data.tar.gz: 1ef6e27dbf75f34e06735c0f1fda33d0ee09989f5f0d165d5d79efbbd148c04d1507f8a580f7b177d0c9b4140a55035db5ed1210f79ef717d60d62f6754221a2
6
+ metadata.gz: 26b9cd9219f73b06ecd20b547b5e3cad441c7ff22099213b916780286815e6c57f8d7d1d50a0e1ff0d516ce27cf1513da36a80c52fa8d25c35e67fa5685f9a6d
7
+ data.tar.gz: 71e9d691d506a3b07a9a29d7e06988df3e798529d0a4ae4cad1ff08070537df6506d3306ed94095c4109e3740ce9b7c7aceb7a92c0540a493b847d1348418874
data/dx/build CHANGED
@@ -35,7 +35,7 @@ log "✨" "Creating docker-compose.dx.yml"
35
35
  compose_file="docker-compose.dx.yml"
36
36
  log "🗑️" "Deleting previous ${compose_file}"
37
37
 
38
- rm "${compose_file}"
38
+ rm -f "${compose_file}"
39
39
  echo "# THIS IS GENERATED - DO NOT EDIT" > "${compose_file}"
40
40
  echo "" >> "${compose_file}"
41
41
  echo "services:" >> "${compose_file}"
@@ -54,7 +54,7 @@ for ruby_version in ${RUBY_VERSIONS[@]}; do
54
54
  echo " entrypoint: /root/show-help-in-app-container-then-wait.sh" >> "${compose_file}"
55
55
  echo " working_dir: /root/work" >> "${compose_file}"
56
56
  done
57
- log "🎼" "${compose_file} is noq created"
57
+ log "🎼" "${compose_file} is now created"
58
58
  log "🔄" "You can run dx/start to start it up, though you may need to stop it first with Ctrl-C"
59
59
 
60
60
  # vim: ft=bash
@@ -109,9 +109,10 @@ module GLI
109
109
  def verify_required_options!(flags, command, options)
110
110
  missing_required_options = flags.values.
111
111
  select(&:required?).
112
- reject { |option|
113
- options[option.name] != nil
114
- }
112
+ select { |option|
113
+ options[option.name] == nil ||
114
+ ( options[option.name].kind_of?(Array) && options[option.name].empty? )
115
+ }
115
116
  unless missing_required_options.empty?
116
117
  missing_required_options.sort!
117
118
  raise MissingRequiredArgumentsException.new(missing_required_options.map { |option|
data/lib/gli/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module GLI
2
2
  unless const_defined? :VERSION
3
- VERSION = '2.21.2'
3
+ VERSION = '2.21.3'
4
4
  end
5
5
  end
@@ -81,6 +81,25 @@ class GLITest < Minitest::Test
81
81
 
82
82
  end
83
83
 
84
+ def test_command_options_accepting_multiple_values_can_be_required
85
+ @app.reset
86
+ @called = false
87
+ @app.command :foo do |c|
88
+ c.flag :flag, :required => true, :multiple => true
89
+ c.action do |global, options, arguments|
90
+ @called = true
91
+ end
92
+ end
93
+ assert_equal 64, @app.run(['foo']), "Expected exit status to be 64"
94
+ assert @fake_stderr.contained?(/flag is required/), @fake_stderr.strings.inspect
95
+ assert @fake_stderr.contained?(/flag is required/), @fake_stderr.strings.inspect
96
+ assert !@called
97
+
98
+ assert_equal 0, @app.run(['foo','--flag=bar']), "Expected exit status to be 0 #{@fake_stderr.strings.join(',')}"
99
+ assert @called
100
+
101
+ end
102
+
84
103
  def test_global_options_can_be_required
85
104
  @app.reset
86
105
  @called = false
@@ -102,6 +121,25 @@ class GLITest < Minitest::Test
102
121
 
103
122
  end
104
123
 
124
+ def test_global_options_accepting_multiple_can_be_required
125
+ @app.reset
126
+ @called = false
127
+ @app.flag :flag, :required => true, :multiple => true
128
+ @app.command :foo do |c|
129
+ c.action do |global, options, arguments|
130
+ @called = true
131
+ end
132
+ end
133
+ assert_equal 64, @app.run(['foo']), "Expected exit status to be 64"
134
+ assert @fake_stderr.contained?(/flag is required/), @fake_stderr.strings.inspect
135
+ assert @fake_stderr.contained?(/flag is required/), @fake_stderr.strings.inspect
136
+ assert !@called
137
+
138
+ assert_equal 0, @app.run(['--flag=bar','foo']), "Expected exit status to be 0 #{@fake_stderr.strings.join(',')}"
139
+ assert @called
140
+
141
+ end
142
+
105
143
  def test_global_required_options_are_ignored_on_help
106
144
  @app.reset
107
145
  @called = false
@@ -161,6 +199,7 @@ class GLITest < Minitest::Test
161
199
  raise failure if !failure.nil?
162
200
  end
163
201
 
202
+
164
203
  def test_command_line_overrides_config
165
204
  failure = nil
166
205
  @app.reset
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.21.2
4
+ version: 2.21.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Copeland