cri 2.7.0 → 2.7.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.
@@ -1,12 +1,10 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  class CommandRunnerTestCase < Cri::TestCase
5
3
  def setup
6
4
  super
7
5
 
8
- @options = { :vehicle => 'pig' }
9
- @arguments = %w( baby_monkey )
6
+ @options = { vehicle: 'pig' }
7
+ @arguments = %w(baby_monkey)
10
8
  @command = Cri::Command.new
11
9
  end
12
10
 
@@ -1,19 +1,17 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  class OptionParserTestCase < Cri::TestCase
5
3
  def test_parse_without_options
6
- input = %w( foo bar baz )
4
+ input = %w(foo bar baz)
7
5
  definitions = []
8
6
 
9
7
  parser = Cri::OptionParser.parse(input, definitions)
10
8
 
11
- assert_equal({}, parser.options)
9
+ assert_equal({}, parser.options)
12
10
  assert_equal(%w(foo bar baz), parser.arguments)
13
11
  end
14
12
 
15
13
  def test_parse_with_invalid_option
16
- input = %w( foo -x )
14
+ input = %w(foo -x)
17
15
  definitions = []
18
16
 
19
17
  assert_raises(Cri::OptionParser::IllegalOptionError) do
@@ -22,9 +20,9 @@ module Cri
22
20
  end
23
21
 
24
22
  def test_parse_with_unused_options
25
- input = %w( foo )
23
+ input = %w(foo)
26
24
  definitions = [
27
- { :long => 'aaa', :short => 'a', :argument => :forbidden },
25
+ { long: 'aaa', short: 'a', argument: :forbidden },
28
26
  ]
29
27
 
30
28
  parser = Cri::OptionParser.parse(input, definitions)
@@ -33,9 +31,9 @@ module Cri
33
31
  end
34
32
 
35
33
  def test_parse_with_long_valueless_option
36
- input = %w( foo --aaa bar )
34
+ input = %w(foo --aaa bar)
37
35
  definitions = [
38
- { :long => 'aaa', :short => 'a', :argument => :forbidden },
36
+ { long: 'aaa', short: 'a', argument: :forbidden },
39
37
  ]
40
38
 
41
39
  parser = Cri::OptionParser.parse(input, definitions)
@@ -45,33 +43,33 @@ module Cri
45
43
  end
46
44
 
47
45
  def test_parse_with_long_valueful_option
48
- input = %w( foo --aaa xxx bar )
46
+ input = %w(foo --aaa xxx bar)
49
47
  definitions = [
50
- { :long => 'aaa', :short => 'a', :argument => :required },
48
+ { long: 'aaa', short: 'a', argument: :required },
51
49
  ]
52
50
 
53
51
  parser = Cri::OptionParser.parse(input, definitions)
54
52
 
55
- assert_equal({ :aaa => 'xxx' }, parser.options)
53
+ assert_equal({ aaa: 'xxx' }, parser.options)
56
54
  assert_equal(%w(foo bar), parser.arguments)
57
55
  end
58
56
 
59
57
  def test_parse_with_long_valueful_equalsign_option
60
- input = %w( foo --aaa=xxx bar )
58
+ input = %w(foo --aaa=xxx bar)
61
59
  definitions = [
62
- { :long => 'aaa', :short => 'a', :argument => :required },
60
+ { long: 'aaa', short: 'a', argument: :required },
63
61
  ]
64
62
 
65
63
  parser = Cri::OptionParser.parse(input, definitions)
66
64
 
67
- assert_equal({ :aaa => 'xxx' }, parser.options)
65
+ assert_equal({ aaa: 'xxx' }, parser.options)
68
66
  assert_equal(%w(foo bar), parser.arguments)
69
67
  end
70
68
 
71
69
  def test_parse_with_long_valueful_option_with_missing_value
72
- input = %w( foo --aaa )
70
+ input = %w(foo --aaa)
73
71
  definitions = [
74
- { :long => 'aaa', :short => 'a', :argument => :required },
72
+ { long: 'aaa', short: 'a', argument: :required },
75
73
  ]
76
74
 
77
75
  assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
@@ -80,10 +78,10 @@ module Cri
80
78
  end
81
79
 
82
80
  def test_parse_with_two_long_valueful_options
83
- input = %w( foo --all --port 2 )
81
+ input = %w(foo --all --port 2)
84
82
  definitions = [
85
- { :long => 'all', :short => 'a', :argument => :required },
86
- { :long => 'port', :short => 'p', :argument => :required },
83
+ { long: 'all', short: 'a', argument: :required },
84
+ { long: 'port', short: 'p', argument: :required },
87
85
  ]
88
86
 
89
87
  assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
@@ -92,9 +90,9 @@ module Cri
92
90
  end
93
91
 
94
92
  def test_parse_with_long_valueless_option_with_optional_value
95
- input = %w( foo --aaa )
93
+ input = %w(foo --aaa)
96
94
  definitions = [
97
- { :long => 'aaa', :short => 'a', :argument => :optional },
95
+ { long: 'aaa', short: 'a', argument: :optional },
98
96
  ]
