hammer_cli 0.7.0 → 0.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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/bin/hammer +1 -1
  3. data/doc/release_notes.md +12 -0
  4. data/lib/hammer_cli/defaults.rb +1 -1
  5. data/lib/hammer_cli/defaults_commands.rb +2 -2
  6. data/lib/hammer_cli/i18n.rb +48 -59
  7. data/lib/hammer_cli/options/option_definition.rb +25 -0
  8. data/lib/hammer_cli/output/adapter/table.rb +1 -1
  9. data/lib/hammer_cli/settings.rb +8 -4
  10. data/lib/hammer_cli/version.rb +1 -1
  11. data/locale/ca/LC_MESSAGES/hammer-cli.mo +0 -0
  12. data/locale/ca/hammer-cli.edit.po +54 -31
  13. data/locale/ca/hammer-cli.po +15 -8
  14. data/locale/de/LC_MESSAGES/hammer-cli.mo +0 -0
  15. data/locale/de/hammer-cli.edit.po +72 -49
  16. data/locale/de/hammer-cli.po +15 -8
  17. data/locale/en/LC_MESSAGES/hammer-cli.mo +0 -0
  18. data/locale/en/hammer-cli.edit.po +20 -8
  19. data/locale/en/hammer-cli.po +15 -8
  20. data/locale/en_GB/LC_MESSAGES/hammer-cli.mo +0 -0
  21. data/locale/en_GB/hammer-cli.edit.po +53 -30
  22. data/locale/en_GB/hammer-cli.po +15 -8
  23. data/locale/es/LC_MESSAGES/hammer-cli.mo +0 -0
  24. data/locale/es/hammer-cli.edit.po +83 -60
  25. data/locale/es/hammer-cli.po +15 -8
  26. data/locale/fr/LC_MESSAGES/hammer-cli.mo +0 -0
  27. data/locale/fr/hammer-cli.edit.po +53 -30
  28. data/locale/fr/hammer-cli.po +15 -8
  29. data/locale/hammer-cli.pot +23 -13
  30. data/locale/it/LC_MESSAGES/hammer-cli.mo +0 -0
  31. data/locale/it/hammer-cli.edit.po +53 -30
  32. data/locale/it/hammer-cli.po +15 -8
  33. data/locale/ja/LC_MESSAGES/hammer-cli.mo +0 -0
  34. data/locale/ja/hammer-cli.edit.po +74 -51
  35. data/locale/ja/hammer-cli.po +15 -8
  36. data/locale/ko/LC_MESSAGES/hammer-cli.mo +0 -0
  37. data/locale/ko/hammer-cli.edit.po +77 -54
  38. data/locale/ko/hammer-cli.po +15 -8
  39. data/locale/pt_BR/LC_MESSAGES/hammer-cli.mo +0 -0
  40. data/locale/pt_BR/hammer-cli.edit.po +73 -50
  41. data/locale/pt_BR/hammer-cli.po +15 -8
  42. data/locale/ru/LC_MESSAGES/hammer-cli.mo +0 -0
  43. data/locale/ru/hammer-cli.edit.po +54 -31
  44. data/locale/ru/hammer-cli.po +15 -8
  45. data/locale/zh_CN/LC_MESSAGES/hammer-cli.mo +0 -0
  46. data/locale/zh_CN/hammer-cli.edit.po +76 -53
  47. data/locale/zh_CN/hammer-cli.po +15 -8
  48. data/locale/zh_TW/LC_MESSAGES/hammer-cli.mo +0 -0
  49. data/locale/zh_TW/hammer-cli.edit.po +75 -52
  50. data/locale/zh_TW/hammer-cli.po +15 -8
  51. data/man/hammer.1.gz +0 -0
  52. data/test/functional/defaults_test.rb +1 -1
  53. data/test/unit/apipie/option_builder_test.rb +0 -4
  54. data/test/unit/exception_handler_test.rb +1 -1
  55. data/test/unit/i18n_test.rb +58 -12
  56. data/test/unit/options/option_definition_test.rb +18 -0
  57. metadata +3 -2
