hammer_cli 0.0.18 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -314
  3. data/bin/hammer +45 -6
  4. data/config/cli.modules.d/module_config_template.yml +4 -0
  5. data/config/cli_config.template.yml +9 -11
  6. data/doc/developer_docs.md +1 -0
  7. data/doc/i18n.md +85 -0
  8. data/doc/installation.md +321 -0
  9. data/lib/hammer_cli.rb +3 -0
  10. data/lib/hammer_cli/abstract.rb +15 -24
  11. data/lib/hammer_cli/apipie/command.rb +13 -7
  12. data/lib/hammer_cli/apipie/options.rb +14 -16
  13. data/lib/hammer_cli/apipie/read_command.rb +6 -1
  14. data/lib/hammer_cli/apipie/resource.rb +48 -58
  15. data/lib/hammer_cli/apipie/write_command.rb +5 -1
  16. data/lib/hammer_cli/completer.rb +77 -21
  17. data/lib/hammer_cli/connection.rb +44 -0
  18. data/lib/hammer_cli/exception_handler.rb +15 -4
  19. data/lib/hammer_cli/exceptions.rb +6 -0
  20. data/lib/hammer_cli/i18n.rb +95 -0
  21. data/lib/hammer_cli/logger.rb +3 -3
  22. data/lib/hammer_cli/main.rb +12 -11
  23. data/lib/hammer_cli/modules.rb +19 -6
  24. data/lib/hammer_cli/options/normalizers.rb +42 -7
  25. data/lib/hammer_cli/options/option_definition.rb +2 -2
  26. data/lib/hammer_cli/output.rb +1 -0
  27. data/lib/hammer_cli/output/adapter/abstract.rb +20 -0
  28. data/lib/hammer_cli/output/adapter/base.rb +49 -78
  29. data/lib/hammer_cli/output/adapter/csv.rb +5 -5
  30. data/lib/hammer_cli/output/adapter/table.rb +41 -10
  31. data/lib/hammer_cli/output/dsl.rb +1 -1
  32. data/lib/hammer_cli/output/field_filter.rb +21 -0
  33. data/lib/hammer_cli/output/fields.rb +44 -78
  34. data/lib/hammer_cli/output/formatters.rb +38 -0
  35. data/lib/hammer_cli/settings.rb +28 -6
  36. data/lib/hammer_cli/shell.rb +58 -57
  37. data/lib/hammer_cli/utils.rb +14 -0
  38. data/lib/hammer_cli/validator.rb +5 -5
  39. data/lib/hammer_cli/version.rb +1 -1
  40. data/locale/Makefile +64 -0
  41. data/locale/hammer-cli.pot +203 -0
  42. data/locale/zanata.xml +29 -0
  43. data/test/unit/apipie/command_test.rb +42 -25
  44. data/test/unit/apipie/read_command_test.rb +10 -7
  45. data/test/unit/apipie/write_command_test.rb +9 -8
  46. data/test/unit/completer_test.rb +206 -21
  47. data/test/unit/connection_test.rb +68 -0
  48. data/test/unit/fixtures/apipie/architectures.json +153 -0
  49. data/test/unit/fixtures/apipie/documented.json +79 -0
  50. data/test/unit/fixtures/json_input/invalid.json +12 -0
  51. data/test/unit/fixtures/json_input/valid.json +12 -0
  52. data/test/unit/history_test.rb +71 -0
  53. data/test/unit/main_test.rb +9 -0
  54. data/test/unit/modules_test.rb +22 -6
  55. data/test/unit/options/field_filter_test.rb +27 -0
  56. data/test/unit/options/normalizers_test.rb +53 -0
  57. data/test/unit/output/adapter/base_test.rb +162 -10
  58. data/test/unit/output/adapter/csv_test.rb +16 -3
  59. data/test/unit/output/adapter/table_test.rb +97 -13
  60. data/test/unit/output/dsl_test.rb +74 -6
  61. data/test/unit/output/fields_test.rb +93 -62
  62. data/test/unit/output/formatters_test.rb +47 -0
  63. data/test/unit/settings_test.rb +35 -4
  64. data/test/unit/utils_test.rb +45 -0
  65. metadata +85 -4
  66. data/test/unit/apipie/fake_api.rb +0 -101
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: 0.0.18
4
+ version: 0.1.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: 2014-01-29 00:00:00.000000000 Z
12
+ date: 2014-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp
@@ -95,6 +95,48 @@ dependencies:
95
95
  - - '>='
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: fast_gettext
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: locale
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - <=
117
+ - !ruby/object:Gem::Version
118
+ version: 2.0.9
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - <=
124
+ - !ruby/object:Gem::Version
125
+ version: 2.0.9
126
+ - !ruby/object:Gem::Dependency
127
+ name: json
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :runtime
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
98
140
  - !ruby/object:Gem::Dependency
