optimist 3.0.1 → 3.2.0

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.
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Optimist
4
- class VersionNeededTest < ::MiniTest::Test
4
+ class VersionNeededTest < ::Minitest::Test
5
5
  def test_class
6
6
  assert_kind_of Exception, vn("message")
7
7
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class OptimistTest < MiniTest::Test
3
+ class OptimistTest < Minitest::Test
4
4
  def setup
5
5
  Optimist.send(:instance_variable_set, "@last_parser", nil)
6
6
  end
@@ -39,7 +39,8 @@ class OptimistTest < MiniTest::Test
39
39
  end
40
40
 
41
41
  def test_die_without_options_ever_run
42
- assert_raises(ArgumentError) { Optimist.die 'hello' }
42
+ err_regex = /Optimist::die can only be called after Optimist::options/
43
+ assert_raises_errmatch(ArgumentError, err_regex) { Optimist.die 'hello' }
43
44
  end
44
45
 
45
46
  def test_die
@@ -70,7 +71,8 @@ class OptimistTest < MiniTest::Test
70
71
  end
71
72
 
72
73
  def test_educate_without_options_ever_run
73
- assert_raises(ArgumentError) { Optimist.educate }
74
+ err_regex = /Optimist::educate can only be called after Optimist::options/
75
+ assert_raises_errmatch(ArgumentError, err_regex) { Optimist.educate }
74
76
  end
75
77
 
76
78
  def test_educate
@@ -42,5 +42,11 @@ module Minitest::Assertions
42
42
  end
43
43
  flunk "#{msg}#{mu_pp(exp)} SystemExit expected but nothing was raised."
44
44
  end
45
+
46
+ # wrapper around common assertion checking pattern
47
+ def assert_raises_errmatch(err_klass, err_regexp, &b)
48
+ err = assert_raises(err_klass, &b)
49
+ assert_match(err_regexp, err.message)
50
+ end
45
51
  end
46
52
 
metadata CHANGED
@@ -1,59 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimist
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Morgan
8
8
  - Keenan Brock
9
9
  - Jason Frey
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-04-20 00:00:00.000000000 Z
13
+ date: 2024-11-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: minitest
16
+ name: chronic
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: 5.4.3
21
+ version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - "~>"
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: 5.4.3
28
+ version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
- name: rake
30
+ name: manageiq-style
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: minitest
31
45
  requirement: !ruby/object:Gem::Requirement
32
46
  requirements:
33
47
  - - "~>"
34
48
  - !ruby/object:Gem::Version
35
- version: '10.0'
49
+ version: 5.4.3
36
50
  type: :development
37
51
  prerelease: false
38
52
  version_requirements: !ruby/object:Gem::Requirement
39
53
  requirements:
40
54
  - - "~>"
41
55
  - !ruby/object:Gem::Version
42
- version: '10.0'
56
+ version: 5.4.3
43
57
  - !ruby/object:Gem::Dependency
44
- name: chronic
58
+ name: rake
45
59
  requirement: !ruby/object:Gem::Requirement
46
60
  requirements:
47
61
  - - ">="
48
62
  - !ruby/object:Gem::Version
49
- version: '0'
63
+ version: '10.0'
50
64
  type: :development
51
65
  prerelease: false
52
66
  version_requirements: !ruby/object:Gem::Requirement
53
67
  requirements:
54
68
  - - ">="
55
69
  - !ruby/object:Gem::Version
56
- version: '0'
70
+ version: '10.0'
57
71
  description: |-
58
72
  Optimist is a commandline option parser for Ruby that just
59
73
  gets out of your way. One line of code per option is all you need to write.
@@ -65,21 +79,41 @@ executables: []
65
79
  extensions: []
66
80
  extra_rdoc_files: []
67
81
  files:
82
+ - ".codeclimate.yml"
83
+ - ".github/workflows/ci.yaml"
68
84
  - ".gitignore"
