getopt 1.5.1 → 1.7.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/{CHANGES.rdoc → CHANGES.md} +28 -20
- data/Gemfile +2 -0
- data/{MANIFEST.rdoc → MANIFEST.md} +6 -5
- data/{README.rdoc → README.md} +96 -95
- data/Rakefile +23 -18
- data/getopt.gemspec +15 -12
- data/lib/getopt/long.rb +246 -224
- data/lib/getopt/std.rb +91 -91
- data/lib/getopt/version.rb +3 -1
- data/spec/getopt_long_spec.rb +358 -0
- data/spec/getopt_std_spec.rb +125 -0
- data.tar.gz.sig +0 -0
- metadata +66 -31
- metadata.gz.sig +0 -0
- data/test/test_getopt_long.rb +0 -265
- data/test/test_getopt_std.rb +0 -125
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e45a7211aea22472efcebd09ba6aa5b344eac0441213144d6c8c408d0adfabf5
|
|
4
|
+
data.tar.gz: 2a95d618c4ededa6de05a091429c85dc38cdd5f43d75618587e5a74d589bcd50
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ecda8ad35cfaac66dd59c0432796a7901f22f351ee2fd347aff8e4f0a730a5ca963fe428608de5988a7f00bd367c1d3e6b4f3865bc44cb4762a06962b831ca3c
|
|
7
|
+
data.tar.gz: 9b5308a4a046cb6df55353114bd396749c75443d75e4c8c1f2c886702420e16a2bb57cec3fc253ee17f2cea9d9dfbad9a2d5e84e60cb984aae09cfa389380962
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/{CHANGES.rdoc → CHANGES.md}
RENAMED
|
@@ -1,40 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
# 1.7.0 - 13-Feb-2026
|
|
2
|
+
* Added the NEGATABLE option so you can do --no-whatever.
|
|
3
|
+
* A few warnings were cleaned up, along with rubocop updates.
|
|
4
|
+
* Some administrative stuff, updated Rakefile, Gemfile, etc.
|
|
5
|
+
|
|
6
|
+
## 1.6.0 - 2-Mar-2021
|
|
7
|
+
* Switched tests to use rspec.
|
|
8
|
+
|
|
9
|
+
## 1.5.1 - 23-Mar-2020
|
|
2
10
|
* Properly add a LICENSE file since the Apache-2.0 license requires it.
|
|
3
11
|
* Added explicit .rdoc extensions to the README, CHANGES and MANIFEST files,
|
|
4
12
|
mostly so they look nicer on github.
|
|
5
13
|
|
|
6
|
-
|
|
14
|
+
## 1.5.0 - 25-Jan-2019
|
|
7
15
|
* Changed license to Apache-2.0.
|
|
8
16
|
|
|
9
|
-
|
|
17
|
+
## 1.4.4 - 24-Mar-2018
|
|
10
18
|
* Fixed a deprecation warning.
|
|
11
19
|
* Now requires Ruby 2.2 or later.
|
|
12
20
|
* Added metadata to the gemspec.
|
|
13
21
|
* Updated the cert.
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
## 1.4.3 - 7-Jan-2016
|
|
16
24
|
* This gem is now signed.
|
|
17
25
|
* The gem related tasks in the Rakefile now assume Rubygems 2.x.
|
|
18
26
|
* Added getopt.rb, getopt-std.rb and getopt-long.rb files for convenience.
|
|
19
27
|
|
|
20
|
-
|
|
28
|
+
## 1.4.2 - 12-Oct-2014
|
|
21
29
|
* Updated Rakefile, README and gemspec.
|
|
22
30
|
* Minor updates to the test file and examples.
|
|
23
31
|
|
|
24
|
-
|
|
32
|
+
## 1.4.1 - 17-Jul-2011
|
|
25
33
|
* Now works with Ruby 1.9.x. Thanks go to Shura for the patch.
|
|
26
34
|
* Refactored the gemspec. Gem building code is now handled by Rake tasks.
|
|
27
35
|
* Refactored the Rakefile. Added a default task, removed the old install
|
|
28
36
|
task, and namespaced the gem related tasks.
|
|
29
37
|
|
|
30
|
-
|
|
38
|
+
## 1.4.0 - 5-Sep-2009
|
|
31
39
|
* Fixed a packaging bug where the libs weren't actually being included! Gah!
|
|
32
40
|
Thanks go to Steven Hilton for the spot.
|
|
33
41
|
* Other minor refactorings to the gemspec.
|
|
34
42
|
* The release number does not reflect any code changes. I simply ran out
|
|
35
43
|
of numbers. :)
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
## 1.3.9 - 29-Jul-2009
|
|
38
46
|
* Now compatible with Ruby 1.9.x.
|
|
39
47
|
* Gemspec updates, including a license change to Artistic 2.0.
|
|
40
48
|
* Added individual rake tasks for testing Getopt::Long and Getopt::Std.
|
|
@@ -42,7 +50,7 @@
|
|
|
42
50
|
* The test-unit library was switched from a standard dependency to a
|
|
43
51
|
development dependency.
|
|
44
52
|
|
|
45
|
-
|
|
53
|
+
## 1.3.8 - 6-Jan-2008
|
|
46
54
|
* Fixed RF bug #23477 - Getopt::Std inadvertently raises an error if you
|
|
47
55
|
pass a letter (without a hyphen) as an argument to a switch that matches
|
|
48
56
|
that letter, e.g. "-a a" should be legal. Thanks go to an anonymous user
|
|
@@ -50,7 +58,7 @@
|
|
|
50
58
|
* Added tests for RF bug #23477.
|
|
51
59
|
* Added Test::Unit 2.x as a prerequisite.
|
|
52
60
|
|
|
53
|
-
|
|
61
|
+
## 1.3.7 - 27-Jul-2008
|
|
54
62
|
* Fixed a potential infinite hash recursion bug in ARGV processing. This
|
|
55
63
|
was smoked out as the result of the alternate hash implementations in
|
|
56
64
|
JRuby and Ruby 1.9.
|
|
@@ -58,41 +66,41 @@
|
|
|
58
66
|
* Removed the ts_all.rb file, and renamed the other test files. The Rakefile
|
|
59
67
|
test task was updated accordingly.
|
|
60
68
|
|
|
61
|
-
|
|
69
|
+
## 1.3.6 - 8-Aug-2007
|
|
62
70
|
* The Getopt::StdError class is now Getopt::Std::Error.
|
|
63
71
|
* The Getopt::LongError class is now Getopt::Long::Error.
|
|
64
72
|
* Added some inline rdoc documentation to the source code.
|
|
65
73
|
* Added a Rakefile with tasks for installation and testing.
|
|
66
74
|
* Removed the install.rb file - use the 'rake install' task instead.
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
## 1.3.5 - 5-Jul-2006
|
|
69
77
|
* Fixed a bug where multiple long switches with the same first character
|
|
70
78
|
could cause invalid results. Thanks go to Michael Campbell for the spot.
|
|
71
79
|
* Added documentation to the README file that explains what happens if you
|
|
72
80
|
specify multiple long switches with the same first character and no short
|
|
73
81
|
switch alias.
|
|
74
82
|
|
|
75
|
-
|
|
83
|
+
## 1.3.4 - 7-Mar-2006
|
|
76
84
|
* Fixed Getopt::Long so that it can handle embedded hyphens in the long
|
|
77
85
|
form, e.g. --foo-bar. Thanks go to Mark Meves for the spot.
|
|
78
86
|
* Corresponding test suite additions.
|
|
79
87
|
* Added example to the 'example_long.rb' file that uses long form with
|
|
80
88
|
embedded hyphens.
|
|
81
89
|
|
|
82
|
-
|
|
90
|
+
## 1.3.3 - 22-Feb-2006
|
|
83
91
|
* Bug fix for the two argument form of Getopt::Long.getopts.
|
|
84
92
|
* Corresponding test suite additions.
|
|
85
93
|
|
|
86
|
-
|
|
94
|
+
## 1.3.2 - 13-Feb-2006
|
|
87
95
|
* Improved error message if an option is passed without a preceding switch.
|
|
88
96
|
* Minor documentation fixes and clarifications.
|
|
89
97
|
|
|
90
|
-
|
|
98
|
+
## 1.3.1 - 18-Nov-2005
|
|
91
99
|
* Added support for compressed switches with getopt/long.
|
|
92
100
|
* More tests.
|
|
93
101
|
* Fixed a bug in the gemspec.
|
|
94
102
|
|
|
95
|
-
|
|
103
|
+
## 1.3.0 - 4-Nov-2005
|
|
96
104
|
* Added the Getopt::Long class (long.rb). This is a complete revamp of the
|
|
97
105
|
old getoptlong package, with ideas tossed in from Perl's Getopt::Long
|
|
98
106
|
package. See the README and example script for more detail.
|
|
@@ -100,14 +108,14 @@
|
|
|
100
108
|
* Added lots of documentation to the README file.
|
|
101
109
|
* Updated the MANIFEST, test suite, etc.
|
|
102
110
|
|
|
103
|
-
|
|
111
|
+
## 1.2.0 - 24-Oct-2005
|
|
104
112
|
* Altered the way multiple occurrences of the same switch are handled, for
|
|
105
113
|
those switches that accept arguments.
|
|
106
114
|
|
|
107
|
-
|
|
115
|
+
## 1.1.0 - 7-Oct-2005
|
|
108
116
|
* Changed parser, added a bit stricter enforcement
|
|
109
117
|
* Now handles squished arguments properly, e.g. "-ID" as well as "-I -D"
|
|
110
118
|
* Some test suite changes
|
|
111
119
|
|
|
112
|
-
|
|
120
|
+
## 1.0.0 - 5-Oct-2005
|
|
113
121
|
* Initial commit
|
data/Gemfile
ADDED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
* CHANGES.
|
|
1
|
+
* CHANGES.md
|
|
2
2
|
* LICENSE
|
|
3
|
-
* MANIFEST.
|
|
4
|
-
* README.
|
|
3
|
+
* MANIFEST.md
|
|
4
|
+
* README.md
|
|
5
|
+
* Gemfile
|
|
5
6
|
* Rakefile
|
|
6
7
|
* getopt.gemspec
|
|
7
8
|
* certs/djberg96_pub.pem
|
|
@@ -13,5 +14,5 @@
|
|
|
13
14
|
* lib/getopt/long.rb
|
|
14
15
|
* lib/getopt/std.rb
|
|
15
16
|
* lib/getopt/version.rb
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* spec/getopt_long_spec.rb
|
|
18
|
+
* spec/getopt_std_spec.rb
|
data/{README.rdoc → README.md}
RENAMED
|
@@ -1,71 +1,79 @@
|
|
|
1
|
-
|
|
1
|
+
[](https://github.com/djberg96/getopt/actions/workflows/ruby.yml)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
## Description
|
|
4
|
+
The getopt Ruby library is a simple command line parsing library. It implements
|
|
5
|
+
a `Getopt::Std` class for basic command line parsing, as well as a `Getopt::Long`
|
|
6
|
+
class for more advanced command line parsing.
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
## Installation
|
|
9
|
+
`gem install getopt`
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
## Adding the trusted cert
|
|
12
|
+
`gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/getopt/main/certs/djberg96_pub.pem)`
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
end
|
|
14
|
+
## Synopsis
|
|
15
|
+
### Getopt::Std
|
|
16
|
+
```ruby
|
|
17
|
+
require 'getopt/std'
|
|
18
|
+
|
|
19
|
+
# Look for -o with argument, and -I and -D boolean arguments
|
|
20
|
+
opt = Getopt::Std.getopts("o:ID")
|
|
21
|
+
|
|
22
|
+
if opt["I"]
|
|
23
|
+
# Do something if -I passed
|
|
24
|
+
|
|
25
|
+
if opt["D"]
|
|
26
|
+
# Do something if -D passed
|
|
27
|
+
|
|
28
|
+
if opt["o"]
|
|
29
|
+
case opt["o"]
|
|
30
|
+
# blah, blah, blah
|
|
28
31
|
end
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
32
|
+
end
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Getopt::Long
|
|
36
|
+
```ruby
|
|
37
|
+
require 'getopt/long'
|
|
38
|
+
|
|
39
|
+
opt = Getopt::Long.getopts(
|
|
40
|
+
["--foo", "-f", Getopt::BOOLEAN],
|
|
41
|
+
["--bar", "-b", Getopt::REQUIRED]
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
# Or, to save your fingers some typing:
|
|
45
|
+
#
|
|
46
|
+
# require "getopt/long"
|
|
47
|
+
# include Getopt
|
|
48
|
+
# opt = Long.getopts(
|
|
49
|
+
# ["--foo", "-f", BOOLEAN],
|
|
50
|
+
# ["--bar", "-b", REQUIRED]
|
|
51
|
+
# )
|
|
52
|
+
|
|
53
|
+
if opt["foo"]
|
|
54
|
+
# Do something if --foo or -f passed
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
if opt["b"]
|
|
58
|
+
# Do something if --bar or -b passed
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Singleton Methods
|
|
63
|
+
`Std.getopts(switches)`
|
|
57
64
|
|
|
58
65
|
Takes a series of single character switches that can be accepted on the
|
|
59
|
-
command line.
|
|
60
|
-
rest are considered boolean switches.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
command line. Any characters followed by a ":" require an argument. The
|
|
67
|
+
rest are considered boolean switches.
|
|
68
|
+
|
|
69
|
+
The method returns a hash, with the switches as the key (minus the leading '-').
|
|
70
|
+
For boolean switches, the value is either true or false. Switches that were
|
|
71
|
+
not passed on the command line do not appear in the hash.
|
|
64
72
|
|
|
65
|
-
In the event that a switch
|
|
73
|
+
In the event that a switch which accepts an argument appears multiple times
|
|
66
74
|
the value for that key becomes an array of values.
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
`Long.getopts(switches)`
|
|
69
77
|
|
|
70
78
|
Takes an array of switches beginning with "--" followed by one or more
|
|
71
79
|
alphanumeric or hyphen characters, or "-" followed by a single character.
|
|
@@ -74,12 +82,14 @@ REQUIRED or INCREMENT.
|
|
|
74
82
|
|
|
75
83
|
The array should be in the form:
|
|
76
84
|
|
|
77
|
-
|
|
78
|
-
|
|
85
|
+
```
|
|
86
|
+
# long form, short form (alias), option type
|
|
87
|
+
["--long", "-l", Getopt::OPTION]
|
|
88
|
+
```
|
|
79
89
|
|
|
80
|
-
Note that only the long form is required.
|
|
90
|
+
Note that only the long form is required. If the short form is not
|
|
81
91
|
specified, it will automatically be set to the first letter of the long
|
|
82
|
-
switch.
|
|
92
|
+
switch. If multiple long switches with the same first character are
|
|
83
93
|
listed without short switches, only the first long switch gets the short
|
|
84
94
|
switch alias.
|
|
85
95
|
|
|
@@ -90,36 +100,33 @@ no short switches or argument types).
|
|
|
90
100
|
|
|
91
101
|
See the 'examples' directory for more examples.
|
|
92
102
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
REQUIRED
|
|
103
|
+
## Getopt::Long argument types
|
|
104
|
+
`REQUIRED`
|
|
96
105
|
|
|
97
106
|
If the option is specified on the command line, it must be followed by
|
|
98
107
|
a non-blank argument. This argument cannot be another switch. If this
|
|
99
108
|
switch appears multiple times, the values are collected into an array.
|
|
100
109
|
|
|
101
|
-
BOOLEAN
|
|
110
|
+
`BOOLEAN`
|
|
102
111
|
|
|
103
112
|
If the option is specified on the command line, its value is set to true.
|
|
104
113
|
It must not be followed by a non-blank argument, excluding other switches.
|
|
105
114
|
Attempting to pass a boolean switch more than once will raise an error.
|
|
106
115
|
|
|
107
|
-
OPTIONAL
|
|
116
|
+
`OPTIONAL`
|
|
108
117
|
|
|
109
118
|
If the option is specified on the command line, it may or may not accept
|
|
110
119
|
an argument, excluding other valid switches. If an argument is present,
|
|
111
120
|
it's value is set to that argument. If an argument is not present, it's
|
|
112
121
|
value is set to nil.
|
|
113
122
|
|
|
114
|
-
INCREMENT
|
|
123
|
+
`INCREMENT`
|
|
115
124
|
|
|
116
125
|
If the option is specified on the command line, its value is incremented
|
|
117
126
|
by one for each appearance on the command line, or set to 1 if it appears
|
|
118
127
|
only once.
|
|
119
128
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
* Add support for negatable options so that you can do "--no-foo", for example.
|
|
129
|
+
## Future Plans
|
|
123
130
|
|
|
124
131
|
* Add support for numeric types, so that you don't have to manually convert
|
|
125
132
|
strings to numbers.
|
|
@@ -127,40 +134,38 @@ only once.
|
|
|
127
134
|
* Allow shortcut characters for the option types, e.g. "?" for BOOLEAN, "+"
|
|
128
135
|
for INCREMENT, etc.
|
|
129
136
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
== Getopt::Std
|
|
137
|
+
## Known Issues
|
|
133
138
|
|
|
139
|
+
### Getopt::Std
|
|
134
140
|
You cannot squish switches that require arguments with the argument itself.
|
|
135
|
-
For example, if you do Getopt::Std.getopts("o:ID")
|
|
141
|
+
For example, if you do `Getopt::Std.getopts("o:ID")`, it will not parse
|
|
136
142
|
"-IDohello" properly. Instead, you must do "-IDo hello". Or, you can just
|
|
137
143
|
separate the argument, e.g. "-I -D -o hello".
|
|
138
144
|
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
### Getopt::Long
|
|
141
146
|
If you mix and match compressed switches with separate, optional switches
|
|
142
147
|
the optional switch will be set to true instead of nil if it separated
|
|
143
148
|
from the compressed switches.
|
|
144
149
|
|
|
145
|
-
|
|
150
|
+
## Reporting Issues
|
|
146
151
|
|
|
147
152
|
If you find any other issues, please log them on the project
|
|
148
153
|
page at https://github.com/djberg96/getopt.
|
|
149
154
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
Neither class attempts to be POSIX compliant in any way, shape or form. And I don't care!
|
|
155
|
+
## Other Stuff
|
|
156
|
+
Neither class attempts to be POSIX compliant in any way, shape or form.
|
|
153
157
|
|
|
154
|
-
|
|
158
|
+
And I don't care!
|
|
155
159
|
|
|
156
|
-
|
|
160
|
+
## Notes From the Author
|
|
161
|
+
My main gripe with the `getoptlong` library currently in the standard library
|
|
157
162
|
is that it doesn't return a hash, yet gives you partial hash behavior. This
|
|
158
163
|
was both confusing and annoying, since the first thing I do (along with
|
|
159
164
|
everyone else) is collect the results into a hash for later processing.
|
|
160
165
|
|
|
161
|
-
My main gripe with the optparse library (also in the standard library) is
|
|
166
|
+
My main gripe with the `optparse` library (also in the standard library) is
|
|
162
167
|
that it treats command line processing like event processing. It's too
|
|
163
|
-
complex, when
|
|
168
|
+
complex, when most of the time all you want to do is slurp the command line
|
|
164
169
|
options into a hash.
|
|
165
170
|
|
|
166
171
|
So, I did something utterly novel with this library. I collected the command
|
|
@@ -177,23 +182,19 @@ Getopt::Long module.
|
|
|
177
182
|
|
|
178
183
|
If you plan to write a full fledged command line application, e.g. you plan
|
|
179
184
|
on implementing a full help system, gobs of command line options and tons of
|
|
180
|
-
switches, consider Jim Freeze's
|
|
181
|
-
|
|
182
|
-
= Warranty
|
|
185
|
+
switches, consider Jim Freeze's `commandline` gem.
|
|
183
186
|
|
|
187
|
+
## Warranty
|
|
184
188
|
This package is provided "as is" and without any express or
|
|
185
189
|
implied warranties, including, without limitation, the implied
|
|
186
190
|
warranties of merchantability and fitness for a particular purpose.
|
|
187
191
|
|
|
188
|
-
|
|
189
|
-
|
|
192
|
+
## License
|
|
190
193
|
Apache-2.0
|
|
191
194
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
(C) 2005-2020, Daniel J. Berger
|
|
195
|
+
## Copyright
|
|
196
|
+
(C) 2005-2021, Daniel J. Berger
|
|
195
197
|
All Rights Reserved
|
|
196
198
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
+
## Author
|
|
199
200
|
Daniel J. Berger
|
data/Rakefile
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
require 'rake'
|
|
2
2
|
require 'rake/clean'
|
|
3
|
-
require '
|
|
3
|
+
require 'rspec/core/rake_task'
|
|
4
|
+
require 'rubocop/rake_task'
|
|
4
5
|
|
|
5
|
-
CLEAN.include("**/*.gem", "**/*.rbc")
|
|
6
|
+
CLEAN.include("**/*.gem", "**/*.rbc", "**/*.lock")
|
|
6
7
|
|
|
7
8
|
namespace :gem do
|
|
8
9
|
desc "Create the getopt gem"
|
|
9
10
|
task :create => [:clean] do
|
|
10
11
|
require 'rubygems/package'
|
|
11
|
-
spec =
|
|
12
|
+
spec = Gem::Specification.load('getopt.gemspec')
|
|
12
13
|
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
|
13
|
-
Gem::Package.build(spec
|
|
14
|
+
Gem::Package.build(spec)
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
desc "Install the getopt gem"
|
|
@@ -20,23 +21,27 @@ namespace :gem do
|
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
namespace :spec do
|
|
25
|
+
RSpec::Core::RakeTask.new(:all) do |t|
|
|
26
|
+
t.verbose = false
|
|
27
|
+
t.rspec_opts = '-f documentation -w'
|
|
28
|
+
t.pattern = FileList['spec/*_spec.rb']
|
|
29
|
+
end
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
t.test_files = 'test/test_getopt_long.rb'
|
|
31
|
-
t.warning = true
|
|
32
|
-
t.verbose = true
|
|
31
|
+
RSpec::Core::RakeTask.new(:getopt_long) do |t|
|
|
32
|
+
t.pattern = FileList['spec/*long_spec.rb']
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
t.
|
|
37
|
-
t.warning = true
|
|
38
|
-
t.verbose = true
|
|
35
|
+
RSpec::Core::RakeTask.new(:getopt_std) do |t|
|
|
36
|
+
t.pattern = FileList['spec/*std_spec.rb']
|
|
39
37
|
end
|
|
40
38
|
end
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
RuboCop::RakeTask.new
|
|
41
|
+
|
|
42
|
+
# Clean up afterwards
|
|
43
|
+
Rake::Task[:spec].enhance do
|
|
44
|
+
Rake::Task[:clean].invoke
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
task :default => 'spec:all'
|
data/getopt.gemspec
CHANGED
|
@@ -2,28 +2,31 @@ require 'rubygems'
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
4
|
spec.name = 'getopt'
|
|
5
|
-
spec.version = '1.
|
|
5
|
+
spec.version = '1.7.0'
|
|
6
6
|
spec.author = 'Daniel J. Berger'
|
|
7
7
|
spec.license = 'Apache-2.0'
|
|
8
8
|
spec.email = 'djberg96@gmail.com'
|
|
9
9
|
spec.homepage = 'https://github.com/djberg96/getopt'
|
|
10
10
|
spec.summary = 'Getopt::Std and Getopt::Long option parsers for Ruby'
|
|
11
|
-
spec.test_files = Dir['
|
|
11
|
+
spec.test_files = Dir['spec/*_spec.rb']
|
|
12
12
|
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
|
13
13
|
spec.cert_chain = Dir['certs/*']
|
|
14
14
|
|
|
15
|
-
spec.
|
|
16
|
-
|
|
17
|
-
spec.add_development_dependency('
|
|
18
|
-
spec.
|
|
15
|
+
spec.add_development_dependency('rake')
|
|
16
|
+
spec.add_development_dependency('rspec', '~> 3.9')
|
|
17
|
+
spec.add_development_dependency('rubocop')
|
|
18
|
+
spec.add_development_dependency('rubocop-rspec')
|
|
19
19
|
|
|
20
20
|
spec.metadata = {
|
|
21
|
-
'homepage_uri'
|
|
22
|
-
'bug_tracker_uri'
|
|
23
|
-
'changelog_uri'
|
|
24
|
-
'documentation_uri'
|
|
25
|
-
'source_code_uri'
|
|
26
|
-
'wiki_uri'
|
|
21
|
+
'homepage_uri' => 'https://github.com/djberg96/getopt',
|
|
22
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/getopt/issues',
|
|
23
|
+
'changelog_uri' => 'https://github.com/djberg96/getopt/blob/main/CHANGES.md',
|
|
24
|
+
'documentation_uri' => 'https://github.com/djberg96/getopt/wiki',
|
|
25
|
+
'source_code_uri' => 'https://github.com/djberg96/getopt',
|
|
26
|
+
'wiki_uri' => 'https://github.com/djberg96/getopt/wiki',
|
|
27
|
+
'rubygems_mfa_required' => 'true',
|
|
28
|
+
'github_repo' => 'https://github.com/djberg96/getopt',
|
|
29
|
+
'funding_uri' => 'https://github.com/sponsors/djberg96'
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
spec.description = <<-EOF
|