99
141
  name: fastercsv
100
142
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +165,20 @@ dependencies:
123
165
  - - ~>
124
166
  - !ruby/object:Gem::Version
125
167
  version: '1.0'
168
+ - !ruby/object:Gem::Dependency
169
+ name: apipie-bindings
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - '>='
173
+ - !ruby/object:Gem::Version
174
+ version: 0.0.6
175
+ type: :runtime
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - '>='
180
+ - !ruby/object:Gem::Version
181
+ version: 0.0.6
126
182
  description: |
127
183
  Hammer cli provides universal extendable CLI interface for ruby apps
128
184
  email: mbacovsk@redhat.com
@@ -135,13 +191,18 @@ extra_rdoc_files:
135
191
  - doc/developer_docs.md
136
192
  - doc/creating_commands.md
137
193
  - doc/option_normalizers.md
194
+ - doc/installation.md
138
195
  - doc/design.png
139
196
  - doc/design.uml
140
197
  - doc/writing_a_plugin.md
198
+ - doc/i18n.md
141
199
  - config/cli_config.template.yml
200
+ - config/cli.modules.d/module_config_template.yml
142
201
  - README.md
143
202
  files:
203
+ - lib/hammer_cli/connection.rb
144
204
  - lib/hammer_cli/logger_watch.rb
205
+ - lib/hammer_cli/i18n.rb
145
206
  - lib/hammer_cli/apipie/write_command.rb
146
207
  - lib/hammer_cli/apipie/resource.rb
147
208
  - lib/hammer_cli/apipie/read_command.rb
@@ -149,6 +210,7 @@ files:
149
210
  - lib/hammer_cli/apipie/command.rb
150
211
  - lib/hammer_cli/logger.rb
151
212
  - lib/hammer_cli/messages.rb
213
+ - lib/hammer_cli/exceptions.rb
152
214
  - lib/hammer_cli/abstract.rb
153
215
  - lib/hammer_cli/apipie.rb
154
216
  - lib/hammer_cli/version.rb
@@ -169,6 +231,7 @@ files:
169
231
  - lib/hammer_cli/output/output.rb
170
232
  - lib/hammer_cli/output/fields.rb
171
233
  - lib/hammer_cli/output/record_collection.rb
234
+ - lib/hammer_cli/output/field_filter.rb
172
235
  - lib/hammer_cli/options/option_definition.rb
173
236
  - lib/hammer_cli/options/normalizers.rb
174
237
  - lib/hammer_cli/completer.rb
@@ -177,11 +240,15 @@ files:
177
240
  - lib/hammer_cli/exit_codes.rb
178
241
  - lib/hammer_cli/main.rb
179
242
  - lib/hammer_cli.rb
243
+ - test/unit/fixtures/apipie/documented.json
244
+ - test/unit/fixtures/apipie/architectures.json
245
+ - test/unit/fixtures/json_input/valid.json
246
+ - test/unit/fixtures/json_input/invalid.json
180
247
  - test/unit/apipie/command_test.rb
181
248
  - test/unit/apipie/write_command_test.rb
182
- - test/unit/apipie/fake_api.rb
183
249
  - test/unit/apipie/read_command_test.rb
184
250
  - test/unit/validator_test.rb
251
+ - test/unit/history_test.rb
185
252
  - test/unit/completer_test.rb
186
253
  - test/unit/utils_test.rb
187
254
  - test/unit/exception_handler_test.rb
@@ -201,6 +268,8 @@ files:
201
268
  - test/unit/output/record_collection_test.rb
202
269
  - test/unit/options/option_definition_test.rb
203
270
  - test/unit/options/normalizers_test.rb
271
+ - test/unit/options/field_filter_test.rb
272
+ - test/unit/connection_test.rb
204
273
  - test/unit/settings_test.rb
205
274
  - bin/hammer
206
275
  - doc/creating_apipie_commands.md
@@ -208,10 +277,16 @@ files:
208
277
  - doc/developer_docs.md
209
278
  - doc/creating_commands.md
210
279
  - doc/option_normalizers.md
280
+ - doc/installation.md
211
281
  - doc/design.png
212
282
  - doc/design.uml
213
283
  - doc/writing_a_plugin.md
284
+ - doc/i18n.md
214
285
  - config/cli_config.template.yml
