cri 2.15.10 → 2.15.11

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: 4ac76773abd662b4cdd83c22ade38073436ae16afeef75ad95060578b71c23ea
4
- data.tar.gz: 4386555ef8c6d3c27f77205120291efc1898be80973550a81271a89ddaef8495
3
+ metadata.gz: 823a030106960498adbfd77e19f3ef8b30fdfc6b2b592604ced4c875c8ced9f4
4
+ data.tar.gz: 8663621247fffc1be92d538c7cc5d594522e2a350a126236abfe761a15973a5c
5
5
  SHA512:
6
- metadata.gz: f096a5583428ecdca24ad0a800488cb07269d181bc853c6872d34caf7167b6d2d42fb0c2851da24eee4ed4fd1d0ed9e83aa2c75ed644275cb88ac081f0950ed7
7
- data.tar.gz: 02645607f896fcc9ebf2f432d16f3b1b37f8688e4eca21d288bfa0e781c4e0cd2aa5125172ffde92fdec2a14f18220f93e454feb57449f88f7a95f1a0d2b9ef0
6
+ metadata.gz: 5a3c3038f8629238aa071a1d7dd94aee5e7f3e85df7fe097a67176c0300c2a69a3dc576da76354056e8d366ca5b6bae0806b5f0cea3f2854c6c88cafb0150bb3
7
+ data.tar.gz: 7d810e46680ee4802db459510635d2c9857aa400794e09d5d43a903e6ffc0edee0221ce17906f216f543892b9f5ac2f0eb71fa447b1771a9e8f12ac159d5bda8
data/Gemfile CHANGED
@@ -9,4 +9,6 @@ gem 'm', '~> 1.5'
9
9
  gem 'minitest'
10
10
  gem 'rake'
11
11
  gem 'rubocop'
12
+ gem 'rubocop-minitest', '~> 0.10.2'
13
+ gem 'rubocop-rake', '~> 0.5.1'
12
14
  gem 'yard'
@@ -1,39 +1,48 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cri (2.15.10)
4
+ cri (2.15.11)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.0)
9
+ ast (2.4.1)
10
10
  coveralls (0.8.23)
11
11
  json (>= 1.8, < 3)
12
12
  simplecov (~> 0.16.1)
13
13
  term-ansicolor (~> 1.3)
14
14
  thor (>= 0.19.4, < 2.0)
15
15
  tins (~> 1.6)
16
- docile (1.3.2)
17
- jaro_winkler (1.5.4)
18
- json (2.3.0)
16
+ docile (1.3.4)
17
+ json (2.5.1)
19
18
  m (1.5.1)
20
19
  method_source (>= 0.6.7)
21
20
  rake (>= 0.9.2.2)
22
- method_source (0.9.2)
23
- minitest (5.14.0)
24
- parallel (1.19.1)
25
- parser (2.7.0.2)
26
- ast (~> 2.4.0)
21
+ method_source (1.0.0)
22
+ minitest (5.14.2)
23
+ parallel (1.20.1)
24
+ parser (3.0.0.0)
25
+ ast (~> 2.4.1)
27
26
  rainbow (3.0.0)
28
- rake (13.0.1)
29
- rubocop (0.79.0)
30
- jaro_winkler (~> 1.5.1)
27
+ rake (13.0.3)
28
+ regexp_parser (2.0.3)
29
+ rexml (3.2.4)
30
+ rubocop (1.7.0)
31
31
  parallel (~> 1.10)
32
- parser (>= 2.7.0.1)
32
+ parser (>= 2.7.1.5)
33
33
  rainbow (>= 2.2.2, < 4.0)
34
+ regexp_parser (>= 1.8, < 3.0)
35
+ rexml
36
+ rubocop-ast (>= 1.2.0, < 2.0)
34
37
  ruby-progressbar (~> 1.7)
35
- unicode-display_width (>= 1.4.0, < 1.7)
36
- ruby-progressbar (1.10.1)
38
+ unicode-display_width (>= 1.4.0, < 2.0)
39
+ rubocop-ast (1.3.0)
40
+ parser (>= 2.7.1.5)
41
+ rubocop-minitest (0.10.2)
42
+ rubocop (>= 0.87, < 2.0)
43
+ rubocop-rake (0.5.1)
44
+ rubocop
45
+ ruby-progressbar (1.11.0)
37
46
  simplecov (0.16.1)
38
47
  docile (~> 1.1)
39
48
  json (>= 1.8, < 3)