69
- - ".travis.yml"
85
+ - ".rubocop.yml"
86
+ - ".rubocop_cc.yml"
87
+ - ".rubocop_local.yml"
88
+ - ".whitesource"
89
+ - CHANGELOG.md
70
90
  - FAQ.txt
71
91
  - Gemfile
72
- - History.txt
73
92
  - LICENSE.txt
74
93
  - README.md
75
94
  - Rakefile
95
+ - examples/a_basic_example.rb
96
+ - examples/alt_names.rb
97
+ - examples/banners1.rb
98
+ - examples/banners2.rb
99
+ - examples/banners3.rb
100
+ - examples/constraints.rb
101
+ - examples/didyoumean.rb
102
+ - examples/medium_example.rb
103
+ - examples/partialmatch.rb
104
+ - examples/permitted.rb
105
+ - examples/types_custom.rb
76
106
  - lib/optimist.rb
77
107
  - optimist.gemspec
108
+ - renovate.json
109
+ - test/optimist/alt_names_test.rb
78
110
  - test/optimist/command_line_error_test.rb
79
111
  - test/optimist/help_needed_test.rb
112
+ - test/optimist/parser_constraint_test.rb
80
113
  - test/optimist/parser_educate_test.rb
81
114
  - test/optimist/parser_opt_test.rb
82
115
  - test/optimist/parser_parse_test.rb
116
+ - test/optimist/parser_permitted_test.rb
83
117
  - test/optimist/parser_test.rb
84
118
  - test/optimist/version_needed_test.rb
85
119
  - test/optimist_test.rb
@@ -89,10 +123,10 @@ homepage: http://manageiq.github.io/optimist/
89
123
  licenses:
90
124
  - MIT
91
125
  metadata:
92
- changelog_uri: https://github.com/ManageIQ/optimist/blob/master/History.txt
126
+ changelog_uri: https://github.com/ManageIQ/optimist/blob/master/CHANGELOG.md
93
127
  source_code_uri: https://github.com/ManageIQ/optimist/
94
128
  bug_tracker_uri: https://github.com/ManageIQ/optimist/issues
95
- post_install_message:
129
+ post_install_message:
96
130
  rdoc_options: []
97
131
  require_paths:
98
132
  - lib
@@ -107,17 +141,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
141
  - !ruby/object:Gem::Version
108
142
  version: '0'
109
143
  requirements: []
110
- rubygems_version: 3.1.2
111
- signing_key:
144
+ rubygems_version: 3.3.27
145
+ signing_key:
112
146
  specification_version: 4
113
147
  summary: Optimist is a commandline option parser for Ruby that just gets out of your
114
148
  way.
115
149
  test_files:
150
+ - test/optimist/alt_names_test.rb
116
151
  - test/optimist/command_line_error_test.rb
117
152
  - test/optimist/help_needed_test.rb
153
+ - test/optimist/parser_constraint_test.rb
118
154
  - test/optimist/parser_educate_test.rb
119
155
  - test/optimist/parser_opt_test.rb
120
156
  - test/optimist/parser_parse_test.rb
157
+ - test/optimist/parser_permitted_test.rb
121
158
  - test/optimist/parser_test.rb
122
159
  - test/optimist/version_needed_test.rb