99
97
 
100
98
  parser = Cri::OptionParser.parse(input, definitions)
@@ -104,23 +102,23 @@ module Cri
104
102
  end
105
103
 
106
104
  def test_parse_with_long_valueful_option_with_optional_value
107
- input = %w( foo --aaa xxx )
105
+ input = %w(foo --aaa xxx)
108
106
  definitions = [
109
- { :long => 'aaa', :short => 'a', :argument => :optional },
107
+ { long: 'aaa', short: 'a', argument: :optional },
110
108
  ]
111
109
 
112
110
  parser = Cri::OptionParser.parse(input, definitions)
113
111
 
114
- assert_equal({ :aaa => 'xxx' }, parser.options)
112
+ assert_equal({ aaa: 'xxx' }, parser.options)
115
113
  assert_equal(['foo'], parser.arguments)
116
114
  end
117
115
 
118
116
  def test_parse_with_long_valueless_option_with_optional_value_and_more_options
119
- input = %w( foo --aaa -b -c )
117
+ input = %w(foo --aaa -b -c)
120
118
  definitions = [
121
- { :long => 'aaa', :short => 'a', :argument => :optional },
122
- { :long => 'bbb', :short => 'b', :argument => :forbidden },
123
- { :long => 'ccc', :short => 'c', :argument => :forbidden },
119
+ { long: 'aaa', short: 'a', argument: :optional },
120
+ { long: 'bbb', short: 'b', argument: :forbidden },
121
+ { long: 'ccc', short: 'c', argument: :forbidden },
124
122
  ]
125
123
 
126
124
  parser = Cri::OptionParser.parse(input, definitions)
@@ -132,9 +130,9 @@ module Cri
132
130
  end
133
131
 
134
132
  def test_parse_with_short_valueless_options
135
- input = %w( foo -a bar )
133
+ input = %w(foo -a bar)
136
134
  definitions = [
137
- { :long => 'aaa', :short => 'a', :argument => :forbidden },
135
+ { long: 'aaa', short: 'a', argument: :forbidden },
138
136
  ]
139
137
 
140
138
  parser = Cri::OptionParser.parse(input, definitions)
@@ -144,9 +142,9 @@ module Cri
144
142
  end
145
143
 
146
144
  def test_parse_with_short_valueful_option_with_missing_value
147
- input = %w( foo -a )
145
+ input = %w(foo -a)
148
146
  definitions = [
149
- { :long => 'aaa', :short => 'a', :argument => :required },
147
+ { long: 'aaa', short: 'a', argument: :required },
150
148
  ]
151
149
 
152
150
  assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
@@ -155,11 +153,11 @@ module Cri
155
153
  end
156
154
 
157
155
  def test_parse_with_short_combined_valueless_options
158
- input = %w( foo -abc bar )
156
+ input = %w(foo -abc bar)
159
157
  definitions = [
160
- { :long => 'aaa', :short => 'a', :argument => :forbidden },
161
- { :long => 'bbb', :short => 'b', :argument => :forbidden },
162
- { :long => 'ccc', :short => 'c', :argument => :forbidden },
158
+ { long: 'aaa', short: 'a', argument: :forbidden },
159
+ { long: 'bbb', short: 'b', argument: :forbidden },
160
+ { long: 'ccc', short: 'c', argument: :forbidden },
163
161
  ]
164
162
 
165
163
  parser = Cri::OptionParser.parse(input, definitions)
@@ -171,11 +169,11 @@ module Cri
171
169
  end
172
170
 
173
171
  def test_parse_with_short_combined_valueful_options_with_missing_value
174
- input = %w( foo -abc bar )
172
+ input = %w(foo -abc bar)
175
173
  definitions = [
176
- { :long => 'aaa', :short => 'a', :argument => :required },
177
- { :long => 'bbb', :short => 'b', :argument => :forbidden },
178
- { :long => 'ccc', :short => 'c', :argument => :forbidden },
174
+ { long: 'aaa', short: 'a', argument: :required },
175
+ { long: 'bbb', short: 'b', argument: :forbidden },
176
+ { long: 'ccc', short: 'c', argument: :forbidden },
179
177
  ]
180
178
 
181
179
  assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
@@ -184,10 +182,10 @@ module Cri
184
182
  end
185
183
 
186
184
  def test_parse_with_two_short_valueful_options
187
- input = %w( foo -a -p 2 )
185
+ input = %w(foo -a -p 2)
188
186
  definitions = [
189
- { :long => 'all', :short => 'a', :argument => :required },
190
- { :long => 'port', :short => 'p', :argument => :required },
187
+ { long: 'all', short: 'a', argument: :required },
188
+ { long: 'port', short: 'p', argument: :required },
191
189
  ]
192
190
 
193
191
  assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
@@ -196,9 +194,9 @@ module Cri
196
194
  end
197
195
 
198
196
  def test_parse_with_short_valueless_option_with_optional_value
