optimist 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 416ba2a0bcc410fa9e8a746b73335cff35b550634d4f26a7c1c17547db2ba61b
4
- data.tar.gz: 1a2b555e3a7ec6eef5af0976d660454151888052e9492695ac5d932090e858ee
3
+ metadata.gz: 3d29d64e512655a994c2f2665c6b0be52194f64624a442509eaf49373efe0d23
4
+ data.tar.gz: c48da179e2d0dfa451e5eb2efd4ae62efafb6148dfdc18342c8c78f1faceb5b9
5
5
  SHA512:
6
- metadata.gz: 0ce87d7db57a7840f84cb9be3c0aad95e9dd227becbf873309ea7256175be969b937742ca781b0f5345e71ca73a6cc508e5d1e0953d03391fb44e5efa43e681c
7
- data.tar.gz: a760065b4b8e4477e9fd90644b92e7b802eff249cc6f742d83cb8f891e1d35b9cbfbc9380a2fb6fc6f75f69cd2a1741336ee900a61b6e4abae23d82005b75b06
6
+ metadata.gz: be8c02eb87bc55221dfb42dfeb347026651a945617fbfda12892e4960cba9762a02a224927f05c54a7a186778f646c5435508ea9e9d7a7c19573dcaa2b3869e1
7
+ data.tar.gz: fcb56bc996d0016e9c521f2d696cdc90338579060e745656c4e5cd0493390d94f57ecfe2d94864fb7b67b0c9f652dd2a29502d23af8ab182acd4a26486fc39a9
@@ -13,15 +13,13 @@ jobs:
13
13
  fail-fast: false
14
14
  matrix:
15
15
  ruby-version:
16
- - '2.4'
17
- - '2.5'
18
- - '2.6'
19
16
  - '2.7'
20
17
  - '3.0'
21
18
  - '3.1'
22
19
  - '3.2'
23
20
  - '3.3'
24
- - jruby-9.3
21
+ - '3.4'
22
+ - jruby-9.4
25
23
  - ruby-head
26
24
  - jruby-head
27
25
  steps:
@@ -33,4 +31,3 @@ jobs:
33
31
  bundler-cache: true
34
32
  - name: Run tests
35
33
  run: bundle exec rake