@@ -8,8 +8,8 @@ msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: Foreman\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2015-12-08 08:56+0000\n"
12
- "PO-Revision-Date: 2016-03-08 16:59+0000\n"
11
+ "POT-Creation-Date: 2016-06-14 23:26+0200\n"
12
+ "PO-Revision-Date: 2016-08-12 16:30+0000\n"
13
13
  "Last-Translator: Bryan Kearney <bryan.kearney@gmail.com>\n"
14
14
  "Language-Team: Chinese (Taiwan) (http://www.transifex.com/foreman/foreman/language/zh_TW/)\n"
15
15
  "MIME-Version: 1.0\n"
@@ -54,17 +54,17 @@ msgstr "此類型的次指令不存在:'%<name>s'"
54
54
  msgid "no value provided"
55
55
  msgstr "未提供值"
56
56
 
57
- #: ../lib/hammer_cli/defaults.rb:72
57
+ #: ../lib/hammer_cli/defaults.rb:77
58
58
  msgid "Couldn't create %s please create the path before defaults are enabled."
59
- msgstr ""
59
+ msgstr "無法建立 %s,請在啟用預設值前建立路徑。"
60
60
 
61
- #: ../lib/hammer_cli/defaults.rb:82
61
+ #: ../lib/hammer_cli/defaults.rb:101
62
62
  msgid "Defaults management"
63
- msgstr ""
63
+ msgstr "預設值管理"
64
64
 
65
65
  #: ../lib/hammer_cli/defaults_commands.rb:25
66
66
  msgid "List all the providers"
67
- msgstr ""
67
+ msgstr "列出所有供應者"
68
68
 
69
69
  #: ../lib/hammer_cli/defaults_commands.rb:37
70
70
  msgid "Provider"
@@ -72,7 +72,7 @@ msgstr "供應商"
72
72
 
73
73
  #: ../lib/hammer_cli/defaults_commands.rb:38
74
74
  msgid "Supported defaults"
75
- msgstr ""
75
+ msgstr "已支援的預設值"
76
76
 
77
77
  #: ../lib/hammer_cli/defaults_commands.rb:39
78
78
  msgid "Description"
@@ -80,7 +80,7 @@ msgstr "說明"
80
80
 
81
81
  #: ../lib/hammer_cli/defaults_commands.rb:56
82
82
  msgid "List all the default parameters"
83
- msgstr ""
83
+ msgstr "列出所有預設參數"
84
84
 
85
85
  #: ../lib/hammer_cli/defaults_commands.rb:67
86
86
  msgid "Parameter"
@@ -92,63 +92,63 @@ msgstr "值"
92
92
 
93
93
  #: ../lib/hammer_cli/defaults_commands.rb:86
94
94
  msgid "Delete a default param"
95
- msgstr ""
95
+ msgstr "刪除預設參數"
96
96
 
97
97
  #: ../lib/hammer_cli/defaults_commands.rb:87
98
98
  msgid "The name of the default option"
99
- msgstr ""
99
+ msgstr "預設選項的名稱"
100
100
 
101
101
  #: ../lib/hammer_cli/defaults_commands.rb:103
102
102
  msgid "Add a default parameter to config"
103
- msgstr ""
103
+ msgstr "新增預設參數至配置"
104
104
 
105
105
  #: ../lib/hammer_cli/defaults_commands.rb:104
106
106
  msgid "The name of the default option (e.g. organization_id)."
107
- msgstr ""
107
+ msgstr "預設選項的名稱(例如 organization_id)。"
108
108
 
109
109
  #: ../lib/hammer_cli/defaults_commands.rb:105
110
110
  msgid "The value for the default option"
111
- msgstr ""
111
+ msgstr "預設選項的值"
112
112
 
113
113
  #: ../lib/hammer_cli/defaults_commands.rb:106
114
114
  msgid ""
115
115
  "The name of the provider providing the value. For list available providers "
116
116
  "see `hammer defaults providers`."
117
- msgstr ""
117
+ msgstr "提供這個值的供應者。欲知可用供應者的清單,請參見「hammer defaults providers」。"
118
118
 
119
119
  #: ../lib/hammer_cli/defaults_commands.rb:134
120
120
  msgid ""
121
121
  "Added %{key_val} default-option with value that will be generated from the "
122
122
  "server."
123
- msgstr ""
123
+ msgstr "已新增 %{key_val} 預設選項與預設值,這是由伺服器所產生。"
124
124
 