123
160
  - test/optimist_test.rb
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.2
5
- - 2.3
6
- - 2.4
7
- - 2.5
8
- - 2.6
9
- - 2.7
10
- - jruby-head
11
- matrix:
12
- allow_failures:
13
- - rvm: jruby-head
14
- fast_finish: true
data/History.txt DELETED
@@ -1,175 +0,0 @@
1
- == [3.0.1] / 2020-04-20
2
-
3
- * Add a LICENSE.txt file to the released package
4
- * Test fixes (thanks @aried3r, @neontapir, @npras)
5
-
6
- == [3.0.0] / 2018-08-24
7
-
8
- * The gem has been officially renamed to optimist
9
-
10
- == [2.1.3] / 2018-07-05
11
-
12
- * Refactor each option type into subclasses of Option. Define a registry for the registration of each option. This makes the code more modular and facilitates extension by allowing additional Option subclasses. (thanks @clxy)
13
- * Fixed implementation of ignore_invalid_options. (thanks @metcalf)
14
- * Various warning cleanup for ruby 2.1, 2.3, etc. (thanks @nanobowers)
15
- * Optimist.die can now accept an error code.
16
- * fixed default (thanks @nanobowers)
17
- * Change from ruby license to MIT license in the code.
18
-
19
- == [2.1.2] / 2015-03-10
20
- * loosen mime-types requirements (for better ruby 1.8.7 support)
21
- * use io/console gem instead of curses (for better jruby support)
22
- * fix parsing bug when chronic gem is not available
23
- * allow default array to be empty if a type is specified
24
- * better specified license and better spec coverage
25
-
26
- == [2.1.1] / 2015-01-03
27
- * Remove curses as a hard dependency. It is optional. This can leverage the gem if it is present.
28
- * Fix ruby -w warnings
29
-
30
- == 2.1.0 / 2015-01-02
31
- * Integer parser now supports underscore separator.
32
- * Add Parser#usage and Parser#synopsis commands for creating a standard banner
33
- message. Using Parser#banner directly will override both of those.
34
- * Add Parser#ignore_invalid_options to prevent erroring on unknown options.
35
- * Allow flags to act as switches if they have defaults set and no value is
36
- passed on the commandline
37
- * Parser#opt learned to accept a block or a :callback option which it will call
38
- after parsing the option.
39
- * Add Optimist::educate which displays the help message and dies.
40
- * Reformat help message to be more GNUish.
41
- * Fix command name in help message when script has no extension.
42
- * Fix handling of newlines inside descriptions
43
- * Documentation and other fixes.
44
-
45
- == 2.0 / 2012-08-11
46
- * Change flag logic: --no-X will always be false, and --X will always be true,
47
- regardless of default.
48
- * For flags that default to true, display --no-X instead of --X in the help
49
- menu. Accept both versions on the commandline.
50
- * Fix a spurious warning
51
- * Update Rakefile to 1.9
52
- * Minor documentation fixes
53
-
54
- == 1.16.2 / 2010-04-06
55
- * Bugfix in Optimist::options. Thanks to Brian C. Thomas for pointing it out.
56
-
57
- == 1.16.1 / 2010-04-05
58
- * Bugfix in Optimist::die method introduced in last release.
59
-
60
- == 1.16 / 2010-04-01
61
- * Add Optimist::with_standard_exception_handling method for easing the use of Parser directly.
62
- * Handle scientific notation in float arguments, thanks to Will Fitzgerald.
63
- * Drop hoe dependency.
64
-
65
- == 1.15 / 2009-09-30
66
- * Don't raise an exception when out of short arguments (thanks to Rafael
67
- Sevilla for pointing out how dumb this behavior was).
68
-
69
- == 1.14 / 2009-06-19
70
- * Make :multi arguments default to [], not nil, when not set on the commandline.
71
- * Minor commenting and error message improvements
72
-
73
- == 1.13 / 2009-03-16
74
- * Fix parsing of "--longarg=<value with spaces>".
75
-
76
- == 1.12 / 2009-01-30
77
- * Fix some unit test failures in the last release. Should be more careful.
78
- * Make default short options only be assigned *after* all user-specified
79
- short options. Now there's a little less juggling to do when you just
80
- want to specify a few short options.
81
-
82
- == 1.11 / 2009-01-29
83
- * Set <opt>_given keys in the results hash for options that were specified
84
- on the commandline.
85
-
86
- == 1.10.2 / 2008-10-23
87
- * No longer try `stty size` for screen size detection. Just use curses, and
88
- screen users will have to deal with the screen clearing.
89
-
90
- == 1.10.1 / 2008-10-22
91
- * Options hash now responds to method calls as well as standard hash lookup.
92
- * Default values for multi-occurrence parameters now autoboxed.
93
- * The relationship between multi-value, multi-occurrence, and default values
94
- improved and explained.
95
- * Documentation improvements.
96
-
97
- == 1.10 / 2008-10-21
98
- * Added :io type for parameters that point to IO streams (filenames, URIs, etc).
99
- * For screen size detection, first try `stty size` before loading Curses.
100
- * Improved documentation.
101
-
102
- == 1.9 / 2008-08-20
103
- * Added 'stop_on_unknown' command to stop parsing on any unknown argument.
104
- This is useful for handling sub-commands when you don't know the entire
105
- set of commands up front. (E.g. if the initial arguments can change it.)
106
- * Added a :multi option for parameters, signifying that they can be specified
107
- multiple times.
108
- * Added :ints, :strings, :doubles, and :floats option types, which can take
109
- multiple arguments.
110
-
111
- == 1.8.2 / 2008-06-25
112
- * Bugfix for #conflicts and #depends error messages
113
-
114
- == 1.8.1 / 2008-06-24
115
- * Bugfix for short option autocreation
116
- * More aggressive documentation
117
-
118
- == 1.8 / 2008-06-16
119
- * Sub-command support via Parser#stop_on
120
-
121
- == 1.7.2 / 2008-01-16
122
- * Ruby 1.9-ify. Apparently this means replacing :'s with ;'s.
123
-
124
- == 1.7.1 / 2008-01-07
125
- * Documentation improvements
126
-
127
- == 1.7 / 2007-06-17
128
- * Fix incorrect error message for multiple missing required arguments
129
- (thanks to Neill Zero)
130
-
131
- == 1.6 / 2007-04-01
132
- * Don't attempt curses screen-width magic unless running on a terminal.
133
-
134
- == 1.5 / 2007-03-31
135
- * --help and --version do the right thing even if the rest of the
136
- command line is incorrect.
137
- * Added #conflicts and #depends to model dependencies and exclusivity
138
- between arguments.
139
- * Minor bugfixes.
140
-
141
- == 1.4 / 2007-03-26
142
- * Disable short options with :short => :none.
143
- * Minor bugfixes and error message improvements.
144
-
145
- == 1.3 / 2007-01-31
146
- * Wrap at (screen width - 1) instead of screen width.
147
- * User can override --help and --version.
148
- * Bugfix in handling of -v and -h.
149
- * More tests to confirm the above.
150
-
151
- == 1.2 / 2007-01-31
152
- * Minor documentation tweaks.
153
- * Removed hoe dependency.
154
-
155
- == 1.1 / 2007-01-30
156
- * Optimist::options now passes any arguments as block arguments. Since
157
- instance variables are not properly captured by the block, this
158
- makes it slightly less noisy to pass them in as local variables.
159
- (A real-life use for _why's cloaker!)
160
- * Help display now preserves original argument order.
161
- * Optimist::die now also has a single string form in case death is not
162
- due to a single argument.
163
- * Parser#text now an alias for Parser#banner, and can be called
164
- multiple times, with the output being placed in the right position
165
- in the help text.
166
- * Slightly more indicative formatting for parameterized arguments.
167
-
168
- == 1.0 / 2007-01-29
169
- * Initial release.
170
-
171
- [3.0.1]: https://github.com/ManageIQ/optimist/compare/v3.0.0...v3.0.1
172
- [3.0.0]: https://github.com/ManageIQ/optimist/compare/v2.1.3...v3.0.0
173
- [2.1.3]: https://github.com/ManageIQ/optimist/compare/v2.1.2...v2.1.3
174
- [2.1.2]: https://github.com/ManageIQ/optimist/compare/v2.1.1...v2.1.2
175
- [2.1.1]: https://github.com/ManageIQ/optimist/compare/v2.1.0...v2.1.1