optimist_xl 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,52 @@
1
+ module Minitest::Assertions
2
+ def assert_parses_correctly(parser, commandline, expected_opts,
3
+ expected_leftovers)
4
+ opts = parser.parse commandline
5
+ assert_equal expected_opts, opts
6
+ assert_equal expected_leftovers, parser.leftovers
7
+ end
8
+
9
+ def assert_stderr(str = nil, msg = nil)
10
+ msg = "#{msg}.\n" if msg
11
+
12
+ old_stderr, $stderr = $stderr, StringIO.new('')
13
+ yield
14
+ assert_match str, $stderr.string, msg if str
15
+ ensure
16
+ $stderr = old_stderr
17
+ end
18
+
19
+ def assert_stdout(str = nil, msg = nil)
20
+ msg = "#{msg}.\n" if msg
21
+
22
+ old_stdout, $stdout = $stdout, StringIO.new('')
23
+ yield
24
+ assert_match str, $stdout.string, msg if str
25
+ ensure
26
+ $stdout = old_stdout
27
+ end
28
+
29
+ # like assert raises, but if it does raise, it checks status
30
+ # NOTE: this does not ensure the exception is raised
31
+ def assert_system_exit *exp
32
+ msg = "#{exp.pop}.\n" if String === exp.last
33
+ status = exp.first
34
+
35
+ begin
36
+ yield
37
+ rescue SystemExit => e
38
+ assert_equal status, e.status {
39
+ exception_details(e, "#{msg}#{mu_pp(exp)} exception expected, not")
40
+ } if status
41
+ return true
42
+ end
43
+ flunk "#{msg}#{mu_pp(exp)} SystemExit expected but nothing was raised."
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
51
+ end
52
+
@@ -0,0 +1,22 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ unless ENV['MUTANT']
4
+ begin
5
+ require "coveralls"
6
+ Coveralls.wear! do
7
+ add_filter '/test/'
8
+ end
9
+ rescue LoadError
10
+ end
11
+ end
12
+
13
+ begin
14
+ require "pry"
15
+ rescue LoadError
16
+ end
17
+
18
+ require 'minitest/autorun'
19
+
20
+ Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f }
21
+
22
+ require 'optimist_xl'
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: optimist_xl
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.1.1
5
+ platform: ruby
6
+ authors:
7
+ - William Morgan
8
+ - Keenan Brock
9
+ - Jason Frey
10
+ - Ben Bowers
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2020-01-20 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: minitest
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: 5.4.3
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 5.4.3
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: '10.0'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '10.0'
44
+ - !ruby/object:Gem::Dependency
45
+ name: chronic
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ description: |-
59
+ OptimistXL is a commandline option parser for Ruby that just
60
+ gets out of your way. One line of code per option is all you need to write.
61
+ For that, you get a nice automatically-generated help page, robust option
62
+ parsing, command subcompletion, and sensible defaults for everything you don't
63
+ specify. This gem is an enhanced-feature fork of the Optimist gem.
64
+ email: nanobowers@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - ".gitignore"
70
+ - ".travis.yml"
71
+ - FAQ.txt
72
+ - Gemfile
73
+ - History.txt
74
+ - README.md
75
+ - Rakefile
76
+ - examples/a_basic_example.rb
77
+ - examples/banners1.rb
78
+ - examples/banners2.rb
79
+ - examples/banners3.rb
80
+ - examples/medium_example.rb
81
+ - examples/permitted.rb
82
+ - examples/subcommands.rb
83
+ - examples/types.rb
84
+ - examples/types_custom.rb
85
+ - lib/optimist_xl.rb
86
+ - lib/optimist_xl/chronic.rb
87
+ - optimist_xl.gemspec
88
+ - test/optimist_xl/command_line_error_test.rb
89
+ - test/optimist_xl/help_needed_test.rb
90
+ - test/optimist_xl/parser_educate_test.rb
91
+ - test/optimist_xl/parser_opt_test.rb
92
+ - test/optimist_xl/parser_parse_test.rb
93
+ - test/optimist_xl/parser_test.rb
94
+ - test/optimist_xl/permitted_test.rb
95
+ - test/optimist_xl/subcommands_test.rb
96
+ - test/optimist_xl/version_needed_test.rb
97
+ - test/optimist_xl_test.rb
98
+ - test/support/assert_helpers.rb
99
+ - test/test_helper.rb
100
+ homepage: https://github.com/nanobowers/optimist_xl/
101
+ licenses:
102
+ - MIT
103
+ metadata:
104
+ changelog_uri: https://github.com/nanobowers/optimist_xl/blob/master/History.txt
105
+ source_code_uri: https://github.com/nanobowers/optimist_xl/
106
+ bug_tracker_uri: https://github.com/nanobowers/optimist_xl/issues
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.7.4
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: OptimistXL is a commandline option parser for Ruby that just gets out of
127
+ your way.
128
+ test_files:
129
+ - test/optimist_xl/command_line_error_test.rb
130
+ - test/optimist_xl/help_needed_test.rb
131
+ - test/optimist_xl/parser_educate_test.rb
132
+ - test/optimist_xl/parser_opt_test.rb
133
+ - test/optimist_xl/parser_parse_test.rb
134
+ - test/optimist_xl/parser_test.rb
135
+ - test/optimist_xl/permitted_test.rb
136
+ - test/optimist_xl/subcommands_test.rb
137
+ - test/optimist_xl/version_needed_test.rb
138
+ - test/optimist_xl_test.rb
139
+ - test/support/assert_helpers.rb
140
+ - test/test_helper.rb