199
- input = %w( foo -a )
197
+ input = %w(foo -a)
200
198
  definitions = [
201
- { :long => 'aaa', :short => 'a', :argument => :optional },
199
+ { long: 'aaa', short: 'a', argument: :optional },
202
200
  ]
203
201
 
204
202
  parser = Cri::OptionParser.parse(input, definitions)
@@ -208,23 +206,23 @@ module Cri
208
206
  end
209
207
 
210
208
  def test_parse_with_short_valueful_option_with_optional_value
211
- input = %w( foo -a xxx )
209
+ input = %w(foo -a xxx)
212
210
  definitions = [
213
- { :long => 'aaa', :short => 'a', :argument => :optional },
211
+ { long: 'aaa', short: 'a', argument: :optional },
214
212
  ]
215
213
 
216
214
  parser = Cri::OptionParser.parse(input, definitions)
217
215
 
218
- assert_equal({ :aaa => 'xxx' }, parser.options)
216
+ assert_equal({ aaa: 'xxx' }, parser.options)
219
217
  assert_equal(['foo'], parser.arguments)
220
218
  end
221
219
 
222
220
  def test_parse_with_short_valueless_option_with_optional_value_and_more_options
223
- input = %w( foo -a -b -c )
221
+ input = %w(foo -a -b -c)
224
222
  definitions = [
225
- { :long => 'aaa', :short => 'a', :argument => :optional },
226
- { :long => 'bbb', :short => 'b', :argument => :forbidden },
227
- { :long => 'ccc', :short => 'c', :argument => :forbidden },
223
+ { long: 'aaa', short: 'a', argument: :optional },
224
+ { long: 'bbb', short: 'b', argument: :forbidden },
225
+ { long: 'ccc', short: 'c', argument: :forbidden },
228
226
  ]
229
227
 
230
228
  parser = Cri::OptionParser.parse(input, definitions)
@@ -236,30 +234,30 @@ module Cri
236
234
  end
237
235
 
238
236
  def test_parse_with_single_hyphen
239
- input = %w( foo - bar )
237
+ input = %w(foo - bar)
240
238
  definitions = []
241
239
 
242
240
  parser = Cri::OptionParser.parse(input, definitions)
243
241
 
244
- assert_equal({}, parser.options)
242
+ assert_equal({}, parser.options)
245
243
  assert_equal(['foo', '-', 'bar'], parser.arguments)
246
244
  end
247
245
 
248
246
  def test_parse_with_end_marker
249
- input = %w( foo bar -- -x --yyy -abc )
247
+ input = %w(foo bar -- -x --yyy -abc)
250
248
  definitions = []
251
249
 
252
250
  parser = Cri::OptionParser.parse(input, definitions)
253
251
 
254
- assert_equal({}, parser.options)
252
+ assert_equal({}, parser.options)
255
253
  assert_equal(['foo', 'bar', '-x', '--yyy', '-abc'], parser.arguments)
256
254
  assert_equal(['foo', 'bar', '--', '-x', '--yyy', '-abc'], parser.arguments.raw)
257
255
  end
258
256
 
259
257
  def test_parse_with_end_marker_between_option_key_and_value
260
- input = %w( foo --aaa -- zzz )
258
+ input = %w(foo --aaa -- zzz)
261
259
  definitions = [
262
- { :long => 'aaa', :short => 'a', :argument => :required },
260
+ { long: 'aaa', short: 'a', argument: :required },
263
261
  ]
264
262
 
265
263
  assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
@@ -268,10 +266,10 @@ module Cri
268
266
  end
269
267
 
270
268
  def test_parse_with_multiple_options
271
- input = %w( foo -o test -o test2 -v -v -v)
269
+ input = %w(foo -o test -o test2 -v -v -v)
272
270
  definitions = [
273
- { :long => 'long', :short => 'o', :argument => :required, :multiple => true },
274
- { :long => 'verbose', :short => 'v', :multiple => true },
271
+ { long: 'long', short: 'o', argument: :required, multiple: true },
272
+ { long: 'verbose', short: 'v', multiple: true },
275
273
  ]
276
274
  parser = Cri::OptionParser.parse(input, definitions)
277
275
 
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  class CoreExtTestCase < Cri::TestCase
5
3
  def formatter
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.7.0
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-29 00:00:00.000000000 Z
11
+ date: 2016-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -38,8 +38,8 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.6'
41
- description: Cri allows building easy-to-use commandline interfaces with support for
42
- subcommands.
41
+ description: Cri allows building easy-to-use command-line interfaces with support
42
+ for subcommands.
43
43
  email: denis.defreyne@stoneship.org
44
44
  executables: []
45
45
  extensions: []
@@ -101,9 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.4.6
104
+ rubygems_version: 2.6.8
105
105
  signing_key:
106
106
  specification_version: 4
107
- summary: a library for building easy-to-use commandline tools
107
+ summary: a library for building easy-to-use command-line tools
108
108
  test_files: []
109
- has_rdoc: