hammer_cli 3.7.0 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/hammer +1 -6
- data/doc/release_notes.md +15 -0
- data/lib/hammer_cli/help/builder.rb +1 -2
- data/lib/hammer_cli/i18n/find_task.rb +88 -0
- data/lib/hammer_cli/i18n.rb +4 -0
- data/lib/hammer_cli/options/normalizers.rb +2 -5
- data/lib/hammer_cli/settings.rb +7 -0
- data/lib/hammer_cli/task_helper.rb +84 -0
- data/lib/hammer_cli/testing/output_matchers.rb +1 -1
- data/lib/hammer_cli/utils.rb +1 -1
- data/lib/hammer_cli/version.rb +1 -1
- data/locale/Makefile.def +29 -7
- data/locale/ca/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/cs_CZ/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/de/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/en/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/en_GB/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/es/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/fr/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/it/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ja/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ka/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ko/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ru/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/zh_CN/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/hammer-cli.mo +0 -0
- data/man/hammer.1.gz +0 -0
- data/test/functional/help_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/unit/abstract_test.rb +54 -54
- data/test/unit/apipie/command_test.rb +26 -27
- data/test/unit/apipie/option_builder_test.rb +28 -28
- data/test/unit/apipie/option_definition_test.rb +5 -5
- data/test/unit/apipie/test_helper.rb +3 -0
- data/test/unit/bash_test.rb +21 -21
- data/test/unit/command_extensions_test.rb +68 -68
- data/test/unit/completer_test.rb +57 -57
- data/test/unit/csv_parser_test.rb +12 -12
- data/test/unit/defaults_test.rb +3 -3
- data/test/unit/help/builder_test.rb +7 -7
- data/test/unit/help/definition/abstract_item_test.rb +2 -2
- data/test/unit/help/definition/list_test.rb +2 -2
- data/test/unit/help/definition/note_test.rb +2 -2
- data/test/unit/help/definition/section_test.rb +2 -2
- data/test/unit/help/definition/text_test.rb +2 -2
- data/test/unit/help/definition_test.rb +36 -36
- data/test/unit/help/text_builder_test.rb +39 -39
- data/test/unit/history_test.rb +6 -6
- data/test/unit/i18n_test.rb +2 -2
- data/test/unit/logger_test.rb +1 -1
- data/test/unit/main_test.rb +7 -7
- data/test/unit/modules_test.rb +24 -25
- data/test/unit/option_builder_test.rb +1 -1
- data/test/unit/options/matcher_test.rb +15 -15
- data/test/unit/options/normalizers_test.rb +92 -88
- data/test/unit/options/option_definition_test.rb +11 -11
- data/test/unit/options/option_family_test.rb +7 -7
- data/test/unit/options/validators/dsl_test.rb +35 -35
- data/test/unit/output/adapter/abstract_test.rb +10 -10
- data/test/unit/output/adapter/base_test.rb +36 -36
- data/test/unit/output/adapter/csv_test.rb +38 -38
- data/test/unit/output/adapter/json_test.rb +38 -38
- data/test/unit/output/adapter/table_test.rb +42 -50
- data/test/unit/output/adapter/yaml_test.rb +38 -38
- data/test/unit/output/definition_test.rb +43 -43
- data/test/unit/output/dsl_test.rb +19 -19
- data/test/unit/output/field_filter_test.rb +10 -10
- data/test/unit/output/fields_test.rb +27 -27
- data/test/unit/output/formatters_test.rb +39 -39
- data/test/unit/output/output_test.rb +14 -14
- data/test/unit/output/record_collection_test.rb +18 -18
- data/test/unit/settings_test.rb +35 -35
- data/test/unit/utils_test.rb +30 -27
- metadata +33 -44
data/test/unit/utils_test.rb
CHANGED
@@ -16,33 +16,36 @@ describe String do
|
|
16
16
|
let(:str_with_percent) { 'Error: AA%<a>s BB%<b>s <%# template error %> verify this %>' }
|
17
17
|
|
18
18
|
it 'should not fail without expected parameters' do
|
19
|
-
str.format({}).must_equal 'AA BB'
|
19
|
+
_(str.format({})).must_equal 'AA BB'
|
20
20
|
end
|
21
21
|
it 'should replace positional parameters' do
|
22
|
-
pos_str.format(['A', 'B']).must_equal 'AAA BBB'
|
22
|
+
_(pos_str.format(['A', 'B'])).must_equal 'AAA BBB'
|
23
23
|
end
|
24
24
|
it 'should replace named parameters' do
|
25
|
-
str.format(:a => 'A', :b => 'B').must_equal 'AAA BBB'
|
25
|
+
_(str.format(:a => 'A', :b => 'B')).must_equal 'AAA BBB'
|
26
26
|
end
|
27
27
|
it 'should replace named parameters with string keys' do
|
28
|
-
str.format('a' => 'A', 'b' => 'B').must_equal 'AAA BBB'
|
28
|
+
_(str.format('a' => 'A', 'b' => 'B')).must_equal 'AAA BBB'
|
29
29
|
end
|
30
30
|
it 'should replace named parameters marked with curly brackets' do
|
31
|
-
curly_str.format(:a => 'A', :b => 'B').must_equal 'AAA BBB'
|
31
|
+
_(curly_str.format(:a => 'A', :b => 'B')).must_equal 'AAA BBB'
|
32
32
|
end
|
33
33
|
it 'should not fail due to presence of percent chars in string' do
|
34
|
-
str_with_percent.format({}).must_equal 'Error: AA BB <%# template error %> verify this %>'
|
34
|
+
_(str_with_percent.format({})).must_equal 'Error: AA BB <%# template error %> verify this %>'
|
35
|
+
end
|
36
|
+
it 'should consider false values' do
|
37
|
+
_(curly_str.format(:a => false, 'b' => false)).must_equal 'AAfalse BBfalse'
|
35
38
|
end
|
36
39
|
end
|
37
40
|
|
38
41
|
context "camelize" do
|
39
42
|
|
40
43
|
it "should camelize string with underscores" do
|
41
|
-
"one_two_three".camelize.must_equal "OneTwoThree"
|
44
|
+
_("one_two_three".camelize).must_equal "OneTwoThree"
|
42
45
|
end
|
43
46
|
|
44
47
|
it "should not camelize string with dashes" do
|
45
|
-
"one-two-three".camelize.must_equal "One-two-three"
|
48
|
+
_("one-two-three".camelize).must_equal "One-two-three"
|
46
49
|
end
|
47
50
|
|
48
51
|
end
|
@@ -51,15 +54,15 @@ describe String do
|
|
51
54
|
describe "underscore" do
|
52
55
|
|
53
56
|
it "converts camelized string to underscore" do
|
54
|
-
"OneTwoThree".underscore.must_equal "one_two_three"
|
57
|
+
_("OneTwoThree".underscore).must_equal "one_two_three"
|
55
58
|
end
|
56
59
|
|
57
60
|
it "converts full class path name to underscore with slashes" do
|
58
|
-
"HammerCLI::SomeClass".underscore.must_equal "hammer_cli/some_class"
|
61
|
+
_("HammerCLI::SomeClass".underscore).must_equal "hammer_cli/some_class"
|
59
62
|
end
|
60
63
|
|
61
64
|
it "converts dashes to underscores" do
|
62
|
-
"Re-Read".underscore.must_equal "re_read"
|
65
|
+
_("Re-Read".underscore).must_equal "re_read"
|
63
66
|
end
|
64
67
|
|
65
68
|
end
|
@@ -67,11 +70,11 @@ describe String do
|
|
67
70
|
describe "indent" do
|
68
71
|
|
69
72
|
it "indents single line string" do
|
70
|
-
"line one".indent_with(" ").must_equal " line one"
|
73
|
+
_("line one".indent_with(" ")).must_equal " line one"
|
71
74
|
end
|
72
75
|
|
73
76
|
it "indents multi line string" do
|
74
|
-
"line one\nline two".indent_with(" ").must_equal " line one\n line two"
|
77
|
+
_("line one\nline two".indent_with(" ")).must_equal " line one\n line two"
|
75
78
|
end
|
76
79
|
|
77
80
|
end
|
@@ -79,23 +82,23 @@ describe String do
|
|
79
82
|
describe "constantize" do
|
80
83
|
|
81
84
|
it "raises NameError for empty string" do
|
82
|
-
|
85
|
+
_{
|
83
86
|
"".constantize
|
84
87
|
}.must_raise NameError
|
85
88
|
end
|
86
89
|
|
87
90
|
it "raises NameError for unknown constant" do
|
88
|
-
|
91
|
+
_{
|
89
92
|
"UnknownClass".constantize
|
90
93
|
}.must_raise NameError
|
91
94
|
end
|
92
95
|
|
93
96
|
it "returns correct constant" do
|
94
|
-
"Object".constantize.must_equal Object
|
97
|
+
_("Object".constantize).must_equal Object
|
95
98
|
end
|
96
99
|
|
97
100
|
it "returns correct namespaced constant" do
|
98
|
-
"Constant::Test::X".constantize.must_equal Constant::Test::X
|
101
|
+
_("Constant::Test::X".constantize).must_equal Constant::Test::X
|
99
102
|
end
|
100
103
|
end
|
101
104
|
|
@@ -103,11 +106,11 @@ end
|
|
103
106
|
|
104
107
|
describe Hash do
|
105
108
|
context 'transform_keys' do
|
106
|
-
let(:
|
109
|
+
let(:original_hash) { { :one => 'one', :two => 'two', 'three' => 3 } }
|
107
110
|
let(:transformed_hash) { { :ONE => 'one', :TWO => 'two', 'THREE' => 3 } }
|
108
111
|
it 'should return a new hash with new keys' do
|
109
|
-
new_hash =
|
110
|
-
new_hash.must_equal transformed_hash
|
112
|
+
new_hash = original_hash.transform_keys(&:upcase)
|
113
|
+
_(new_hash).must_equal transformed_hash
|
111
114
|
end
|
112
115
|
end
|
113
116
|
end
|
@@ -129,21 +132,21 @@ describe HammerCLI do
|
|
129
132
|
HammerCLI::Settings.load({
|
130
133
|
:ui => { :interactive => nil },
|
131
134
|
:_params => { :interactive => nil } })
|
132
|
-
HammerCLI::interactive
|
135
|
+
_(HammerCLI::interactive?).must_equal true
|
133
136
|
end
|
134
137
|
|
135
138
|
it "should by false when cli arg set" do
|
136
139
|
HammerCLI::Settings.load({
|
137
140
|
:ui => { :interactive => nil },
|
138
141
|
:_params => { :interactive => false } })
|
139
|
-
HammerCLI::interactive
|
142
|
+
_(HammerCLI::interactive?).must_equal false
|
140
143
|
end
|
141
144
|
|
142
145
|
it "should by false when turned off in cfg" do
|
143
146
|
HammerCLI::Settings.load({
|
144
147
|
:ui => { :interactive => false },
|
145
148
|
:_params => { :interactive => nil } })
|
146
|
-
HammerCLI::interactive
|
149
|
+
_(HammerCLI::interactive?).must_equal false
|
147
150
|
end
|
148
151
|
end
|
149
152
|
|
@@ -151,21 +154,21 @@ describe HammerCLI do
|
|
151
154
|
describe "constant_path" do
|
152
155
|
|
153
156
|
it "returns empty array for empty string" do
|
154
|
-
HammerCLI.constant_path("").must_equal []
|
157
|
+
_(HammerCLI.constant_path("")).must_equal []
|
155
158
|
end
|
156
159
|
|
157
160
|
it "raises NameError for unknown constant" do
|
158
|
-
|
161
|
+
_{
|
159
162
|
HammerCLI.constant_path("UnknownClass")
|
160
163
|
}.must_raise NameError
|
161
164
|
end
|
162
165
|
|
163
166
|
it "returns single constant" do
|
164
|
-
HammerCLI.constant_path("Object").must_equal [Object]
|
167
|
+
_(HammerCLI.constant_path("Object")).must_equal [Object]
|
165
168
|
end
|
166
169
|
|
167
170
|
it "returns correct path for namespaced constant" do
|
168
|
-
HammerCLI.constant_path("Constant::Test::X").must_equal [Constant, Constant::Test, Constant::Test::X]
|
171
|
+
_(HammerCLI.constant_path("Constant::Test::X")).must_equal [Constant, Constant::Test, Constant::Test::X]
|
169
172
|
end
|
170
173
|
end
|
171
174
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hammer_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Bačovský
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-08-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clamp
|
@@ -59,20 +59,6 @@ dependencies:
|
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: unicode
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
type: :runtime
|
70
|
-
prerelease: false
|
71
|
-
version_requirements: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
62
|
- !ruby/object:Gem::Dependency
|
77
63
|
name: amazing_print
|
78
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,8 +160,8 @@ extra_rdoc_files:
|
|
174
160
|
- doc/writing_a_plugin.md
|
175
161
|
- doc/release_notes.md
|
176
162
|
- config/cli.modules.d/module_config_template.yml
|
177
|
-
- config/hammer.completion
|
178
163
|
- config/cli_config.template.yml
|
164
|
+
- config/hammer.completion
|
179
165
|
- README.md
|
180
166
|
files:
|
181
167
|
- LICENSE
|
@@ -287,6 +273,7 @@ files:
|
|
287
273
|
- lib/hammer_cli/shell.rb
|
288
274
|
- lib/hammer_cli/ssloptions.rb
|
289
275
|
- lib/hammer_cli/subcommand.rb
|
276
|
+
- lib/hammer_cli/task_helper.rb
|
290
277
|
- lib/hammer_cli/testing/command_assertions.rb
|
291
278
|
- lib/hammer_cli/testing/data_helpers.rb
|
292
279
|
- lib/hammer_cli/testing/messages.rb
|
@@ -296,6 +283,7 @@ files:
|
|
296
283
|
- lib/hammer_cli/version.rb
|
297
284
|
- locale/Makefile.def
|
298
285
|
- locale/ca/LC_MESSAGES/hammer-cli.mo
|
286
|
+
- locale/cs_CZ/LC_MESSAGES/hammer-cli.mo
|
299
287
|
- locale/de/LC_MESSAGES/hammer-cli.mo
|
300
288
|
- locale/en/LC_MESSAGES/hammer-cli.mo
|
301
289
|
- locale/en_GB/LC_MESSAGES/hammer-cli.mo
|
@@ -303,6 +291,7 @@ files:
|
|
303
291
|
- locale/fr/LC_MESSAGES/hammer-cli.mo
|
304
292
|
- locale/it/LC_MESSAGES/hammer-cli.mo
|
305
293
|
- locale/ja/LC_MESSAGES/hammer-cli.mo
|
294
|
+
- locale/ka/LC_MESSAGES/hammer-cli.mo
|
306
295
|
- locale/ko/LC_MESSAGES/hammer-cli.mo
|
307
296
|
- locale/pt_BR/LC_MESSAGES/hammer-cli.mo
|
308
297
|
- locale/ru/LC_MESSAGES/hammer-cli.mo
|
@@ -400,17 +389,25 @@ signing_key:
|
|
400
389
|
specification_version: 4
|
401
390
|
summary: Universal command-line interface
|
402
391
|
test_files:
|
392
|
+
- test/functional/defaults_test.rb
|
393
|
+
- test/functional/help_test.rb
|
403
394
|
- test/functional/nil_values_test.rb
|
404
395
|
- test/functional/test_helper.rb
|
405
|
-
- test/
|
406
|
-
- test/
|
396
|
+
- test/test_helper.rb
|
397
|
+
- test/unit/abstract_test.rb
|
407
398
|
- test/unit/apipie/api_connection_test.rb
|
408
|
-
- test/unit/apipie/option_builder_test.rb
|
409
|
-
- test/unit/apipie/test_helper.rb
|
410
399
|
- test/unit/apipie/command_test.rb
|
400
|
+
- test/unit/apipie/option_builder_test.rb
|
411
401
|
- test/unit/apipie/option_definition_test.rb
|
402
|
+
- test/unit/apipie/test_helper.rb
|
403
|
+
- test/unit/bash_test.rb
|
412
404
|
- test/unit/ca_cert_manager_test.rb
|
405
|
+
- test/unit/command_extensions_test.rb
|
406
|
+
- test/unit/completer_test.rb
|
413
407
|
- test/unit/connection_test.rb
|
408
|
+
- test/unit/csv_parser_test.rb
|
409
|
+
- test/unit/defaults_test.rb
|
410
|
+
- test/unit/exception_handler_test.rb
|
414
411
|
- test/unit/fixtures/apipie/architectures.json
|
415
412
|
- test/unit/fixtures/apipie/documented.json
|
416
413
|
- test/unit/fixtures/certs/ca_cert.pem
|
@@ -419,30 +416,36 @@ test_files:
|
|
419
416
|
- test/unit/fixtures/defaults/defaults_dashed.yml
|
420
417
|
- test/unit/fixtures/json_input/invalid.json
|
421
418
|
- test/unit/fixtures/json_input/valid.json
|
419
|
+
- test/unit/help/builder_test.rb
|
422
420
|
- test/unit/help/definition/abstract_item_test.rb
|
423
421
|
- test/unit/help/definition/list_test.rb
|
424
422
|
- test/unit/help/definition/note_test.rb
|
425
423
|
- test/unit/help/definition/section_test.rb
|
426
424
|
- test/unit/help/definition/text_test.rb
|
427
|
-
- test/unit/help/builder_test.rb
|
428
425
|
- test/unit/help/definition_test.rb
|
429
426
|
- test/unit/help/text_builder_test.rb
|
427
|
+
- test/unit/history_test.rb
|
428
|
+
- test/unit/i18n_test.rb
|
429
|
+
- test/unit/logger_test.rb
|
430
|
+
- test/unit/main_test.rb
|
430
431
|
- test/unit/messages_test.rb
|
432
|
+
- test/unit/modules_test.rb
|
433
|
+
- test/unit/option_builder_test.rb
|
434
|
+
- test/unit/options/matcher_test.rb
|
435
|
+
- test/unit/options/normalizers_test.rb
|
431
436
|
- test/unit/options/option_collector_test.rb
|
437
|
+
- test/unit/options/option_definition_test.rb
|
438
|
+
- test/unit/options/option_family_test.rb
|
432
439
|
- test/unit/options/processor_list_test.rb
|
433
440
|
- test/unit/options/sources/command_line_test.rb
|
434
441
|
- test/unit/options/sources/saved_defaults_test.rb
|
435
442
|
- test/unit/options/validators/dsl_test.rb
|
436
|
-
- test/unit/options/matcher_test.rb
|
437
|
-
- test/unit/options/normalizers_test.rb
|
438
|
-
- test/unit/options/option_family_test.rb
|
439
|
-
- test/unit/options/option_definition_test.rb
|
440
|
-
- test/unit/output/adapter/base_test.rb
|
441
|
-
- test/unit/output/adapter/json_test.rb
|
442
|
-
- test/unit/output/adapter/yaml_test.rb
|
443
443
|
- test/unit/output/adapter/abstract_test.rb
|
444
|
+
- test/unit/output/adapter/base_test.rb
|
444
445
|
- test/unit/output/adapter/csv_test.rb
|
446
|
+
- test/unit/output/adapter/json_test.rb
|
445
447
|
- test/unit/output/adapter/table_test.rb
|
448
|
+
- test/unit/output/adapter/yaml_test.rb
|
446
449
|
- test/unit/output/definition_test.rb
|
447
450
|
- test/unit/output/dsl_test.rb
|
448
451
|
- test/unit/output/field_filter_test.rb
|
@@ -450,20 +453,6 @@ test_files:
|
|
450
453
|
- test/unit/output/formatters_test.rb
|
451
454
|
- test/unit/output/output_test.rb
|
452
455
|
- test/unit/output/record_collection_test.rb
|
453
|
-
- test/unit/test_helper.rb
|
454
|
-
- test/unit/abstract_test.rb
|
455
|
-
- test/unit/command_extensions_test.rb
|
456
|
-
- test/unit/defaults_test.rb
|
457
|
-
- test/unit/i18n_test.rb
|
458
|
-
- test/unit/main_test.rb
|
459
|
-
- test/unit/modules_test.rb
|
460
456
|
- test/unit/settings_test.rb
|
461
|
-
- test/unit/
|
462
|
-
- test/unit/history_test.rb
|
463
|
-
- test/unit/logger_test.rb
|
464
|
-
- test/unit/bash_test.rb
|
465
|
-
- test/unit/completer_test.rb
|
466
|
-
- test/unit/csv_parser_test.rb
|
467
|
-
- test/unit/option_builder_test.rb
|
457
|
+
- test/unit/test_helper.rb
|
468
458
|
- test/unit/utils_test.rb
|
469
|
-
- test/test_helper.rb
|