125
125
  #: ../lib/hammer_cli/defaults_commands.rb:135
126
126
  msgid "Added %{key_val} default-option with value %{val_val}."
127
- msgstr ""
127
+ msgstr "已新增 %{key_val} 預設選項,數值為 %{val_val}。"
128
128
 
129
129
  #: ../lib/hammer_cli/defaults_commands.rb:139
130
130
  msgid ""
131
131
  "\"Provider #{namespace} was not found. See `hammer defaults providers` for "
132
132
  "available providers.\""
133
- msgstr ""
133
+ msgstr "\"找不到供應者 #{namespace}。欲知可用的供應者,請參見 `hammer defaults providers`。\""
134
134
 
135
135
  #: ../lib/hammer_cli/defaults_commands.rb:143
136
136
  msgid ""
137
137
  "The param name is not supported by provider. See `hammer defaults providers`"
138
138
  " for supported params."
139
- msgstr ""
139
+ msgstr "供應者並不支援此參數名稱。欲知支援的參數名稱,請參閱 `hammer defaults providers`。"
140
140
 
141
141
  #: ../lib/hammer_cli/defaults_commands.rb:147
142
142
  msgid "%{param} was deleted successfully."
143
- msgstr ""
143
+ msgstr "已成功刪除 %{param}。"
144
144
 
145
145
  #: ../lib/hammer_cli/defaults_commands.rb:151
146
146
  msgid "You must specify value or a provider name, cant specify both."
147
- msgstr ""
147
+ msgstr "您必須指定值或供應者名稱,但不能同時指定兩者。"
148
148
 
149
149
  #: ../lib/hammer_cli/defaults_commands.rb:155
150
150
  msgid "Couldn't find the requested param in %s."
151
- msgstr ""
151
+ msgstr "在 %s 中找不到要求的參數。"
152
152
 
153
153
  #: ../lib/hammer_cli/exception_handler.rb:62
154
154
  msgid "Error: %s"
@@ -266,65 +266,66 @@ msgstr "警告:載入 %s 模組時發生了錯誤"
266
266
  msgid "Error: Some of the required modules are disabled in configuration: %s "
267
267
  msgstr "錯誤:某些必要的模組在配置中已停用:%s "
268
268
 
269
- #: ../lib/hammer_cli/options/normalizers.rb:26
269
+ #: ../lib/hammer_cli/options/normalizers.rb:29
270
270
  msgid "Comma-separated list of key=value."
271
271
  msgstr "逗號區隔開的一列 key=value。"
272
272
 
273
- #: ../lib/hammer_cli/options/normalizers.rb:39
274
- msgid "value must be defined as a comma-separated list of key=value"
275
- msgstr "值必須以一列逗號區隔開的 key=value 來定義"
273
+ #: ../lib/hammer_cli/options/normalizers.rb:43
274
+ msgid ""
275
+ "value must be defined as a comma-separated list of key=value or valid JSON"
276
+ msgstr ""
276
277
 
277
- #: ../lib/hammer_cli/options/normalizers.rb:73
278
+ #: ../lib/hammer_cli/options/normalizers.rb:85
278
279
  msgid "Comma separated list of values."
279
280
  msgstr "逗號區隔開的值。"
280
281
 
281
- #: ../lib/hammer_cli/options/normalizers.rb:88
282
+ #: ../lib/hammer_cli/options/normalizers.rb:100
282
283
  msgid "numeric value is required"
283
- msgstr ""
284
+ msgstr "需要數字值"
284
285
 
285
- #: ../lib/hammer_cli/options/normalizers.rb:102
286
+ #: ../lib/hammer_cli/options/normalizers.rb:114
286
287
  msgid "One of true/false, yes/no, 1/0."
287
288
  msgstr "true/false、yes/no、1/0 之一。"
288
289
 
289
- #: ../lib/hammer_cli/options/normalizers.rb:112
290
+ #: ../lib/hammer_cli/options/normalizers.rb:124
290
291
  msgid "value must be one of true/false, yes/no, 1/0"
291
292
  msgstr "值必須是 true/false、yes/no、1/0 之一"
292
293
 
293
- #: ../lib/hammer_cli/options/normalizers.rb:151
294
+ #: ../lib/hammer_cli/options/normalizers.rb:163
294
295
  msgid "Unable to parse JSON input"
295
296
  msgstr "無法叵析 JSON 輸入"
296
297
 
297
- #: ../lib/hammer_cli/options/normalizers.rb:165
298
+ #: ../lib/hammer_cli/options/normalizers.rb:177
298
299
  msgid "Possible value(s): %s"
299
- msgstr ""
300
+ msgstr "可能的值:%s"
300
301
 
301
- #: ../lib/hammer_cli/options/normalizers.rb:173
302
+ #: ../lib/hammer_cli/options/normalizers.rb:185
302
303
  msgid "value must be %s"
303
- msgstr "值必須是「%s」之一"
304
+ msgstr "值必須是 %s"
304
305
 
305
- #: ../lib/hammer_cli/options/normalizers.rb:175
306
+ #: ../lib/hammer_cli/options/normalizers.rb:187
306
307
  msgid "value must be one of %s"
307
- msgstr "值必須是「%s」之一"
308
+ msgstr "值必須是 %s 之一"
308
309
 
309
- #: ../lib/hammer_cli/options/normalizers.rb:196
310
+ #: ../lib/hammer_cli/options/normalizers.rb:208
310
311
  msgid "Date and time in YYYY-MM-DD HH:MM:SS or ISO 8601 format"
311
312
  msgstr "日期與時間,格式為 YYYY-MM-DD HH:MM:SS 或是 ISO 8601 格式"
312
313
 
313
- #: ../lib/hammer_cli/options/normalizers.rb:203
314
+ #: ../lib/hammer_cli/options/normalizers.rb:215
314
315
  msgid "'%s' is not a valid date"
315
316
  msgstr "「%s」不是個有效的日期"
316
317
 
317
- #: ../lib/hammer_cli/options/normalizers.rb:214
318
+ #: ../lib/hammer_cli/options/normalizers.rb:226
318
319
  msgid "Any combination (comma separated list) of '%s'"
319
320
  msgstr "任何(以逗號隔開的)「%s」的組合"
320
321
 
321
- #: ../lib/hammer_cli/options/normalizers.rb:234
322
+ #: ../lib/hammer_cli/options/normalizers.rb:246
322
323
  msgid "value must be a combination of '%s'"
323
324
  msgstr "值必須是「%s」的組合"
324
325
 
325
326
  #: ../lib/hammer_cli/options/option_definition.rb:56
326
327
  msgid "Warning: Option %{option} is deprecated. %{message}"
327
- msgstr ""
328
+ msgstr "警告:選項 %{option} 已淘汰。%{message}"
328
329
 
329
330
  #: ../lib/hammer_cli/options/option_definition.rb:80
330
331
  msgid "Can be specified multiple times. "
@@ -338,26 +339,32 @@ msgstr "預設值:"
338
339
  msgid ", or "
339
340
  msgstr ",或是"
340
341
 
341
- #: ../lib/hammer_cli/output/adapter/csv.rb:174
342
+ #: ../lib/hammer_cli/output/adapter/csv.rb:179
342
343
  msgid "Message"
343
344
  msgstr "訊息"
344
345
 
345
- #: ../lib/hammer_cli/output/adapter/csv.rb:178
346
+ #: ../lib/hammer_cli/output/adapter/csv.rb:183
346
347
  msgid "Id"
347
348
  msgstr "ID"
348
349
 
349
- #: ../lib/hammer_cli/output/adapter/csv.rb:183
350
+ #: ../lib/hammer_cli/output/adapter/csv.rb:188
350
351
  msgid "Name"
351
352
  msgstr "名稱"
352
353
 
353
- #: ../lib/hammer_cli/output/formatters.rb:154
354
- msgid "yes"
355
- msgstr "是"
354
+ #: ../lib/hammer_cli/output/adapter/table.rb:63
355
+ msgid ""
356
+ "\"Page #{collection.meta.page} of #{pages} (use --page and --per-page for "
357
+ "navigation)\""
358
+ msgstr ""
356
359
 
357
- #: ../lib/hammer_cli/output/formatters.rb:154
360
+ #: ../lib/hammer_cli/output/formatters.rb:160
358
361
  msgid "no"
359
362
  msgstr "否"
360
363
 
364
+ #: ../lib/hammer_cli/output/formatters.rb:160
365
+ msgid "yes"
366
+ msgstr "是"
367
+
361
368
  #: ../lib/hammer_cli/settings.rb:27
362
369
  msgid ""
363
370
  "Warning: location hammer.modules.d is deprecated, move your module "
@@ -402,10 +409,26 @@ msgstr "您不可一次將所有選項設為 %s"
402
409
  msgid "Options %s are required"
403
410
  msgstr "%s 選項乃必要的"
404
411
 
405
- #: ../lib/hammer_cli/validator.rb:79
412
+ #: ../lib/hammer_cli/validator.rb:77
413
+ msgid "You can't set option %s"
414
+ msgstr ""
415
+
416
+ #: ../lib/hammer_cli/validator.rb:78
417
+ msgid "Option %s is required"
418
+ msgstr ""
419
+
420
+ #: ../lib/hammer_cli/validator.rb:90
406
421
  msgid "You can't set any of options %s"
407
422
  msgstr "您不可將任何選項設為 %s"
408
423
 
409
- #: ../lib/hammer_cli/validator.rb:80
424
+ #: ../lib/hammer_cli/validator.rb:91
410
425
  msgid "At least one of options %s is required"
411
426
  msgstr "需要至少一項 %s 選項"
427
+
428
+ #: ../lib/hammer_cli/validator.rb:116
429
+ msgid "One of options %s is required"
430
+ msgstr ""
431
+
432
+ #: ../lib/hammer_cli/validator.rb:120
433
+ msgid "Only one of options %s can be set"
434
+ msgstr ""
@@ -7,7 +7,7 @@
7
7
  # tchuang <tchuang@redhat.com>, 2015. #zanata
8
8
  msgid ""
9
9
  msgstr ""
10
- "Project-Id-Version: hammer-cli 0.7.0\n"
10
+ "Project-Id-Version: hammer-cli 0.8.0\n"
11
11
  "Report-Msgid-Bugs-To: \n"
12
12
  "PO-Revision-Date: 2015-04-28 05:21+0000\n"
13
13
  "Last-Translator: tchuang <tchuang@redhat.com>\n"
@@ -47,7 +47,7 @@ msgstr "此類型的次指令不存在:'%<name>s'"
47
47
  msgid "no value provided"
48
48
  msgstr "未提供值"
49
49
 
50
- msgid "Couldn't create %s please create the path before defaults are enabled."
50
+ msgid "Couldn't create %s. Please create the directory before setting defaults."
51
51
  msgstr ""
52
52
 
53
53
  msgid "Defaults management"
@@ -103,8 +103,8 @@ msgid "Added %{key_val} default-option with value %{val_val}."
103
103
  msgstr ""
104
104
 
105
105
  msgid ""
106
- "\"Provider #{namespace} was not found. See `hammer defaults providers` for avai"
107
- "lable providers.\""
106
+ "Provider %{name} was not found. See `hammer defaults providers` for available "
107
+ "providers."
108
108
  msgstr ""
109
109
 
110
110
  msgid ""
@@ -115,7 +115,7 @@ msgstr ""
115
115
  msgid "%{param} was deleted successfully."
116
116
  msgstr ""
117
117
 
118
- msgid "You must specify value or a provider name, cant specify both."
118
+ msgid "You must specify value or a provider name, can't specify both."
119
119
  msgstr ""
120
120
 
121
121
  msgid "Couldn't find the requested param in %s."
@@ -256,6 +256,12 @@ msgstr "值必須是「%s」的組合"
256
256
  msgid "Warning: Option %{option} is deprecated. %{message}"
257
257
  msgstr ""
258
258
 
259
+ msgid "Deprecated: %{deprecated_msg}"
260
+ msgstr ""
261
+
262
+ msgid "%{flag} is deprecated: %{deprecated_msg}"
263
+ msgstr ""
264
+
259
265
  msgid "Can be specified multiple times. "
260
266
  msgstr "可指定多次。"
261
267
 
@@ -274,9 +280,7 @@ msgstr "ID"
274
280
  msgid "Name"
275
281
  msgstr "名稱"
276
282
 
277
- msgid ""
278
- "\"Page #{collection.meta.page} of #{pages} (use --page and --per-page for navig"
279
- "ation)\""
283
+ msgid "Page %{page} of %{total} (use --page and --per-page for navigation)"
280
284
  msgstr ""