@@ -43,13 +52,13 @@ GEM
43
52
  term-ansicolor (1.7.1)
44
53
  tins (~> 1.0)
45
54
  thor (1.0.1)
46
- tins (1.24.0)
55
+ tins (1.26.0)
47
56
  sync
48
- unicode-display_width (1.6.1)
49
- yard (0.9.24)
57
+ unicode-display_width (1.7.0)
58
+ yard (0.9.26)
50
59
 
51
60
  PLATFORMS
52
- ruby
61
+ x86_64-darwin-20
53
62
 
54
63
  DEPENDENCIES
55
64
  coveralls
@@ -58,7 +67,9 @@ DEPENDENCIES
58
67
  minitest
59
68
  rake
60
69
  rubocop
70
+ rubocop-minitest (~> 0.10.2)
71
+ rubocop-rake (~> 0.5.1)
61
72
  yard
62
73
 
63
74
  BUNDLED WITH
64
- 2.1.2
75
+ 2.2.3
data/NEWS.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Cri News
2
2
 
3
+ ## 2.15.11
4
+
5
+ Fixes:
6
+
7
+ - Added support for Ruby 3.0 (#111)
8
+
9
+ Changes:
10
+
11
+ - Dropped support for Ruby 2.3 and 2.4 (#112)
12
+
3
13
  ## 2.15.10
4
14
 
5
15
  Fixes:
data/README.md CHANGED
@@ -12,14 +12,14 @@ nested commands.
12
12
 
13
13
  ## Requirements
14
14
 
15
- Cri requires Ruby 2.3 or newer.
15
+ Cri requires Ruby 2.5 or newer (including Ruby 3.x).
16
16
 
17
17
  ## Compatibility policy
18
18
 
19
19
  Cri is guaranteed to be supported on any [officially supported Ruby version](https://www.ruby-lang.org/en/downloads/branches/), as well as the version of Ruby that comes by default on
20
20
 
21
- * the last two [Ubuntu LTS releases](https://wiki.ubuntu.com/Releases)
22
- * the last two major [macOS releases](https://en.wikipedia.org/wiki/MacOS_version_history)
21
+ - the last two [Ubuntu LTS releases](https://wiki.ubuntu.com/Releases)
22
+ - the last two major [macOS releases](https://en.wikipedia.org/wiki/MacOS_version_history)
23
23
 
24
24
  ## Usage
25
25
 
@@ -119,101 +119,101 @@ The most generic way of definition an option is using either `#option` or `#opt`
119
119
  2. a long option name
120
120
  3. a description
121
121
  4. optional extra parameters
122
- * `argument:` (default: `:forbidden`)
123
- * `transform:`
124
- * `default:`
125
- * `multiple:` (default: `false`)
122
+ - `argument:` (default: `:forbidden`)
123
+ - `transform:`
124
+ - `default:`
125
+ - `multiple:` (default: `false`)
126
126
  5. optionally, a block
127
127
 
128
128
  In more detail:
129
129
 
130
- * The short option name is a symbol containing one character, to be used in single-dash options, e.g. `:f` (corresponds to `-f`). The long option name is a symbol containing a string, to be used in double-dash options, e.g. `:force` (corresponds to `--force`). Either the short or the long option name can be nil, but not both.
130
+ - The short option name is a symbol containing one character, to be used in single-dash options, e.g. `:f` (corresponds to `-f`). The long option name is a symbol containing a string, to be used in double-dash options, e.g. `:force` (corresponds to `--force`). Either the short or the long option name can be nil, but not both.
131
131
 
132
- * The description is a short, one-line text that shows up in the command’s help. For example, the `-v`/`--version` option might have the description `show version information and quit`.
132
+ - The description is a short, one-line text that shows up in the command’s help. For example, the `-v`/`--version` option might have the description `show version information and quit`.
133
133
 
134
- * The extra parameters, `argument:`, `multiple:`, `default:`, and `transform:`, are described in the sections below.
134
+ - The extra parameters, `argument:`, `multiple:`, `default:`, and `transform:`, are described in the sections below.
135
135
 
136
- * The block, if given, will be executed when the option is found. The arguments to the block are the option value (`true` in case the option does not have an argument) and the command.
136
+ - The block, if given, will be executed when the option is found. The arguments to the block are the option value (`true` in case the option does not have an argument) and the command.
137
137
 
138
138
  There are several convenience methods that are alternatives to `#option`/`#opt`:
139
139
 
140
- * `#flag` sets `argument:` to `:forbidden`
141
- * (**deprecated**) `#required` sets `argument:` to `:required` -- deprecated because `#required` suggests that the option is required, wich is incorrect; the _argument_ is required.)
142
- * (**deprecated**) `#optional` sets `argument:` to `:optional` -- deprecated because `#optional` looks too similar to `#option`.
140
+ - `#flag` sets `argument:` to `:forbidden`
141
+ - (**deprecated**) `#required` sets `argument:` to `:required` -- deprecated because `#required` suggests that the option is required, wich is incorrect; the _argument_ is required.)
142
+ - (**deprecated**) `#optional` sets `argument:` to `:optional` -- deprecated because `#optional` looks too similar to `#option`.
143
143
 
144
144
  #### Forbidden, required, and optional arguments (`argument:`)
145
145
 
146
146
  The `:argument` parameter can be set to `:forbidden`, `:required`, or `:optional`.
147
147
 
148
- * `:forbidden` means that when the option is present, the value will be set to `true`, and `false` otherwise. For example:
148
+ - `:forbidden` means that when the option is present, the value will be set to `true`, and `false` otherwise. For example:
149
149
 
150
- ```ruby
151
- option :f, :force, 'push with force', argument: :forbidden
150
+ ```ruby
151
+ option :f, :force, 'push with force', argument: :forbidden
152
152
 
153
- run do |opts, args, cmd|
154
- puts "Force? #{opts[:force]}"
155
- end
156
- ```
153
+ run do |opts, args, cmd|
154
+ puts "Force? #{opts[:force]}"
155
+ end
156
+ ```
157
157
 
158
- ```sh
159
- % ./push mypackage.zip
160
- Force? false
158
+ ```sh
159
+ % ./push mypackage.zip
160
+ Force? false
161
161
 
162
- % ./push --force mypackage.zip
163
- Force? true
164
- ```
162
+ % ./push --force mypackage.zip
163
+ Force? true
164
+ ```
165
165
 
166
- `:argument` is set to `:forbidden` by default.
166
+ `:argument` is set to `:forbidden` by default.
167
167
 
168
- * `:required` means that the option must be followed by an argument, which will then be treated as the value for the option. It does not mean that the option itself is required. For example:
168
+ - `:required` means that the option must be followed by an argument, which will then be treated as the value for the option. It does not mean that the option itself is required. For example:
169
169
 
170
- ```ruby
171
- option :o, :output, 'specify output file', argument: :required
172
- option :f, :fast, 'fetch faster', argument: :forbidden
170
+ ```ruby
171
+ option :o, :output, 'specify output file', argument: :required
172
+ option :f, :fast, 'fetch faster', argument: :forbidden
173
173
 
174
- run do |opts, args, cmd|
175
- puts "Output file: #{opts[:output]}"
176
- end
177
- ```
174
+ run do |opts, args, cmd|
175
+ puts "Output file: #{opts[:output]}"
176
+ end
177
+ ```
178
178
 
179
- ```sh
180
- % ./fetch http://example.com/source.zip
181
- Output file: nil
179
+ ```sh
180
+ % ./fetch http://example.com/source.zip
181
+ Output file: nil
182
182
 
183
- % ./fetch --output example.zip http://example.com/source.zip
184
- Output file: example.zip
183
+ % ./fetch --output example.zip http://example.com/source.zip
184
+ Output file: example.zip
185
185
 
186
- % ./fetch http://example.com/source.zip --output
187
- fetch: option requires an argument -- output
186
+ % ./fetch http://example.com/source.zip --output
187
+ fetch: option requires an argument -- output
188
188
 
189
- % ./fetch --output --fast http://example.com/source.zip
190
- fetch: option requires an argument -- output
191
- ```
189
+ % ./fetch --output --fast http://example.com/source.zip
190
+ fetch: option requires an argument -- output
191
+ ```
192
192
 
193
- * `:optional` means that the option can be followed by an argument. If it is, then the argument is treated as the value for the option; if it isn’t, the value for the option will be `true`. For example:
193
+ - `:optional` means that the option can be followed by an argument. If it is, then the argument is treated as the value for the option; if it isn’t, the value for the option will be `true`. For example:
194
194
 
195
- ```ruby
196
- option :o, :output, 'specify output file', argument: :optional
197
- option :f, :fast, 'fetch faster', argument: :forbidden
195
+ ```ruby
196
+ option :o, :output, 'specify output file', argument: :optional
197
+ option :f, :fast, 'fetch faster', argument: :forbidden
198
198
 
199
- run do |opts, args, cmd|
200
- puts "Output file: #{opts[:output]}"
201
- end
202
- ```
199
+ run do |opts, args, cmd|
200
+ puts "Output file: #{opts[:output]}"
201
+ end
202
+ ```
203
203
 
204
- ```sh
205
- % ./fetch http://example.com/source.zip
206
- Output file: nil
204
+ ```sh
205
+ % ./fetch http://example.com/source.zip
206
+ Output file: nil
207
207
 
208
- % ./fetch --output example.zip http://example.com/source.zip
209
- Output file: example.zip
208
+ % ./fetch --output example.zip http://example.com/source.zip
209
+ Output file: example.zip
210
210
 
211
- % ./fetch http://example.com/source.zip --output
212
- Output file: true
211
+ % ./fetch http://example.com/source.zip --output
212
+ Output file: true
213
213
 
214
- % ./fetch --output --fast http://example.com/source.zip
215
- Output file: true
216
- ```
214
+ % ./fetch --output --fast http://example.com/source.zip
215
+ Output file: true
216
+ ```
217
217
 
218
218
  #### Transforming options (`transform:`)
219
219
 
@@ -374,7 +374,7 @@ As with options, parameter definitions take `transform:`, which can be used for
374
374
  param :port, transform: method(:Integer)
375
375
  ```
376
376
 
377
- (*Why the distinction between argument and parameter?* A parameter is a name, e.g. `filename`, while an argument is a value for a parameter, e.g. `kitten.jpg`.)
377
+ (_Why the distinction between argument and parameter?_ A parameter is a name, e.g. `filename`, while an argument is a value for a parameter, e.g. `kitten.jpg`.)
378
378
 
379
379
  ### Allowing arbitrary arguments
380
380
 
@@ -584,10 +584,10 @@ cmd = Cri::Command.load_file('commands/check.rb', infer_name: true)
584
584
 
585
585
  ## Contributors
586
586
 
587
- * Bart Mesuere
588
- * Ken Coar
589
- * Tim Sharpe
590
- * Toon Willems
587
+ - Bart Mesuere
588
+ - Ken Coar
589
+ - Tim Sharpe
590
+ - Toon Willems
591
591
 
592
592
  Thanks for Lee “injekt” Jarvis for [Slop](https://github.com/injekt/slop),
593
593
  which has inspired the design of Cri 2.0.
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.files = Dir['[A-Z]*'] + Dir['{lib,test}/**/*'] + ['cri.gemspec']
17
17
  s.require_paths = ['lib']
18
18
 
19
- s.required_ruby_version = '~> 2.3'
19
+ s.required_ruby_version = '>= 2.5'
20
20
 
21
21
  s.rdoc_options = ['--main', 'README.md']
22
22
  s.extra_rdoc_files = ['LICENSE', 'README.md', 'NEWS.md']
@@ -6,12 +6,7 @@ module Cri
6
6
  # Error that will be raised when an incorrect number of arguments is given.
7
7
  class ArgumentCountMismatchError < Cri::Error
8
8
  def initialize(expected_count, actual_count)
9
- @expected_count = expected_count
10
- @actual_count = actual_count
11
- end
12
-
13
- def message
14
- "incorrect number of arguments given: expected #{@expected_count}, but got #{@actual_count}"
9
+ super("incorrect number of arguments given: expected #{expected_count}, but got #{actual_count}")
15
10
  end
16
11
  end
17
12
 
@@ -46,6 +46,8 @@ module Cri
46
46
  # @api private
47
47
  class CriExitException < StandardError
48
48
  def initialize(is_error:)
49
+ super('exit requested')
50
+
49
51
  @is_error = is_error
50
52
  end
51
53
 
@@ -8,12 +8,7 @@ module Cri
8
8
  # already declared as taken no params.
9
9
  class AlreadySpecifiedAsNoParams < Cri::Error
10
10
  def initialize(param, command)
11
- @param = param
12
- @command = command
13
- end
14
-
15
- def message
16
- "Attempted to specify a parameter #{@param.inspect} to the command #{@command.name.inspect}, which is already specified as taking no params. Suggestion: remove the #no_params call."
11
+ super("Attempted to specify a parameter #{param.inspect} to the command #{command.name.inspect}, which is already specified as taking no params. Suggestion: remove the #no_params call.")
17
12
  end
18
13
  end
19
14
 
@@ -21,11 +16,7 @@ module Cri
21
16
  # parameters, when the command is already declared with parameters.
22
17
  class AlreadySpecifiedWithParams < Cri::Error
23
18
  def initialize(command)
24
- @command = command
25
- end
26
-
27
- def message
28
- "Attempted to declare the command #{@command.name.inspect} as taking no parameters, but some parameters are already declared for this command. Suggestion: remove the #no_params call."
19
+ super("Attempted to declare the command #{command.name.inspect} as taking no parameters, but some parameters are already declared for this command. Suggestion: remove the #no_params call.")
29
20
  end
30
21
  end
31
22
 
@@ -14,12 +14,10 @@ module Cri
14
14
  attr_reader :value
15
15
 
16
16
  def initialize(definition, value)
17
- @definition = definition
18
- @value = value
19
- end
17
+ super("invalid value #{value.inspect} for #{definition.formatted_name} option")
20
18
 
21
- def message
22
- "invalid value #{value.inspect} for #{@definition.formatted_name} option"
19
+ @value = value
20
+ @definition = definition
23
21
  end
24
22
  end
25
23
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Cri
4
4
  # The current Cri version.
5
- VERSION = '2.15.10'
5
+ VERSION = '2.15.11'
6
6
  end
@@ -443,7 +443,7 @@ module Cri
443
443
  input = %w[localhost]
444
444
  param_defns = [
445
445
  { name: 'host', transform: nil },
446
- ].map { |hash| Cri::ParamDefinition.new(hash) }
446
+ ].map { |hash| Cri::ParamDefinition.new(**hash) }
447
447
 
448
448
  parser = Cri::Parser.new(input, [], param_defns, false).run
449
449
  assert_equal({}, parser.options)
@@ -455,7 +455,7 @@ module Cri
455
455
  input = []
456
456
  param_defns = [
457
457
  { name: 'host', transform: nil },
458
- ].map { |hash| Cri::ParamDefinition.new(hash) }
458
+ ].map { |hash| Cri::ParamDefinition.new(**hash) }
459
459
 
460
460
  parser = Cri::Parser.new(input, [], param_defns, false).run
461
461
  exception = assert_raises(Cri::ArgumentList::ArgumentCountMismatchError) do
@@ -468,7 +468,7 @@ module Cri
468
468
  input = %w[localhost oink]
469
469
  param_defns = [
470
470
  { name: 'host', transform: nil },
471
- ].map { |hash| Cri::ParamDefinition.new(hash) }
471
+ ].map { |hash| Cri::ParamDefinition.new(**hash) }
472
472
 
473
473
  parser = Cri::Parser.new(input, [], param_defns, false).run
474
474
  exception = assert_raises(Cri::ArgumentList::ArgumentCountMismatchError) do
@@ -481,7 +481,7 @@ module Cri
481
481
  input = %w[localhost]
482
482
  param_defns = [
483
483
  { name: 'host', transform: nil },
484
- ].map { |hash| Cri::ParamDefinition.new(hash) }
484
+ ].map { |hash| Cri::ParamDefinition.new(**hash) }
485
485
 
486
486
  parser = Cri::Parser.new(input, [], param_defns, false).run
487
487
 
@@ -496,7 +496,7 @@ module Cri
496
496
  param_defns = [
497
497
  { name: 'source', transform: nil },
498
498
  { name: 'target', transform: nil },
499
- ].map { |hash| Cri::ParamDefinition.new(hash) }
499
+ ].map { |hash| Cri::ParamDefinition.new(**hash) }
500
500
 
501
501
  parser = Cri::Parser.new(input, [], param_defns, false).run
502
502
  assert_equal({}, parser.options)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cri
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.10
4
+ version: 2.15.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-21 00:00:00.000000000 Z
11
+ date: 2020-12-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Cri allows building easy-to-use command-line interfaces with support
14
14
  for subcommands.
@@ -57,7 +57,7 @@ homepage: https://github.com/ddfreyne/cri
57
57
  licenses:
58
58
  - MIT
59
59
  metadata: {}
60
- post_install_message:
60
+ post_install_message:
61
61
  rdoc_options:
62
62
  - "--main"
63
63
  - README.md
@@ -65,17 +65,17 @@ require_paths:
65
65
  - lib
66
66
  required_ruby_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - "~>"
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: '2.3'
70
+ version: '2.5'
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubygems_version: 3.1.2
78
- signing_key:
77
+ rubygems_version: 3.2.3
78
+ signing_key:
79
79
  specification_version: 4
80
80
  summary: a library for building easy-to-use command-line tools
81
81
  test_files: []