hammer_cli 3.6.0 → 3.8.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
- data/bin/hammer +1 -6
- data/config/cli_config.template.yml +3 -3
- data/doc/release_notes.md +24 -0
- data/lib/hammer_cli/abstract.rb +1 -1
- data/lib/hammer_cli/defaults_commands.rb +0 -1
- data/lib/hammer_cli/help/builder.rb +7 -8
- data/lib/hammer_cli/i18n/find_task.rb +88 -0
- data/lib/hammer_cli/i18n.rb +4 -0
- data/lib/hammer_cli/logger.rb +2 -2
- data/lib/hammer_cli/modules.rb +1 -1
- data/lib/hammer_cli/options/normalizers.rb +4 -7
- data/lib/hammer_cli/options/validators/dsl.rb +1 -1
- data/lib/hammer_cli/output/adapter/csv.rb +0 -1
- data/lib/hammer_cli/output/dsl.rb +1 -1
- data/lib/hammer_cli/output/fields.rb +1 -1
- data/lib/hammer_cli/output/formatters.rb +4 -4
- data/lib/hammer_cli/settings.rb +7 -0
- data/lib/hammer_cli/ssloptions.rb +3 -3
- data/lib/hammer_cli/subcommand.rb +1 -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 -13
- 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/defaults_test.rb +0 -1
- 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 +27 -28
- data/test/unit/apipie/option_builder_test.rb +28 -28
- data/test/unit/apipie/option_definition_test.rb +6 -6
- 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/exception_handler_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 +8 -8
- data/test/unit/i18n_test.rb +2 -2
- data/test/unit/logger_test.rb +3 -3
- 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 +13 -13
- data/test/unit/options/option_family_test.rb +7 -7
- data/test/unit/options/sources/saved_defaults_test.rb +0 -4
- data/test/unit/options/validators/dsl_test.rb +35 -35
- data/test/unit/output/adapter/abstract_test.rb +13 -13
- data/test/unit/output/adapter/base_test.rb +36 -36
- data/test/unit/output/adapter/csv_test.rb +44 -44
- data/test/unit/output/adapter/json_test.rb +38 -38
- data/test/unit/output/adapter/table_test.rb +47 -55
- 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 +10 -21
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
|
|
@@ -17,20 +17,20 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - ">="
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version:
|
|
20
|
+
version: 1.3.1
|
|
21
21
|
- - "<"
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
|
-
version:
|
|
23
|
+
version: 2.0.0
|
|
24
24
|
type: :runtime
|
|
25
25
|
prerelease: false
|
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
|
27
27
|
requirements:
|
|
28
28
|
- - ">="
|
|
29
29
|
- !ruby/object:Gem::Version
|
|
30
|
-
version:
|
|
30
|
+
version: 1.3.1
|
|
31
31
|
- - "<"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 2.0.0
|
|
34
34
|
- !ruby/object:Gem::Dependency
|
|
35
35
|
name: logging
|
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -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
|
|
@@ -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
|
|
@@ -388,7 +377,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
388
377
|
requirements:
|
|
389
378
|
- - ">="
|
|
390
379
|
- !ruby/object:Gem::Version
|
|
391
|
-
version: '
|
|
380
|
+
version: '2.7'
|
|
392
381
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
393
382
|
requirements:
|
|
394
383
|
- - ">="
|