281
285
 
282
286
  msgid "no"
@@ -290,6 +294,9 @@ msgid ""
290
294
  "ons to cli.modules.d"
291
295
  msgstr "警告:hammer.modules.d 這個位置已淘汰使用,請將您的模組配置移至 cli.modules.d"
292
296
 
297
+ msgid "Warning: Couldn't load configuration file %{path}: %{message}"
298
+ msgstr ""
299
+
293
300
  msgid "Print help for commands"
294
301
  msgstr "印出指令的說明"
295
302
 
data/man/hammer.1.gz ADDED
Binary file
@@ -151,7 +151,7 @@ describe 'commands' do
151
151
  it 'reports missing parameter value or source' do
152
152
  options = ['--param-name=organization_id']
153
153
 
154
- expected_result = CommandExpectation.new("You must specify value or a provider name, cant specify both.\n", "", HammerCLI::EX_USAGE)
154
+ expected_result = CommandExpectation.new("You must specify value or a provider name, can't specify both.\n", "", HammerCLI::EX_USAGE)
155
155
 
156
156
  result = run_cmd(cmd + options, @context)
157
157
  assert_cmd(expected_result, result)
@@ -14,10 +14,6 @@ describe HammerCLI::Apipie::OptionBuilder do
14
14
  })
15
15
  end
16
16
 
17
- before :each do
18
- HammerCLI::I18n.clear
19
- end
20
-
21
17
  let(:resource) {api.resource(:documented)}
22
18
  let(:action) {resource.action(:index)}
23
19
  let(:builder) { HammerCLI::Apipie::OptionBuilder.new(resource, action) }
@@ -51,7 +51,7 @@ describe HammerCLI::ExceptionHandler do
51
51
  ex = RestClient::ResourceNotFound.new
52
52
  output.default_adapter = :silent
53
53
  handler.handle_exception(ex)
54
- @log_output.readline.strip.must_equal 'ERROR Exception : Resource Not Found'
54
+ @log_output.readline.strip.must_match /ERROR Exception : (Resource )?Not Found/
55
55
  end
56
56
 
57
57
  end
@@ -23,28 +23,74 @@ describe HammerCLI::I18n do
23
23
  end
24
24
  end
25
25
 
26
- before :each do
27
- HammerCLI::I18n.clear
26
+ let(:fast_gettext_version) { '1.2.0' }
27
+
28
+ before do
29
+ @domains_backup ||= HammerCLI::I18n.domains.dup
30
+ HammerCLI::I18n.stubs(:fast_gettext_version).returns(fast_gettext_version)
31
+ HammerCLI::I18n.init
32
+ end
33
+
34
+ after do
35
+ mocha_teardown
36
+ HammerCLI::I18n.init(@domains_backup)
28
37
  end
29
38
 
30
39
  let(:domain1) { TestLocaleDomain.new('domain1', true) }
31
40
  let(:domain2) { TestLocaleDomain.new('domain2', true) }
32
41
  let(:unavailable_domain) { TestLocaleDomain.new('domain3', false) }
33
42
 
34
- it "registers available domains at gettext" do
35
- FastGettext.expects(:add_text_domain).with do |name, options|
36
- (name == domain1.domain_name) && (options[:path] == domain1.locale_dir) && (options[:type] == domain1.type)
43
+ # skip the tests on older versions of fast_gettext (ruby 2.0)
44
+ if FastGettext::VERSION >= '1.2.0'
45
+ describe "with fast_gettext >= 1.2.0" do
46
+ it "creates base merge repository" do
47
+ HammerCLI::I18n.translation_repository.class.must_equal FastGettext::TranslationRepository::Merge
48
+ end
49
+
50
+ it "registers available domains at gettext" do
51
+ repo = mock
52
+ FastGettext::TranslationRepository.expects(:build).with(domain1.domain_name,
53
+ :path => domain1.locale_dir,
54
+ :type => domain1.type,
55
+ :report_warning => false).returns(repo)
56
+
57
+ HammerCLI::I18n.translation_repository.expects(:add_repo).with(repo)
58
+ HammerCLI::I18n.add_domain(domain1)
59
+ end
60
+
61
+ it "skips registering domains that are not available" do
62
+ HammerCLI::I18n.add_domain(domain1)
63
+ HammerCLI::I18n.add_domain(domain2)
64
+ HammerCLI::I18n.add_domain(unavailable_domain)
65
+ HammerCLI::I18n.domains.must_equal [domain1, domain2]
66
+ end
37
67
  end
