gli 2.21.2 → 2.21.4

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: 60f96a57b4abf16e79016ea09350797584e9a26882630c54340209c8db4ff527
4
+ data.tar.gz: 67e19189b4f770c374609de68d67a5ae41fb58ae92faaa3f735a4507db14d44b
5
5
  SHA512:
6
- metadata.gz: ca8f6b6130a39c4074b90633fdb4ae6261cfeff78f41928d8afae1e2fe1a7e6bb7429536569b891e44084a3ae719a204e1ebea8dea7052d5b257c9f50bff85b8
7
- data.tar.gz: 1ef6e27dbf75f34e06735c0f1fda33d0ee09989f5f0d165d5d79efbbd148c04d1507f8a580f7b177d0c9b4140a55035db5ed1210f79ef717d60d62f6754221a2
6
+ metadata.gz: 07e228e867c65b76c31929e6f2680a884c4f37841dc43a3ca778e0b272583ca8e9e194d63be45bd843def5ba4fceeb496f20c9b0392448f4acc6bf8fa62a3b4d
7
+ data.tar.gz: 54151c1d669e25abeb7f1061003acf9230c4906dcfdf3766aefb90eb86f901416edb657d718bceda944817fb7d6f923530a892ec3c2aba4ba6db3e61167bb53f
data/CONTRIBUTING.md CHANGED
@@ -53,6 +53,9 @@ checked-out files, the other containers will have access as well.
53
53
  2. `inside-docker-container> bin/setup # installs all gems`
54
54
  3. `inside-docker-container> bin/rake # runs all tests`
55
55
 
56
+ You can also try using `bin/ci` on your computer (not inside a Docker container), which will run tests across the entire build
57
+ matrix.
58
+
56
59
  #### If You Want To Use Your Local Computer
57
60
 
58
61
  In theory, GLI can be worked on using RVM, RBEnv, asdf, or whatever other way you want to manage Ruby. You can create a
data/bin/ci CHANGED
@@ -1,29 +1,17 @@
1
1
  #!/bin/bash
2
2
 
3
3
  set -e
4
- if [ -z $1 ]; then
5
- echo "[bin/ci] Running with default warnings"
6
- export RUBYOPT=
7
- else
8
- if [ $1 == 'warnings' ]; then
9
- echo "[bin/ci] Running with all warnings on"
10
- export RUBYOPT=-w
11
- else
12
- if [ $1 == 'none' ]; then
13
- echo "[bin/ci] Running with all warnings off"
14
- export RUBYOPT='-W0'
15
- else
16
- echo "[bin/ci] '$1' is not a supported option"
17
- echo "[bin/ci] usage: $0 # run with default warnings"
18
- echo "[bin/ci] usage: $0 warnings # run with all warnings"
19
- echo "[bin/ci] usage: $0 none # run with warnings disabled"
20
- exit 1
21
- fi
22
- fi
23
- fi
24
4
 
25
- echo "[bin/ci] Running unit tests"
26
- bin/rake test:unit
5
+ SCRIPT_DIR=$( cd -- "$( dirname -- "${0}" )" > /dev/null 2>&1 && pwd )
6
+ DX_DIR="${SCRIPT_DIR}/../dx"
7
+
8
+ . "${DX_DIR}/docker-compose.env"
9
+ . "${DX_DIR}/setupkit.sh.lib"
10
+
11
+ for ruby_version in ${RUBY_VERSIONS[@]}; do
12
+ log "Setting up for Ruby version '${ruby_version}'"
13
+ dx/exec -v ${ruby_version} bin/setup
14
+ log "Running tests for Ruby version '${ruby_version}'"
15
+ dx/exec -v ${ruby_version} bin/rake
16
+ done
27
17
 
28
- echo "[bin/ci] Running integration tests"
29
- bin/rake test:integration
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
data/gli.gemspec CHANGED
@@ -12,6 +12,15 @@ spec = Gem::Specification.new do |s|
12
12
  s.summary = "Build command-suite CLI apps that are awesome."
13
13
  s.description = "Build command-suite CLI apps that are awesome. Bootstrap your app, add commands, options and documentation while maintaining a well-tested idiomatic command-line app"
14
14
 
15
+ s.metadata = {
16
+ 'bug_tracker_uri' => 'https://github.com/davetron5000/gli/issues',
17
+ 'changelog_uri' => 'https://github.com/davetron5000/gli/releases',
18
+ 'documentation_uri' => 'http://davetron5000.github.io/gli/rdoc/index.html',
19
+ 'homepage_uri' => 'https://davetron5000.github.com/gli/',
20
+ 'source_code_uri' => 'https://github.com/davetron5000/gli/',
21
+ 'wiki_url' => 'https://github.com/davetron5000/gli/wiki',
22
+ }
23
+
15
24
  s.files = `git ls-files`.split("\n")
16
25
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
26
  s.require_paths = ["lib"]
@@ -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.4'
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,14 +1,14 @@
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Copeland
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-16 00:00:00.000000000 Z
11
+ date: 2024-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -212,7 +212,13 @@ files:
212
212
  homepage: http://davetron5000.github.io/gli
213
213
  licenses:
214
214
  - Apache-2.0
215
- metadata: {}
215
+ metadata:
216
+ bug_tracker_uri: https://github.com/davetron5000/gli/issues
217
+ changelog_uri: https://github.com/davetron5000/gli/releases
218
+ documentation_uri: http://davetron5000.github.io/gli/rdoc/index.html
219
+ homepage_uri: https://davetron5000.github.com/gli/
220
+ source_code_uri: https://github.com/davetron5000/gli/
221
+ wiki_url: https://github.com/davetron5000/gli/wiki
216
222
  post_install_message:
217
223
  rdoc_options:
218
224
  - "--title"