36
- continue-on-error: ${{ matrix.ruby-version == 'ruby-head' }}
data/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [3.2.1] - 2025-03-19
8
+ ### Added
9
+ - Added testing of jruby-9.4 ([#172](https://github.com/ManageIQ/optimist/pull/172) - thanks @Fryguy)
10
+ - Added testing of Ruby 3.4 ([#173](https://github.com/ManageIQ/optimist/pull/173) - thanks @Fryguy)
11
+
12
+ ### Removed
13
+ - Drop testing of Ruby <2.7, jruby-9.3 ([#172](https://github.com/ManageIQ/optimist/pull/172) - thanks @Fryguy)
14
+
15
+ ### Fixed
16
+ - Fix issue where negative boolean flags were output incorrectly ([#179](https://github.com/ManageIQ/optimist/pull/179) - thanks @Fryguy)
17
+ - Fix issues with frozen strings which fail jruby-head (JRuby 10) ([#180](https://github.com/ManageIQ/optimist/pull/180) - thanks @Fryguy)
18
+
7
19
  ## [3.2.0] - 2024-11-11
8
20
  ### Added
9
21
  - Align the short and long forms into their own columns in the help output ([#145](https://github.com/ManageIQ/optimist/pull/145) - thanks @akhoury6)
@@ -222,7 +234,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
222
234
 
223
235
  - Initial release.
224
236
 
225
- [Unreleased]: https://github.com/ManageIQ/optimist/compare/v3.2.0...HEAD
237
+ [Unreleased]: https://github.com/ManageIQ/optimist/compare/v3.2.1...HEAD
238
+ [3.2.1]: https://github.com/ManageIQ/optimist/compare/v3.2.0...v3.2.1
226
239
  [3.2.0]: https://github.com/ManageIQ/optimist/compare/v3.1.0...v3.2.0
227
240
  [3.1.0]: https://github.com/ManageIQ/optimist/compare/v3.0.1...v3.1.0
228
241
  [3.0.1]: https://github.com/ManageIQ/optimist/compare/v3.0.0...v3.0.1
@@ -7,4 +7,3 @@ opts = Optimist::options do
7
7
  opt :num_limbs, "Number of limbs", :default => 4 # integer --num-limbs <i>, default to 4
8
8
  end
9
9
  p opts
10
-
@@ -6,7 +6,7 @@ opts = Optimist::options do
6
6
  # you can specify 'short:' as a string/symbol or an array of strings/symbols
7
7
  # 'alt:' adds additional long-opt choices (over the original name or the long: name)
8
8
  # you can specify 'alt:' as a string/symbol or an array of strings/symbols.
9
- #
9
+ #
10
10
  opt :concat, 'concatenate flag', short: ['-C', 'A'], alt: ['cat', '--append']
11
11
  opt :array_len, 'set Array length', long: 'size', alt: 'length', type: Integer
12
12
  end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/optimist'
3
+
4
+ opts = Optimist::options do
5
+ opt :default_false, "Boolean flag with false default", :default => false, :short => "f"
6
+ opt :default_true, "Boolean flag with true default", :default => true, :short => "t"
7
+ end
8
+
9
+ puts opts
@@ -27,7 +27,7 @@ class ZipCodeOption < Optimist::Option
27
27
  end
28
28
 
29
29
  opts = Optimist::options do
30
- opt :zipcode, "United states postal code", :type => :zipcode
30
+ opt :zipcode, "United states postal code", :type => :zipcode
31
31
  end
32
32
 
33
33
  p opts[:zipcode]
data/lib/optimist.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  require 'date'
9
9
 
10
10
  module Optimist
11
- VERSION = "3.2.0"
11
+ VERSION = "3.2.1"
12
12
 
13
13
  ## Thrown by Parser in the event of a commandline error. Not needed if
14
14
  ## you're using the Optimist::options entry.
@@ -208,7 +208,7 @@ class Parser
208
208
  o = Option.create(name, desc, opts)
209
209
 
210
210
  raise ArgumentError, "you already have an argument named '#{name}'" if @specs.member? o.name
211
-
211
+
212
212
  o.long.names.each do |lng|
213
213
  raise ArgumentError, "long option name #{lng.inspect} is already taken; please specify a (different) :long/:alt" if @long[lng]
214
214
  @long[lng] = o.name
@@ -754,7 +754,7 @@ class ShortNames
754
754
  end
755
755
 
756
756
  if sopt =~ INVALID_ARG_REGEX
757
- raise ArgumentError, "short option name '#{sopt}' can't be a number or a dash"
757
+ raise ArgumentError, "short option name '#{sopt}' can't be a number or a dash"
758
758
  end
759
759
  @chars << sopt
760
760
  end
@@ -820,7 +820,7 @@ class Option
820
820
  optionlist = []
821
821
  optionlist.concat(short.chars.map { |o| "-#{o}" })
822
822
  optionlist.concat(long.names.map { |o| "--#{o}" })
823
- optionlist.compact.join(', ') + type_format + (flag? && default ? ", --no-#{long}" : "")
823
+ optionlist.compact.join(', ') + type_format + (flag? && default ? ", --no-#{long.long}" : "")
824
824
  end
825
825
 
826
826
  ## Format the educate-line description including the default and permitted value(s)
@@ -880,7 +880,7 @@ class Option
880
880
  end
881
881
  true
882
882
  end
883
-
883
+
884
884
  # incoming values from the command-line should be strings, so we should
885
885
  # stringify any permitted types as the basis of comparison.
886
886
  def permitted_value?(val)
data/optimist.gemspec CHANGED
@@ -30,7 +30,7 @@ specify."
30
30
  spec.require_paths = ["lib"]
31
31
 
32
32
  spec.add_development_dependency "chronic"
33
- spec.add_development_dependency "manageiq-style"
34
- spec.add_development_dependency "minitest", "~> 5.4.3"
35
- spec.add_development_dependency "rake", ">= 10.0"
33
+ spec.add_development_dependency "manageiq-style", ">= 1.5.3"
34
+ spec.add_development_dependency "minitest", "~> 5.25"
35
+ spec.add_development_dependency "rake", ">= 10.0"
36
36
  end
data/renovate.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:recommended"
5
- ]
3
+ "inheritConfig": true,
4
+ "inheritConfigRepoName": "manageiq/renovate-config"
6
5
  }
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require_relative '../test_helper'
2
2
 
3
3
  module Optimist
4
4
 
@@ -12,7 +12,7 @@ module Optimist
12
12
  assert_raises(Optimist::HelpNeeded) do
13
13
  @p.parse(%w(--help))
14
14
  end
15
- sio = StringIO.new "w"
15
+ sio = StringIO.new
16
16
  @p.educate sio
17
17
  sio.string
18
18
  end
@@ -67,7 +67,7 @@ module Optimist
67
67
  opts = @p.parse(a)
68
68
  assert opts.goodarg0
69
69
  end
70
-
70
+
71
71
  [%w[--newone], %w[-n], %w[--one]].each do |a|
72
72
  opts = @p.parse(a)
73
73
  assert opts.goodarg1
@@ -91,7 +91,7 @@ module Optimist
91
91
  assert_raises_errmatch(ArgumentError, /invalid long option name/) { @p.opt "badarg", "desc", :alt => altitem }
92
92
  end
93
93
  end
94
-
94
+
95
95
  def test_altshort_help
96
96
  @p.opt :cat, 'cat', short: ['c','C','a','T']
97
97
  outstring = get_help_string
@@ -99,7 +99,7 @@ module Optimist
99
99
  assert_match(/-c, -C, -a, -T, --cat/, outstring)
100
100
  end
101
101
 
102
-
102
+
103
103
  def test_altlong_help
104
104
  @p.opt :cat, 'a cat', alt: :feline
105
105
  @p.opt :dog, 'a dog', alt: ['Pooch', :canine]
@@ -113,56 +113,56 @@ module Optimist
113
113
  # expect long-opt to shadow the actual name
114
114
  assert_match(/^\s*--fig, --peach, --pear, --apple/, outstring)
115
115
  assert_match(/^\s*-g, --gemuse, --groente/, outstring)
116
-
116
+
117
117
  end
118
118
 
119
119
  def test_alt_duplicates
120
120
  # alt duplicates named option
121
- err_regex = /long option name "cat" is already taken; please specify a \(different\) :long\/:alt/
121
+ err_regex = /long option name "cat" is already taken; please specify a \(different\) :long\/:alt/
122
122
  assert_raises_errmatch(ArgumentError, err_regex) {
123
123
  @p.opt :cat, 'desc', :alt => :cat
124
124
  }
125
- # alt duplicates :long
126
- err_regex = /long option name "feline" is already taken; please specify a \(different\) :long\/:alt/
125
+ # alt duplicates :long
126
+ err_regex = /long option name "feline" is already taken; please specify a \(different\) :long\/:alt/
127
127
  assert_raises_errmatch(ArgumentError, err_regex) {
128
128
  @p.opt :cat, 'desc', :long => :feline, :alt => [:feline]
129
129
  }
130
130
  # alt duplicates itself
131
- err_regex = /long option name "aaa" is already taken; please specify a \(different\) :long\/:alt/
131
+ err_regex = /long option name "aaa" is already taken; please specify a \(different\) :long\/:alt/
132
132
  assert_raises_errmatch(ArgumentError, err_regex) {
133
133
  @p.opt :abc, 'desc', :alt => [:aaa, :aaa]
134
134
  }
135
135
  end
136
-
136
+
137
137
  def test_altlong_collisions
138
138
  @p.opt :fat, 'desc'
139
139
  @p.opt :raton, 'desc', :long => :rat
140
140
  @p.opt :bat, 'desc', :alt => [:baton, :twirl]
141
141
 
142
142
  # :alt collision with named option
143
- err_regex = /long option name "fat" is already taken; please specify a \(different\) :long\/:alt/
143
+ err_regex = /long option name "fat" is already taken; please specify a \(different\) :long\/:alt/
144
144
  assert_raises_errmatch(ArgumentError, err_regex) {
145
145
  @p.opt :cat, 'desc', :alt => :fat
146
146
  }
147
147
 
148
148
  # :alt collision with :long option
149
- err_regex = /long option name "cat" is already taken; please specify a \(different\) :long\/:alt/
149
+ err_regex = /long option name "cat" is already taken; please specify a \(different\) :long\/:alt/
150
150
  assert_raises_errmatch(ArgumentError, err_regex) {
151
151
  @p.opt :cat, 'desc', :alt => :rat
152
152
  }
153
153
 
154
154
  # :named option collision with existing :alt option
155
- err_regex = /long option name "baton" is already taken; please specify a \(different\) :long\/:alt/
155
+ err_regex = /long option name "baton" is already taken; please specify a \(different\) :long\/:alt/
156
156
  assert_raises_errmatch(ArgumentError, err_regex) {
157
157
  @p.opt :baton, 'desc'
158
158
  }
159
159
 
160
160
  # :long option collision with existing :alt option
161
- err_regex = /long option name "twirl" is already taken; please specify a \(different\) :long\/:alt/
161
+ err_regex = /long option name "twirl" is already taken; please specify a \(different\) :long\/:alt/
162
162
  assert_raises_errmatch(ArgumentError, err_regex) {
163
163
  @p.opt :whirl, 'desc', :long => 'twirl'
164
164
  }
165
-
165
+
166
166
  end
167
167
  end
168
168
  end
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require_relative '../test_helper'
2
2
 
3
3
  module Optimist
4
4
  class CommandlineErrorTest < ::Minitest::Test
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require_relative '../test_helper'
2
2
 
3
3
  module Optimist
4
4
  class HelpNeededTest < ::Minitest::Test
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require_relative '../test_helper'
2
2
 
3
3
  module Optimist
4
4
 
@@ -138,4 +138,4 @@ class ParserConstraintTest < ::Minitest::Test
138
138
  assert_raises_errmatch(CommandlineError, err_regex) { @p.parse %w(--two) }
139
139
  end
140
140
  end
141
- end
141
+ end
@@ -1,5 +1,5 @@
1
1
  require 'stringio'
2
- require 'test_helper'
2
+ require_relative '../test_helper'
3
3
 
4
4
  module Optimist
5
5
  class ParserEduateTest < ::Minitest::Test
@@ -40,7 +40,7 @@ module Optimist
40
40
  # pulled out of optimist_test for now
41
41
  def test_help_has_default_banner
42
42
  @p = Parser.new
43
- sio = StringIO.new "w"
43
+ sio = StringIO.new
44
44
  @p.parse []
45
45
  @p.educate sio
46
46
  help = sio.string.split "\n"
@@ -49,7 +49,7 @@ module Optimist
49
49
 
50
50
  @p = Parser.new
51
51
  @p.version "my version"
52
- sio = StringIO.new "w"
52
+ sio = StringIO.new
53
53
  @p.parse []
54
54
  @p.educate sio
55
55
  help = sio.string.split "\n"
@@ -58,7 +58,7 @@ module Optimist
58
58
 
59
59
  @p = Parser.new
60
60
  @p.banner "my own banner"
61
- sio = StringIO.new "w"
61
+ sio = StringIO.new
62
62
  @p.parse []
63
63
  @p.educate sio
64
64
  help = sio.string.split "\n"
@@ -67,7 +67,7 @@ module Optimist
67
67
 
68
68
  @p = Parser.new
69
69
  @p.text "my own text banner"
70
- sio = StringIO.new "w"
70
+ sio = StringIO.new
71
71
  @p.parse []
72
72
  @p.educate sio
73
73
  help = sio.string.split "\n"
@@ -78,7 +78,7 @@ module Optimist
78
78
  def test_help_has_optional_usage
79
79
  @p = Parser.new
80
80
  @p.usage "OPTIONS FILES"
81
- sio = StringIO.new "w"
81
+ sio = StringIO.new
82
82
  @p.parse []
83
83
  @p.educate sio
84
84
  help = sio.string.split "\n"
@@ -89,7 +89,7 @@ module Optimist
89
89
  def test_help_has_optional_synopsis
90
90
  @p = Parser.new
91
91
  @p.synopsis "About this program"
92
- sio = StringIO.new "w"
92
+ sio = StringIO.new
93
93
  @p.parse []
94
94
  @p.educate sio
95
95
  help = sio.string.split "\n"
@@ -101,7 +101,7 @@ module Optimist
101
101
  @p = Parser.new
102
102
  @p.usage "OPTIONS FILES"
103
103
  @p.synopsis "About this program"
104
- sio = StringIO.new "w"
104
+ sio = StringIO.new
105
105
  @p.parse []
106
106
  @p.educate sio
107
107
  help = sio.string.split "\n"
@@ -113,7 +113,7 @@ module Optimist
113
113
  def test_help_preserves_positions
114
114
  parser.opt :zzz, "zzz"
115
115
  parser.opt :aaa, "aaa"
116
- sio = StringIO.new "w"
116
+ sio = StringIO.new
117
117
  parser.educate sio
118
118
 
119
119
  help = sio.string.split "\n"
@@ -132,7 +132,7 @@ module Optimist
132
132
  parser.opt :arg8, 'arg', :type => :ios
133
133
  parser.opt :arg9, 'arg', :type => :date
134
134
  parser.opt :arg10, 'arg', :type => :dates
135
- sio = StringIO.new "w"
135
+ sio = StringIO.new
136
136
  parser.educate sio
137
137
 
138
138
  help = sio.string.split "\n"
@@ -148,10 +148,22 @@ module Optimist
148
148
  assert help[10] =~ /<date\+>/
149
149
  end
150
150
 
151
+ def test_help_handles_boolean_flags
152
+ parser.opt :default_false, 'default-false', :default => false
153
+ parser.opt :default_true, 'default-true', :default => true
154
+ sio = StringIO.new
155
+ parser.educate sio
156
+
157
+ help = sio.string.split "\n"
158
+ assert help[1] =~ /--default-false/
159
+ assert help[2] =~ /--default-true, --no-default-true/
160
+ assert help[2] =~ /\(default: true\)/
161
+ end
162
+
151
163
  def test_help_has_grammatical_default_text
152
164
  parser.opt :arg1, 'description with period.', :default => 'hello'
153
165
  parser.opt :arg2, 'description without period', :default => 'world'
154
- sio = StringIO.new 'w'
166
+ sio = StringIO.new
155
167
  parser.educate sio
156
168
 
157
169
  help = sio.string.split "\n"
@@ -162,7 +174,7 @@ module Optimist
162
174
  def test_help_has_grammatical_permitted_text
163
175
  parser.opt :arg1, 'description with period.', :type => :strings, :permitted => %w(foo bar)
164
176
  parser.opt :arg2, 'description without period', :type => :strings, :permitted => %w(foo bar)
165
- sio = StringIO.new 'w'
177
+ sio = StringIO.new
166
178
  parser.educate sio
167
179
 
168
180
  help = sio.string.split "\n"
@@ -173,7 +185,7 @@ module Optimist
173
185
  def test_help_with_permitted_range
174
186
  parser.opt :rating, 'rating', permitted: 1..5
175
187
  parser.opt :hex, 'hexadecimal', permitted: /^[0-9a-f]/i
176
- sio = StringIO.new 'w'
188
+ sio = StringIO.new
177
189
  parser.educate sio
178
190
  help = sio.string.split "\n"
179
191
  assert_match %r{rating \(permitted: 1\.\.5\)}, help[1]
@@ -1,5 +1,5 @@
1
1
  require 'stringio'
2
- require 'test_helper'
2
+ require_relative '../test_helper'
3
3
 
4
4
  module Optimist
5
5
 
@@ -1,5 +1,5 @@
1
1
  require 'stringio'
2
- require 'test_helper'
2
+ require_relative '../test_helper'
3
3
 
4
4
  module Optimist
5
5
  class ParserParseTest < ::Minitest::Test
@@ -1,5 +1,5 @@
1
1
  require 'stringio'
2
- require 'test_helper'
2
+ require_relative '../test_helper'
3
3
 
4
4
  module Optimist
5
5
 
@@ -38,8 +38,8 @@ class ParserPermittedTest < ::Minitest::Test
38
38
  end
39
39
  def test_permitted_with_symbol_array
40
40
  @p.opt 'fiz', 'desc', :type => 'string', :permitted => %i[dog cat]
41
- @p.parse(%w(--fiz dog))
42
- @p.parse(%w(--fiz cat))
41
+ @p.parse(%w(--fiz dog))
42
+ @p.parse(%w(--fiz cat))
43
43
  assert_raises_errmatch(CommandlineError, /option '--fiz' only accepts one of: dog, cat/) {
44
44
  @p.parse(%w(--fiz rat))
45
45
  }
@@ -47,8 +47,8 @@ class ParserPermittedTest < ::Minitest::Test
47
47
 
48
48
  def test_permitted_with_numeric_array
49
49
  @p.opt 'mynum', 'desc', :type => Integer, :permitted => [1,2,4]
50
- @p.parse(%w(--mynum 1))
51
- @p.parse(%w(--mynum 4))
50
+ @p.parse(%w(--mynum 1))
51
+ @p.parse(%w(--mynum 4))
52
52
  assert_raises_errmatch(CommandlineError, /option '--mynum' only accepts one of: 1, 2, 4/) {
53
53
  @p.parse(%w(--mynum 3))
54
54
  }
@@ -1,5 +1,5 @@
1
1
  require 'stringio'
2
- require 'test_helper'
2
+ require_relative '../test_helper'
3
3
 
4
4
  module Optimist
5
5
 
@@ -142,7 +142,7 @@ class ParserTest < ::Minitest::Test
142
142
  ## flags that require args of a specific type refuse args of other
143
143
  ## types
144
144
  def test_typed_args_refuse_args_of_other_types
145
- @p.opt "goodarg", "desc", :type => :int
145
+ @p.opt "goodarg", "desc", :type => :int
146
146
  err_regex = %r/Unsupported argument type 'asdf', registry lookup 'asdf'/
147
147
  assert_raises_errmatch(ArgumentError, err_regex) { @p.opt "badarg", "desc", :type => :asdf }
148
148
 
@@ -368,7 +368,7 @@ class ParserTest < ::Minitest::Test
368
368
  @p.opt "arg", "desc", :short => :none
369
369
  @p.parse []
370
370
 
371
- sio = StringIO.new "w"
371
+ sio = StringIO.new
372
372
  @p.educate sio
373
373
  assert sio.string =~ /--arg\s+desc/
374
374
 
@@ -991,10 +991,10 @@ Options:
991
991
 
992
992
  opts = @p.parse %w(--arg3 stdin)
993
993
  assert_equal $stdin, opts[:arg3]
994
-
994
+
995
995
  err_regex = %r/file or url for option 'arg' cannot be opened: No such file or directory/
996
996
  assert_raises_errmatch(CommandlineError, err_regex) {
997
- opts = @p.parse %w(--arg /fdasfasef/fessafef/asdfasdfa/fesasf)
997
+ opts = @p.parse %w(--arg /fdasfasef/fessafef/asdfasdfa/fesasf)
998
998
  }
999
999
  end
1000
1000
 
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require_relative '../test_helper'
2
2
 
3
3
  module Optimist
4
4
  class VersionNeededTest < ::Minitest::Test
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require_relative 'test_helper'
2
2
 
3
3
  class OptimistTest < Minitest::Test
4
4
  def setup
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Minitest::Assertions
2
4
  def assert_parses_correctly(parser, commandline, expected_opts,
3
5
  expected_leftovers)
@@ -9,7 +11,7 @@ module Minitest::Assertions
9
11
  def assert_stderr(str = nil, msg = nil)
10
12
  msg = "#{msg}.\n" if msg
11
13
 
12
- old_stderr, $stderr = $stderr, StringIO.new('')
14
+ old_stderr, $stderr = $stderr, StringIO.new
13
15
  yield
14
16
  assert_match str, $stderr.string, msg if str
15
17
  ensure
@@ -19,7 +21,7 @@ module Minitest::Assertions
19
21
  def assert_stdout(str = nil, msg = nil)
20
22
  msg = "#{msg}.\n" if msg
21
23
 
22
- old_stdout, $stdout = $stdout, StringIO.new('')
24
+ old_stdout, $stdout = $stdout, StringIO.new
23
25
  yield
24
26
  assert_match str, $stdout.string, msg if str
25
27
  ensure
@@ -49,4 +51,3 @@ module Minitest::Assertions
49
51
  assert_match(err_regexp, err.message)
50
52
  end
51
53
  end
52
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimist
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Morgan
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-11-11 00:00:00.000000000 Z
13
+ date: 2025-03-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chronic
@@ -32,28 +32,28 @@ dependencies:
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: '0'
35
+ version: 1.5.3
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: '0'
42
+ version: 1.5.3
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: minitest
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: 5.4.3
49
+ version: '5.25'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: 5.4.3
56
+ version: '5.25'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rake
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -97,6 +97,7 @@ files:
97
97
  - examples/banners1.rb
98
98
  - examples/banners2.rb
99
99
  - examples/banners3.rb
100
+ - examples/boolean.rb
100
101
  - examples/constraints.rb
101
102
  - examples/didyoumean.rb
102
103
  - examples/medium_example.rb
@@ -141,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
142
  - !ruby/object:Gem::Version
142
143
  version: '0'
143
144
  requirements: []
144
- rubygems_version: 3.3.27
145
+ rubygems_version: 3.5.22
145
146
  signing_key:
146
147
  specification_version: 4
147
148
  summary: Optimist is a commandline option parser for Ruby that just gets out of your