286
+ - config/cli.modules.d/module_config_template.yml
287
+ - locale/zanata.xml
288
+ - locale/hammer-cli.pot
289
+ - locale/Makefile
215
290
  - LICENSE
216
291
  - README.md
217
292
  - hammer_cli_complete
@@ -240,11 +315,15 @@ signing_key:
240
315
  specification_version: 4
241
316
  summary: Universal command-line interface
242
317
  test_files:
318
+ - test/unit/fixtures/apipie/documented.json
319
+ - test/unit/fixtures/apipie/architectures.json
320
+ - test/unit/fixtures/json_input/valid.json
321
+ - test/unit/fixtures/json_input/invalid.json
243
322
  - test/unit/apipie/command_test.rb
244
323
  - test/unit/apipie/write_command_test.rb
245
- - test/unit/apipie/fake_api.rb
246
324
  - test/unit/apipie/read_command_test.rb
247
325
  - test/unit/validator_test.rb
326
+ - test/unit/history_test.rb
248
327
  - test/unit/completer_test.rb
249
328
  - test/unit/utils_test.rb
250
329
  - test/unit/exception_handler_test.rb
@@ -264,5 +343,7 @@ test_files:
264
343
  - test/unit/output/record_collection_test.rb
265
344
  - test/unit/options/option_definition_test.rb
266
345
  - test/unit/options/normalizers_test.rb
346
+ - test/unit/options/field_filter_test.rb
347
+ - test/unit/connection_test.rb
267
348
  - test/unit/settings_test.rb
268
349
  has_rdoc:
@@ -1,101 +0,0 @@
1
- module FakeApi
2
- module Resources
3
- class Architecture
4
- def initialize(attrs=nil)
5
- end
6
- def self.doc
7
- {
8
- "name"=>"Architecture",
9
- "methods"=>[
10
- {
11
- "name"=>"some_action",
12
- "examples"=>[],
13
- "errors"=>[],
14
- "params"=>[]
15
- }
16
- ]
17
- }
18
- end
19
- end
20
- class CamelCaseName
21
- def initialize(attrs=nil)
22
- end
23
-
24
- def self.doc
25
- {
26
- "name"=>"CamelCaseName",
27
- "methods"=>[]
28
- }
29
- end
30
- end
31
- class Documented
32
- def initialize(attrs=nil)
33
- end
34
-
35
- def self.doc
36
- {
37
- "name"=>"Documented",
38
- "api_url"=>"/api",
39
- "version"=>"v2",
40
- "short_description"=>nil,
41
- "full_description"=>nil,
42
- "doc_url"=>"/apidoc/v2/documented",
43
- "methods"=>[
44
- {
45
- "name"=>"index",
46
- "examples"=>[],
47
- "errors"=>[],
48
- "params"=>
49
- [{"allow_nil"=>false,
50
- "name"=>"se_arch_val-ue",
51
- "full_name"=>"se_arch_val-ue_full_name",
52
- "validator"=>"Must be String",
53
- "description"=>"<p>filter results</p>",
54
- "expected_type"=>"string",
55
- "required"=>false}],
56
- "full_description"=>""},
57
- {
58
-
59
- "name"=>"create",
60
- "examples"=>[],
61
- "errors"=>[],
62
- "params"=>
63
- [{"allow_nil"=>false,
64
- "name"=>"documented",
65
- "full_name"=>"documented",
66
- "validator"=>"Must be a Hash",
67
- "description"=>"",
68
- "expected_type"=>"hash",
69
- "required"=>true,
70
- "params"=>
71
- [{"name"=>"name",
72
- "allow_nil"=>false,
73
- "full_name"=>"documented[name]",
74
- "validator"=>"Must be String",
75
- "expected_type"=>"string",
76
- "description"=>"",
77
- "required"=>false},
78
- {"name"=>"provider",
79
- "allow_nil"=>false,
80
- "full_name"=>"documented[provider]",
81
- "validator"=>"Must be String",
82
- "expected_type"=>"string",
83
- "description"=>
84
- "<p>Providers include Libvirt, Ovirt, EC2, Vmware, Openstack, Rackspace</p>",
85
- "required"=>false},
86
- {"name"=>"array_param",
87
- "allow_nil"=>false,
88
- "full_name"=>"documented[array_param]",
89
- "validator"=>"Must be Array",
90
- "expected_type"=>"string",
91
- "description"=>"",
92
- "required"=>true},]
93
- }],
94
- "full_description"=>""
95
- }
96
- ]
97
- }
98
- end
99
- end
100
- end
101
- end