38
- HammerCLI::I18n.add_domain(domain1)
39
68
  end
40
69
 
41
- it "skips registering domains that are not available" do
42
- HammerCLI::I18n.add_domain(domain1)
43
- HammerCLI::I18n.add_domain(domain2)
44
- HammerCLI::I18n.add_domain(unavailable_domain)
45
- HammerCLI::I18n.domains.must_equal [domain1, domain2]
46
- end
70
+ describe "with fast_gettext < 1.2.0" do
71
+ let(:fast_gettext_version) { '1.1.0' }
47
72
 
73
+ it "creates base chain repository" do
74
+ HammerCLI::I18n.translation_repository.class.must_equal FastGettext::TranslationRepository::Chain
75
+ end
76
+
77
+ it "registers available domains at gettext" do
78
+ repo = mock
79
+ FastGettext::TranslationRepository.expects(:build).with(domain1.domain_name,
80
+ :path => domain1.locale_dir,
81
+ :type => domain1.type,
82
+ :report_warning => false).returns(repo)
83
+
84
+ HammerCLI::I18n.translation_repository.chain.expects(:<<).with(repo)
85
+ HammerCLI::I18n.add_domain(domain1)
86
+ end
48
87
 
88
+ it "skips registering domains that are not available" do
89
+ HammerCLI::I18n.add_domain(domain1)
90
+ HammerCLI::I18n.add_domain(domain2)
91
+ HammerCLI::I18n.add_domain(unavailable_domain)
92
+ HammerCLI::I18n.domains.must_equal [domain1, domain2]
93
+ end
94
+ end
49
95
  end
50
96
 
@@ -27,6 +27,9 @@ describe HammerCLI::Options::OptionDefinition do
27
27
  :deprecated => "It is going to be removed"
28
28
  end
29
29
 
30
+ def opt_with_deprecation(deprecation)
31
+ HammerCLI::Options::OptionDefinition.new(["--test-option", "--better-switch"], "TEST_OPTION", "Test option", :deprecated => deprecation)
32
+ end
30
33
 
31
34
  describe "formatters" do
32
35
 
@@ -69,6 +72,21 @@ describe HammerCLI::Options::OptionDefinition do
69
72
  err.must_match /Warning: Option --deprecated is deprecated. Use --test-option instead/
70
73
  context[:test_option].must_equal "VALUE"
71
74
  end
75
+
76
+ it 'shows depracated message in help' do
77
+ opt = opt_with_deprecation("Use --better-switch instead")
78
+ opt.description.must_equal "Test option (Deprecated: Use --better-switch instead)"
79
+ end
80
+
81
+ it 'shows flag specific depracated message in help' do
82
+ opt = opt_with_deprecation('--test-option' => "Use --better-switch instead")
83
+ opt.description.must_equal "Test option (--test-option is deprecated: Use --better-switch instead)"
84
+ end
85
+
86
+ it 'shows multiple flag specific depracated messages in help' do
87
+ opt = opt_with_deprecation('--test-option' => "Use --better-switch instead", '--test-option2' => 'This is deprecated too')
88
+ opt.description.must_equal "Test option (--test-option is deprecated: Use --better-switch instead, --test-option2 is deprecated: This is deprecated too)"
89
+ end
72
90
  end
73
91
 
74
92
  describe "context" do
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.7.0
4
+ version: 0.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: 2016-06-14 00:00:00.000000000 Z
12
+ date: 2016-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp
@@ -282,6 +282,7 @@ files:
282
282
  - locale/zh_TW/hammer-cli.edit.po
283
283
  - locale/zh_TW/hammer-cli.po
284
284
  - locale/zh_TW/hammer-cli.po.time_stamp
285
+ - man/hammer.1.gz
285
286
  - test/functional/defaults_test.rb
286
287
  - test/functional/test_helper.rb
287
288
  - test/reports/TEST-Fields-ContainerField-display-.xml