app_identity 1.0.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 +7 -0
- data/.rdoc_options +28 -0
- data/Changelog.md +5 -0
- data/Contributing.md +70 -0
- data/Licence.md +25 -0
- data/Manifest.txt +30 -0
- data/README.md +70 -0
- data/Rakefile +50 -0
- data/bin/app-identity-suite-ruby +12 -0
- data/lib/app_identity/app.rb +214 -0
- data/lib/app_identity/error.rb +42 -0
- data/lib/app_identity/faraday_middleware.rb +94 -0
- data/lib/app_identity/internal.rb +130 -0
- data/lib/app_identity/rack_middleware.rb +242 -0
- data/lib/app_identity/validation.rb +83 -0
- data/lib/app_identity/versions.rb +194 -0
- data/lib/app_identity.rb +233 -0
- data/licences/APACHE-2.0.txt +168 -0
- data/licences/DCO.txt +34 -0
- data/spec.md +409 -0
- data/support/app_identity/suite/generator.rb +242 -0
- data/support/app_identity/suite/optional.json +491 -0
- data/support/app_identity/suite/program.rb +204 -0
- data/support/app_identity/suite/required.json +514 -0
- data/support/app_identity/suite/runner.rb +132 -0
- data/support/app_identity/suite.rb +10 -0
- data/support/app_identity/support.rb +119 -0
- data/test/minitest_helper.rb +24 -0
- data/test/test_app_identity.rb +124 -0
- data/test/test_app_identity_app.rb +64 -0
- data/test/test_app_identity_rack_middleware.rb +90 -0
- metadata +306 -0
@@ -0,0 +1,491 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"app": {
|
4
|
+
"version": 1
|
5
|
+
},
|
6
|
+
"description": "App V1, Proof V2 offset timestamp",
|
7
|
+
"expect": "fail",
|
8
|
+
"nonce": {
|
9
|
+
"offset_minutes": -12
|
10
|
+
},
|
11
|
+
"proof": {
|
12
|
+
"version": 2
|
13
|
+
},
|
14
|
+
"spec_version": 4
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"app": {
|
18
|
+
"version": 1
|
19
|
+
},
|
20
|
+
"description": "App V1, Proof V3 offset timestamp",
|
21
|
+
"expect": "fail",
|
22
|
+
"nonce": {
|
23
|
+
"offset_minutes": -12
|
24
|
+
},
|
25
|
+
"proof": {
|
26
|
+
"version": 3
|
27
|
+
},
|
28
|
+
"spec_version": 4
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"app": {
|
32
|
+
"version": 1
|
33
|
+
},
|
34
|
+
"description": "App V1, Proof V4 offset timestamp",
|
35
|
+
"expect": "fail",
|
36
|
+
"nonce": {
|
37
|
+
"offset_minutes": -12
|
38
|
+
},
|
39
|
+
"proof": {
|
40
|
+
"version": 4
|
41
|
+
},
|
42
|
+
"spec_version": 4
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"app": {
|
46
|
+
"version": 2
|
47
|
+
},
|
48
|
+
"description": "App V2, Proof V2 offset timestamp",
|
49
|
+
"expect": "fail",
|
50
|
+
"nonce": {
|
51
|
+
"offset_minutes": -12
|
52
|
+
},
|
53
|
+
"proof": {
|
54
|
+
"version": 2
|
55
|
+
},
|
56
|
+
"spec_version": 4
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"app": {
|
60
|
+
"version": 2
|
61
|
+
},
|
62
|
+
"description": "App V2, Proof V3 offset timestamp",
|
63
|
+
"expect": "fail",
|
64
|
+
"nonce": {
|
65
|
+
"offset_minutes": -12
|
66
|
+
},
|
67
|
+
"proof": {
|
68
|
+
"version": 3
|
69
|
+
},
|
70
|
+
"spec_version": 4
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"app": {
|
74
|
+
"version": 2
|
75
|
+
},
|
76
|
+
"description": "App V2, Proof V4 offset timestamp",
|
77
|
+
"expect": "fail",
|
78
|
+
"nonce": {
|
79
|
+
"offset_minutes": -12
|
80
|
+
},
|
81
|
+
"proof": {
|
82
|
+
"version": 4
|
83
|
+
},
|
84
|
+
"spec_version": 4
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"app": {
|
88
|
+
"version": 3
|
89
|
+
},
|
90
|
+
"description": "App V3, Proof V3 offset timestamp",
|
91
|
+
"expect": "fail",
|
92
|
+
"nonce": {
|
93
|
+
"offset_minutes": -12
|
94
|
+
},
|
95
|
+
"proof": {
|
96
|
+
"version": 3
|
97
|
+
},
|
98
|
+
"spec_version": 4
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"app": {
|
102
|
+
"version": 3
|
103
|
+
},
|
104
|
+
"description": "App V3, Proof V4 offset timestamp",
|
105
|
+
"expect": "fail",
|
106
|
+
"nonce": {
|
107
|
+
"offset_minutes": -12
|
108
|
+
},
|
109
|
+
"proof": {
|
110
|
+
"version": 4
|
111
|
+
},
|
112
|
+
"spec_version": 4
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"app": {
|
116
|
+
"version": 4
|
117
|
+
},
|
118
|
+
"description": "App V4, Proof V4 offset timestamp",
|
119
|
+
"expect": "fail",
|
120
|
+
"nonce": {
|
121
|
+
"offset_minutes": -12
|
122
|
+
},
|
123
|
+
"proof": {
|
124
|
+
"version": 4
|
125
|
+
},
|
126
|
+
"spec_version": 4
|
127
|
+
},
|
128
|
+
{
|
129
|
+
"app": {
|
130
|
+
"config": {
|
131
|
+
"fuzz": 300
|
132
|
+
},
|
133
|
+
"version": 1
|
134
|
+
},
|
135
|
+
"description": "App V1, Proof V2 offset timestamp (custom fuzz)",
|
136
|
+
"expect": "fail",
|
137
|
+
"nonce": {
|
138
|
+
"offset_minutes": -7
|
139
|
+
},
|
140
|
+
"proof": {
|
141
|
+
"version": 2
|
142
|
+
},
|
143
|
+
"spec_version": 4
|
144
|
+
},
|
145
|
+
{
|
146
|
+
"app": {
|
147
|
+
"config": {
|
148
|
+
"fuzz": 300
|
149
|
+
},
|
150
|
+
"version": 1
|
151
|
+
},
|
152
|
+
"description": "App V1, Proof V3 offset timestamp (custom fuzz)",
|
153
|
+
"expect": "fail",
|
154
|
+
"nonce": {
|
155
|
+
"offset_minutes": -7
|
156
|
+
},
|
157
|
+
"proof": {
|
158
|
+
"version": 3
|
159
|
+
},
|
160
|
+
"spec_version": 4
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"app": {
|
164
|
+
"config": {
|
165
|
+
"fuzz": 300
|
166
|
+
},
|
167
|
+
"version": 1
|
168
|
+
},
|
169
|
+
"description": "App V1, Proof V4 offset timestamp (custom fuzz)",
|
170
|
+
"expect": "fail",
|
171
|
+
"nonce": {
|
172
|
+
"offset_minutes": -7
|
173
|
+
},
|
174
|
+
"proof": {
|
175
|
+
"version": 4
|
176
|
+
},
|
177
|
+
"spec_version": 4
|
178
|
+
},
|
179
|
+
{
|
180
|
+
"app": {
|
181
|
+
"config": {
|
182
|
+
"fuzz": 300
|
183
|
+
},
|
184
|
+
"version": 2
|
185
|
+
},
|
186
|
+
"description": "App V2, Proof V2 offset timestamp (custom fuzz)",
|
187
|
+
"expect": "fail",
|
188
|
+
"nonce": {
|
189
|
+
"offset_minutes": -7
|
190
|
+
},
|
191
|
+
"proof": {
|
192
|
+
"version": 2
|
193
|
+
},
|
194
|
+
"spec_version": 4
|
195
|
+
},
|
196
|
+
{
|
197
|
+
"app": {
|
198
|
+
"config": {
|
199
|
+
"fuzz": 300
|
200
|
+
},
|
201
|
+
"version": 2
|
202
|
+
},
|
203
|
+
"description": "App V2, Proof V3 offset timestamp (custom fuzz)",
|
204
|
+
"expect": "fail",
|
205
|
+
"nonce": {
|
206
|
+
"offset_minutes": -7
|
207
|
+
},
|
208
|
+
"proof": {
|
209
|
+
"version": 3
|
210
|
+
},
|
211
|
+
"spec_version": 4
|
212
|
+
},
|
213
|
+
{
|
214
|
+
"app": {
|
215
|
+
"config": {
|
216
|
+
"fuzz": 300
|
217
|
+
},
|
218
|
+
"version": 2
|
219
|
+
},
|
220
|
+
"description": "App V2, Proof V4 offset timestamp (custom fuzz)",
|
221
|
+
"expect": "fail",
|
222
|
+
"nonce": {
|
223
|
+
"offset_minutes": -7
|
224
|
+
},
|
225
|
+
"proof": {
|
226
|
+
"version": 4
|
227
|
+
},
|
228
|
+
"spec_version": 4
|
229
|
+
},
|
230
|
+
{
|
231
|
+
"app": {
|
232
|
+
"config": {
|
233
|
+
"fuzz": 300
|
234
|
+
},
|
235
|
+
"version": 3
|
236
|
+
},
|
237
|
+
"description": "App V3, Proof V3 offset timestamp (custom fuzz)",
|
238
|
+
"expect": "fail",
|
239
|
+
"nonce": {
|
240
|
+
"offset_minutes": -7
|
241
|
+
},
|
242
|
+
"proof": {
|
243
|
+
"version": 3
|
244
|
+
},
|
245
|
+
"spec_version": 4
|
246
|
+
},
|
247
|
+
{
|
248
|
+
"app": {
|
249
|
+
"config": {
|
250
|
+
"fuzz": 300
|
251
|
+
},
|
252
|
+
"version": 3
|
253
|
+
},
|
254
|
+
"description": "App V3, Proof V4 offset timestamp (custom fuzz)",
|
255
|
+
"expect": "fail",
|
256
|
+
"nonce": {
|
257
|
+
"offset_minutes": -7
|
258
|
+
},
|
259
|
+
"proof": {
|
260
|
+
"version": 4
|
261
|
+
},
|
262
|
+
"spec_version": 4
|
263
|
+
},
|
264
|
+
{
|
265
|
+
"app": {
|
266
|
+
"config": {
|
267
|
+
"fuzz": 300
|
268
|
+
},
|
269
|
+
"version": 4
|
270
|
+
},
|
271
|
+
"description": "App V4, Proof V4 offset timestamp (custom fuzz)",
|
272
|
+
"expect": "fail",
|
273
|
+
"nonce": {
|
274
|
+
"offset_minutes": -7
|
275
|
+
},
|
276
|
+
"proof": {
|
277
|
+
"version": 4
|
278
|
+
},
|
279
|
+
"spec_version": 4
|
280
|
+
},
|
281
|
+
{
|
282
|
+
"app": {
|
283
|
+
"version": 1
|
284
|
+
},
|
285
|
+
"description": "App V1, Proof V1, Empty Nonce",
|
286
|
+
"expect": "fail",
|
287
|
+
"nonce": {
|
288
|
+
"empty": true
|
289
|
+
},
|
290
|
+
"proof": {
|
291
|
+
"version": 1
|
292
|
+
},
|
293
|
+
"spec_version": 4
|
294
|
+
},
|
295
|
+
{
|
296
|
+
"app": {
|
297
|
+
"version": 1
|
298
|
+
},
|
299
|
+
"description": "App V1, Proof V1, bad padlock",
|
300
|
+
"expect": "fail",
|
301
|
+
"nonce": {
|
302
|
+
"value": "n:once"
|
303
|
+
},
|
304
|
+
"proof": {
|
305
|
+
"version": 1
|
306
|
+
},
|
307
|
+
"spec_version": 4
|
308
|
+
},
|
309
|
+
{
|
310
|
+
"description": "Proof V2, bad padlock",
|
311
|
+
"expect": "fail",
|
312
|
+
"nonce": {
|
313
|
+
"value": "2006-01-02T15:04:05.333Z"
|
314
|
+
},
|
315
|
+
"proof": {
|
316
|
+
"version": 2
|
317
|
+
},
|
318
|
+
"spec_version": 4
|
319
|
+
},
|
320
|
+
{
|
321
|
+
"description": "Proof V3, bad padlock",
|
322
|
+
"expect": "fail",
|
323
|
+
"nonce": {
|
324
|
+
"value": "2006-01-02T15:04:05.333Z"
|
325
|
+
},
|
326
|
+
"proof": {
|
327
|
+
"version": 3
|
328
|
+
},
|
329
|
+
"spec_version": 4
|
330
|
+
},
|
331
|
+
{
|
332
|
+
"description": "Proof V4, bad padlock",
|
333
|
+
"expect": "fail",
|
334
|
+
"nonce": {
|
335
|
+
"value": "2006-01-02T15:04:05.333Z"
|
336
|
+
},
|
337
|
+
"proof": {
|
338
|
+
"version": 4
|
339
|
+
},
|
340
|
+
"spec_version": 4
|
341
|
+
},
|
342
|
+
{
|
343
|
+
"description": "Proof V2, Non-Timestamp Nonce",
|
344
|
+
"expect": "fail",
|
345
|
+
"nonce": {
|
346
|
+
"value": "nonce"
|
347
|
+
},
|
348
|
+
"proof": {
|
349
|
+
"version": 2
|
350
|
+
},
|
351
|
+
"spec_version": 4
|
352
|
+
},
|
353
|
+
{
|
354
|
+
"description": "Proof V3, Non-Timestamp Nonce",
|
355
|
+
"expect": "fail",
|
356
|
+
"nonce": {
|
357
|
+
"value": "nonce"
|
358
|
+
},
|
359
|
+
"proof": {
|
360
|
+
"version": 3
|
361
|
+
},
|
362
|
+
"spec_version": 4
|
363
|
+
},
|
364
|
+
{
|
365
|
+
"description": "Proof V4, Non-Timestamp Nonce",
|
366
|
+
"expect": "fail",
|
367
|
+
"nonce": {
|
368
|
+
"value": "nonce"
|
369
|
+
},
|
370
|
+
"proof": {
|
371
|
+
"version": 4
|
372
|
+
},
|
373
|
+
"spec_version": 4
|
374
|
+
},
|
375
|
+
{
|
376
|
+
"description": "Proof V1, Incorrect Proof ID",
|
377
|
+
"expect": "fail",
|
378
|
+
"proof": {
|
379
|
+
"id": "00000000-0000-0000-0000-000000000000",
|
380
|
+
"version": 1
|
381
|
+
},
|
382
|
+
"spec_version": 4
|
383
|
+
},
|
384
|
+
{
|
385
|
+
"description": "Proof V2, Incorrect Proof ID",
|
386
|
+
"expect": "fail",
|
387
|
+
"proof": {
|
388
|
+
"id": "00000000-0000-0000-0000-000000000000",
|
389
|
+
"version": 2
|
390
|
+
},
|
391
|
+
"spec_version": 4
|
392
|
+
},
|
393
|
+
{
|
394
|
+
"description": "Proof V3, Incorrect Proof ID",
|
395
|
+
"expect": "fail",
|
396
|
+
"proof": {
|
397
|
+
"id": "00000000-0000-0000-0000-000000000000",
|
398
|
+
"version": 3
|
399
|
+
},
|
400
|
+
"spec_version": 4
|
401
|
+
},
|
402
|
+
{
|
403
|
+
"description": "Proof V4, Incorrect Proof ID",
|
404
|
+
"expect": "fail",
|
405
|
+
"proof": {
|
406
|
+
"id": "00000000-0000-0000-0000-000000000000",
|
407
|
+
"version": 4
|
408
|
+
},
|
409
|
+
"spec_version": 4
|
410
|
+
},
|
411
|
+
{
|
412
|
+
"description": "Proof V1, Incorrect Proof Secret",
|
413
|
+
"expect": "fail",
|
414
|
+
"proof": {
|
415
|
+
"secret": "myvoiceismypassword",
|
416
|
+
"version": 1
|
417
|
+
},
|
418
|
+
"spec_version": 4
|
419
|
+
},
|
420
|
+
{
|
421
|
+
"description": "Proof V2, Incorrect Proof Secret",
|
422
|
+
"expect": "fail",
|
423
|
+
"proof": {
|
424
|
+
"secret": "myvoiceismypassword",
|
425
|
+
"version": 2
|
426
|
+
},
|
427
|
+
"spec_version": 4
|
428
|
+
},
|
429
|
+
{
|
430
|
+
"description": "Proof V3, Incorrect Proof Secret",
|
431
|
+
"expect": "fail",
|
432
|
+
"proof": {
|
433
|
+
"secret": "myvoiceismypassword",
|
434
|
+
"version": 3
|
435
|
+
},
|
436
|
+
"spec_version": 4
|
437
|
+
},
|
438
|
+
{
|
439
|
+
"description": "Proof V4, Incorrect Proof Secret",
|
440
|
+
"expect": "fail",
|
441
|
+
"proof": {
|
442
|
+
"secret": "myvoiceismypassword",
|
443
|
+
"version": 4
|
444
|
+
},
|
445
|
+
"spec_version": 4
|
446
|
+
},
|
447
|
+
{
|
448
|
+
"description": "Proof V1, Mismatched Padlock",
|
449
|
+
"expect": "fail",
|
450
|
+
"padlock": {
|
451
|
+
"nonce": "bad padlock"
|
452
|
+
},
|
453
|
+
"proof": {
|
454
|
+
"version": 1
|
455
|
+
},
|
456
|
+
"spec_version": 4
|
457
|
+
},
|
458
|
+
{
|
459
|
+
"description": "Proof V2, Mismatched Padlock",
|
460
|
+
"expect": "fail",
|
461
|
+
"padlock": {
|
462
|
+
"nonce": "bad padlock"
|
463
|
+
},
|
464
|
+
"proof": {
|
465
|
+
"version": 2
|
466
|
+
},
|
467
|
+
"spec_version": 4
|
468
|
+
},
|
469
|
+
{
|
470
|
+
"description": "Proof V3, Mismatched Padlock",
|
471
|
+
"expect": "fail",
|
472
|
+
"padlock": {
|
473
|
+
"nonce": "bad padlock"
|
474
|
+
},
|
475
|
+
"proof": {
|
476
|
+
"version": 3
|
477
|
+
},
|
478
|
+
"spec_version": 4
|
479
|
+
},
|
480
|
+
{
|
481
|
+
"description": "Proof V4, Mismatched Padlock",
|
482
|
+
"expect": "fail",
|
483
|
+
"padlock": {
|
484
|
+
"nonce": "bad padlock"
|
485
|
+
},
|
486
|
+
"proof": {
|
487
|
+
"version": 4
|
488
|
+
},
|
489
|
+
"spec_version": 4
|
490
|
+
}
|
491
|
+
]
|
@@ -0,0 +1,204 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AppIdentity::Suite::Program # :nodoc:
|
4
|
+
class << self
|
5
|
+
private :new
|
6
|
+
|
7
|
+
def run(name:) # :nodoc:
|
8
|
+
new(name).parse_and_run
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
COMMANDS = {
|
13
|
+
"generate" => "Generates an integration test suite",
|
14
|
+
"run" => "Runs one or more integration suites",
|
15
|
+
"help" => "Display help for a command"
|
16
|
+
}
|
17
|
+
|
18
|
+
def initialize(name)
|
19
|
+
@name = name
|
20
|
+
@default_suite = "#{@name}.json"
|
21
|
+
@command = nil
|
22
|
+
@main = nil
|
23
|
+
|
24
|
+
@parsers = {
|
25
|
+
"generate" => generate_parser,
|
26
|
+
"help" => help_parser,
|
27
|
+
"main" => main_parser,
|
28
|
+
"run" => run_parser
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def parse_and_run
|
33
|
+
parse(main_parser)
|
34
|
+
return main_parser.educate if ARGV.empty?
|
35
|
+
|
36
|
+
@command = ARGV.shift
|
37
|
+
unknown_command!(main_parser)
|
38
|
+
__send__(:"#{@command}")
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def generate
|
44
|
+
AppIdentity::Suite::Generator.run(ARGV, parse(generate_parser)
|
45
|
+
.merge({default_suite: @default_suite}))
|
46
|
+
end
|
47
|
+
|
48
|
+
def run
|
49
|
+
AppIdentity::Suite::Runner.run(ARGV, parse(run_parser))
|
50
|
+
end
|
51
|
+
|
52
|
+
def help
|
53
|
+
parse(help_parser)
|
54
|
+
return help_parser.educate if ARGV.empty?
|
55
|
+
|
56
|
+
@command = ARGV.shift
|
57
|
+
unknown_command!(help_parser)
|
58
|
+
|
59
|
+
@parsers[@command].educate
|
60
|
+
end
|
61
|
+
|
62
|
+
def unknown_command!(parser)
|
63
|
+
parser.die "unknown command #{@command.inspect}" unless COMMANDS.key?(@command)
|
64
|
+
end
|
65
|
+
|
66
|
+
def parse(parser)
|
67
|
+
Optimist.with_standard_exception_handling(parser) do
|
68
|
+
parser.parse ARGV
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def main_parser
|
75
|
+
@main_parser ||= begin
|
76
|
+
name = @name
|
77
|
+
Optimist::Parser.new do
|
78
|
+
version "#{name} #{AppIdentity::VERSION}"
|
79
|
+
usage "Usage: #{name} [options] [command]"
|
80
|
+
|
81
|
+
synopsis "Generates or runs App Identity integration tests suites in Ruby"
|
82
|
+
|
83
|
+
banner usage
|
84
|
+
banner ""
|
85
|
+
banner <<~BANNER
|
86
|
+
#{synopsis}
|
87
|
+
|
88
|
+
Options:
|
89
|
+
BANNER
|
90
|
+
|
91
|
+
opt :version, "Display the version number", short: "V"
|
92
|
+
opt :help, "Display help", short: "h"
|
93
|
+
|
94
|
+
banner ""
|
95
|
+
banner "Commands:"
|
96
|
+
|
97
|
+
COMMANDS.each { |cmd, desc| banner format(" %-15s %s", cmd, desc) }
|
98
|
+
|
99
|
+
educate_on_error
|
100
|
+
stop_on COMMANDS.keys
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def help_parser
|
106
|
+
@help_parser ||= begin
|
107
|
+
name = @name
|
108
|
+
|
109
|
+
Optimist::Parser.new do
|
110
|
+
version "#{name} #{AppIdentity::VERSION}"
|
111
|
+
usage "Usage: #{name} [options] help <command>"
|
112
|
+
|
113
|
+
synopsis "Display help for a command"
|
114
|
+
|
115
|
+
banner usage
|
116
|
+
banner ""
|
117
|
+
banner <<~BANNER
|
118
|
+
#{synopsis}
|
119
|
+
|
120
|
+
Options:
|
121
|
+
BANNER
|
122
|
+
|
123
|
+
opt :version, "Display the version number", short: "V"
|
124
|
+
opt :help, "Display help", short: "h"
|
125
|
+
|
126
|
+
banner ""
|
127
|
+
banner "Commands:"
|
128
|
+
|
129
|
+
COMMANDS.each { |cmd, desc| banner format(" %-15s %s", cmd, desc) }
|
130
|
+
|
131
|
+
educate_on_error
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def generate_parser
|
137
|
+
@generate_parser ||= begin
|
138
|
+
name = @name
|
139
|
+
default_suite = @default_suite
|
140
|
+
|
141
|
+
Optimist::Parser.new do
|
142
|
+
version "#{name} #{AppIdentity::VERSION}"
|
143
|
+
usage "Usage: #{name} generate [options] [suite]"
|
144
|
+
|
145
|
+
synopsis <<~SYNOPSIS
|
146
|
+
Generates an integration test suite JSON file, defaulting to
|
147
|
+
"#{default_suite}".
|
148
|
+
SYNOPSIS
|
149
|
+
|
150
|
+
banner usage
|
151
|
+
banner ""
|
152
|
+
banner <<~BANNER
|
153
|
+
#{synopsis}
|
154
|
+
|
155
|
+
Options for generate:
|
156
|
+
BANNER
|
157
|
+
|
158
|
+
opt :stdout, "Prints the suite to standard output instead of saving it", short: :none
|
159
|
+
opt :quiet, "Silences diagnostic messages", short: "q"
|
160
|
+
|
161
|
+
banner <<~BANNER
|
162
|
+
|
163
|
+
Global Options:
|
164
|
+
BANNER
|
165
|
+
opt :version, "Display the version number", short: "V"
|
166
|
+
opt :help, "Display help", short: "h"
|
167
|
+
|
168
|
+
educate_on_error
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def run_parser
|
174
|
+
@run_parser ||= begin
|
175
|
+
name = @name
|
176
|
+
|
177
|
+
Optimist::Parser.new do
|
178
|
+
version "#{name} #{AppIdentity::VERSION}"
|
179
|
+
usage "Usage: #{name} run [options] [paths...]"
|
180
|
+
|
181
|
+
synopsis "Runs one or more integration suites"
|
182
|
+
|
183
|
+
banner usage
|
184
|
+
banner ""
|
185
|
+
banner <<~BANNER
|
186
|
+
#{synopsis}
|
187
|
+
|
188
|
+
Options for run:
|
189
|
+
BANNER
|
190
|
+
|
191
|
+
opt :strict, "Runs in strict mode; optional tests will cause failure", short: "S"
|
192
|
+
opt :stdin, "Reads a suite from stdin", short: :none
|
193
|
+
opt :diagnostic, "Enables output diagnostics", short: "D"
|
194
|
+
|
195
|
+
banner ""
|
196
|
+
banner "Global Options:"
|
197
|
+
opt :version, "Display the version number", short: "V"
|
198
|
+
opt :help, "Display help", short: "h"
|
199
|
+
|
200
|
+
educate_on_error
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|