hammer_cli 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e93c3909bae5e1ce10cef180e409f5046ac7207
4
- data.tar.gz: 23865ff20011788a464be2f5e61775311f787aa2
3
+ metadata.gz: f291ac84923a7a842e1464948770660d9eda7bc9
4
+ data.tar.gz: 593e26e92e365344b6b5e2f319266e7a842a10d6
5
5
  SHA512:
6
- metadata.gz: 5d3984b23d9f786da504884d19b1ce39b1043c36bb9c340b7ecdeebd11c3f2567213c7fbed67c661627374d5f76f9c2aeaef9451c9c6609c6c2bda51604a16a8
7
- data.tar.gz: 907a881b80c1269b0cbcb87ee70dab37865a29ab14b2304f9d642413d42901eb88b96bdbf8e49372dae34b1548492e4a4ad155fd4527dc6b404fb9c0bf94c378
6
+ metadata.gz: 8ecca4d5ca8efe937fa4194f807f555078b7c494fbf33c78b88dbd7cbdae2a21d41835d255e1bbebcfdba5fd9ebef01e9b3c55a678413c4ac41026ba188318c8
7
+ data.tar.gz: 263225f32a3c48c8a4de9748436f3129ebca50f0d2ce3a41c25188c77370125e9c22766870e038a82ca9a2af490935aa95548226b34681fa3ee16f926817afae
@@ -1,6 +1,13 @@
1
1
  Release notes
2
2
  =============
3
3
 
4
+ ### 0.1.3
5
+ * Fixed detection of list type options ([#7144](http://projects.theforeman.org/issues/7144))
6
+ * Key-value normalizer accepts arrays ([#7133](http://projects.theforeman.org/issues/7133))
7
+ * Make the zanata settings consistent ([#7111](http://projects.theforeman.org/issues/7111))
8
+ * Adding system locale domain ([#7083](http://projects.theforeman.org/issues/7083))
9
+
10
+
4
11
  ### 0.1.2
5
12
  * Allow override of request options, e.g. :response => :raw
6
13
  * Lazy loaded subcommands ([#6761](http://projects.theforeman.org/issues/6761))
@@ -59,9 +59,9 @@ module HammerCLI::Apipie
59
59
  def option_opts(param)
60
60
  opts = {}
61
61
  opts[:required] = true if (param.required? and require_options?)
62
- # FIXME: There is a bug in apipie, it does not produce correct expected type for Arrays
63
- # When it's fixed, we should test param["expected_type"] == "array"
64
- opts[:format] = HammerCLI::Options::Normalizers::List.new if param.validator.include? "Array"
62
+ if param.expected_type == :array || param.validator =~ /Array/i
63
+ opts[:format] = HammerCLI::Options::Normalizers::List.new
64
+ end
65
65
  opts[:attribute_name] = HammerCLI.option_accessor_name(param.name)
66
66
  return opts
67
67
  end
@@ -102,6 +102,14 @@ module HammerCLI
102
102
 
103
103
  end
104
104
 
105
+ class SystemLocaleDomain < LocaleDomain
106
+
107
+ def locale_dir
108
+ '/usr/share/locale'
109
+ end
110
+
111
+ end
112
+
105
113
 
106
114
  def self.locale
107
115
  lang_variant = Locale.current.to_simple.to_str
@@ -145,4 +153,5 @@ include FastGettext::Translation
145
153
  include HammerCLI::I18n::AllDomains
146
154
 
147
155
  HammerCLI::I18n.add_domain(HammerCLI::I18n::LocaleDomain.new)
156
+ HammerCLI::I18n.add_domain(HammerCLI::I18n::SystemLocaleDomain.new)
148
157
 
@@ -28,14 +28,25 @@ module HammerCLI
28
28
 
29
29
  def format(val)
30
30
  return {} unless val.is_a?(String)
31
+ return {} if val.empty?
31
32
 
32
- val.split(",").inject({}) do |result, item|
33
- parts = item.split("=")
34
- if parts.size != 2
35
- raise ArgumentError, _("value must be defined as a comma-separated list of key=value")
36
- end
37
- result.update(parts[0] => parts[1])
33
+ result = {}
34
+
35
+ pair_re = '([^,]+)=([^,\[]+|\[[^\[\]]*\])'
36
+ full_re = "^((%s)[,]?)+$" % pair_re
37
+
38
+ unless Regexp.new(full_re).match(val)
39
+ raise ArgumentError, _("value must be defined as a comma-separated list of key=value")
38
40
  end
41
+
42
+ val.scan(Regexp.new(pair_re)) do |key, value|
43
+ value = value.strip
44
+ value = value.scan(/[^,\[\]]+/) if value.start_with?('[')
45
+
46
+ result[key.strip]=value
47
+ end
48
+ return result
49
+
39
50
  end
40
51
  end
41
52
 
@@ -1,5 +1,5 @@
1
1
  module HammerCLI
2
2
  def self.version
3
- @version ||= Gem::Version.new '0.1.2'
3
+ @version ||= Gem::Version.new '0.1.3'
4
4
  end
5
5
  end
@@ -6,7 +6,7 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: hammer-cli 0.1.2\n"
9
+ "Project-Id-Version: hammer-cli 0.1.3\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
11
  "POT-Creation-Date: 2014-05-09 16:07-0400\n"
12
12
  "PO-Revision-Date: 2014-03-04 16:38+0000\n"
@@ -5,10 +5,10 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: hammer-cli 0.1.2\n"
8
+ "Project-Id-Version: hammer-cli 0.1.3\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2014-08-01 12:42+0200\n"
11
- "PO-Revision-Date: 2014-08-01 08:17+0000\n"
10
+ "POT-Creation-Date: 2014-08-13 16:09+0200\n"
11
+ "PO-Revision-Date: 2014-08-14 09:42+0000\n"
12
12
  "Last-Translator: Lukáš Zapletal\n"
13
13
  "Language-Team: English (United Kingdom) (http://www.transifex.com/projects/p/foreman/language/en_GB/)\n"
14
14
  "MIME-Version: 1.0\n"
@@ -194,18 +194,29 @@ msgid "Error: %s"
194
194
  msgstr ""
195
195
 
196
196
  #: lib/hammer_cli/exception_handler.rb:66
197
- msgid "Error: %{message}\\n\\nSee: '%{path} --help'"
197
+ msgid "Error: %{message}"
198
198
  msgstr ""
199
199
 
200
- #: lib/hammer_cli/exception_handler.rb:83
200
+ #: lib/hammer_cli/exception_handler.rb:67
201
+ msgid "See: '%{path} --help'"
202
+ msgstr ""
203
+
204
+ #: lib/hammer_cli/exception_handler.rb:84
201
205
  msgid "Invalid username or password"
202
206
  msgstr ""
203
207
 
204
- #: lib/hammer_cli/exception_handler.rb:90
208
+ #: lib/hammer_cli/exception_handler.rb:91
209
+ msgid "Could not load the API description from the server"
210
+ msgstr ""
211
+
212
+ #: lib/hammer_cli/exception_handler.rb:92
213
+ msgid "is the server down?"
214
+ msgstr ""
215
+
216
+ #: lib/hammer_cli/exception_handler.rb:93
205
217
  msgid ""
206
- "Could not load API description from the server\\n - is your server "
207
- "down?\\n\\\\n \" - was \\\"#{rake_command}\\\" run on the server "
208
- "when using apipie cache? (typical production settings))\\n\""
218
+ "was '%s' run on the server when using apipie cache? (typical production "
219
+ "settings)"
209
220
  msgstr ""
210
221
 
211
222
  #: lib/hammer_cli/validator.rb:41
@@ -272,3 +283,9 @@ msgstr ""
272
283
  #: lib/hammer_cli/shell.rb:138
273
284
  msgid "Interactive shell"
274
285
  msgstr ""
286
+
287
+ #: lib/hammer_cli/subcommand.rb:56
288
+ msgid ""
289
+ "can't replace subcommand %<name>s (%<existing_class>s) with %<name>s "
290
+ "(%<new_class>s)"
291
+ msgstr ""
@@ -6,11 +6,11 @@
6
6
  # Sergio Ocón <sergio@redhat.com>, 2014
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: hammer-cli 0.1.2\n"
9
+ "Project-Id-Version: hammer-cli 0.1.3\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2014-08-01 12:42+0200\n"
12
- "PO-Revision-Date: 2014-08-06 09:30+0000\n"
13
- "Last-Translator: Sergio Ocón <sergio@redhat.com>\n"
11
+ "POT-Creation-Date: 2014-08-13 16:09+0200\n"
12
+ "PO-Revision-Date: 2014-08-14 09:42+0000\n"
13
+ "Last-Translator: Lukáš Zapletal\n"
14
14
  "Language-Team: Spanish (http://www.transifex.com/projects/p/foreman/language/es/)\n"
15
15
  "MIME-Version: 1.0\n"
16
16
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -195,19 +195,30 @@ msgid "Error: %s"
195
195
  msgstr "Error: %s"
196
196
 
197
197
  #: lib/hammer_cli/exception_handler.rb:66
198
- msgid "Error: %{message}\\n\\nSee: '%{path} --help'"
199
- msgstr "Error: %{message}\\n\\nMire: '%{path} --help'"
198
+ msgid "Error: %{message}"
199
+ msgstr ""
200
+
201
+ #: lib/hammer_cli/exception_handler.rb:67
202
+ msgid "See: '%{path} --help'"
203
+ msgstr ""
200
204
 
201
- #: lib/hammer_cli/exception_handler.rb:83
205
+ #: lib/hammer_cli/exception_handler.rb:84
202
206
  msgid "Invalid username or password"
203
207
  msgstr "Nombre o password inválidos"
204
208
 
205
- #: lib/hammer_cli/exception_handler.rb:90
209
+ #: lib/hammer_cli/exception_handler.rb:91
210
+ msgid "Could not load the API description from the server"
211
+ msgstr ""
212
+
213
+ #: lib/hammer_cli/exception_handler.rb:92
214
+ msgid "is the server down?"
215
+ msgstr ""
216
+
217
+ #: lib/hammer_cli/exception_handler.rb:93
206
218
  msgid ""
207
- "Could not load API description from the server\\n - is your server "
208
- "down?\\n\\\\n \" - was \\\"#{rake_command}\\\" run on the server "
209
- "when using apipie cache? (typical production settings))\\n\""
210
- msgstr "No se pudo cargar la descripción de la API del servidor\\n - está caído=\\n\\\\n \" - se ejecutó \\\"#{rake_command}\\\" en el servidor mientras se usaba la cache apipie? (configuración típica en producción))\\n\""
219
+ "was '%s' run on the server when using apipie cache? (typical production "
220
+ "settings)"
221
+ msgstr ""
211
222
 
212
223
  #: lib/hammer_cli/validator.rb:41
213
224
  msgid "Unknown option name '%s'"
@@ -273,3 +284,9 @@ msgstr "El completado de comandos está deshabilitado para ruby <1.9 debido a pr
273
284
  #: lib/hammer_cli/shell.rb:138
274
285
  msgid "Interactive shell"
275
286
  msgstr "Shell interactivo"
287
+
288
+ #: lib/hammer_cli/subcommand.rb:56
289
+ msgid ""
290
+ "can't replace subcommand %<name>s (%<existing_class>s) with %<name>s "
291
+ "(%<new_class>s)"
292
+ msgstr ""
@@ -7,10 +7,10 @@
7
7
  # Pierre-Emmanuel Dutang <dutangp@gmail.com>, 2014
8
8
  msgid ""
9
9
  msgstr ""
10
- "Project-Id-Version: hammer-cli 0.1.2\n"
10
+ "Project-Id-Version: hammer-cli 0.1.3\n"
11
11
  "Report-Msgid-Bugs-To: \n"
12
- "POT-Creation-Date: 2014-08-01 12:42+0200\n"
13
- "PO-Revision-Date: 2014-08-05 11:01+0000\n"
12
+ "POT-Creation-Date: 2014-08-13 16:09+0200\n"
13
+ "PO-Revision-Date: 2014-08-19 12:01+0000\n"
14
14
  "Last-Translator: Claer <transiblu@claer.hammock.fr>\n"
15
15
  "Language-Team: French (http://www.transifex.com/projects/p/foreman/language/fr/)\n"
16
16
  "MIME-Version: 1.0\n"
@@ -196,19 +196,30 @@ msgid "Error: %s"
196
196
  msgstr "Erreur : %s"
197
197
 
198
198
  #: lib/hammer_cli/exception_handler.rb:66
199
- msgid "Error: %{message}\\n\\nSee: '%{path} --help'"
200
- msgstr "Erreur : %{message}\\n\\nVoir : '%{path} --help'"
199
+ msgid "Error: %{message}"
200
+ msgstr "Erreur : %{message}"
201
201
 
202
- #: lib/hammer_cli/exception_handler.rb:83
202
+ #: lib/hammer_cli/exception_handler.rb:67
203
+ msgid "See: '%{path} --help'"
204
+ msgstr "Voir : '%{path} --help'"
205
+
206
+ #: lib/hammer_cli/exception_handler.rb:84
203
207
  msgid "Invalid username or password"
204
208
  msgstr "Utilisateur ou mot de passe incorrect"
205
209
 
206
- #: lib/hammer_cli/exception_handler.rb:90
210
+ #: lib/hammer_cli/exception_handler.rb:91
211
+ msgid "Could not load the API description from the server"
212
+ msgstr "Impossible de charger la description de l'API depuis le serveur"
213
+
214
+ #: lib/hammer_cli/exception_handler.rb:92
215
+ msgid "is the server down?"
216
+ msgstr "Le serveur est-il éteint ?"
217
+
218
+ #: lib/hammer_cli/exception_handler.rb:93
207
219
  msgid ""
208
- "Could not load API description from the server\\n - is your server "
209
- "down?\\n\\\\n \" - was \\\"#{rake_command}\\\" run on the server "
210
- "when using apipie cache? (typical production settings))\\n\""
211
- msgstr "Impossible de charger la description de l'API depuis le serveur\\n - serveur éteint ?\\n\\n \" - est ce que \\\"#{rake_command}\\\" est lancé sur le serveur en même temps que le cache apipie est actif ? (fonctionnement classique en production)\\n\""
220
+ "was '%s' run on the server when using apipie cache? (typical production "
221
+ "settings)"
222
+ msgstr "Est ce que '%s' était lancé pendant que le cache apipie était en cours d'utilisation ? (état normal pour un serveur de production)"
212
223
 
213
224
  #: lib/hammer_cli/validator.rb:41
214
225
  msgid "Unknown option name '%s'"
@@ -274,3 +285,9 @@ msgstr "La complétion automatique est désactivée pour ruby < 1.9 à cause de
274
285
  #: lib/hammer_cli/shell.rb:138
275
286
  msgid "Interactive shell"
276
287
  msgstr "Shell interactif"
288
+
289
+ #: lib/hammer_cli/subcommand.rb:56
290
+ msgid ""
291
+ "can't replace subcommand %<name>s (%<existing_class>s) with %<name>s "
292
+ "(%<new_class>s)"
293
+ msgstr "impossible de remplacer la sous-commande %<name>s (%<existing_class>s) par %<name>s (%<new_class>s)"
@@ -6,9 +6,9 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: hammer-cli 0.1.2\n"
9
+ "Project-Id-Version: hammer-cli 0.1.3\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2014-08-13 16:09+0200\n"
11
+ "POT-Creation-Date: 2014-08-20 13:02+0200\n"
12
12
  "PO-Revision-Date: 2014-03-04 16:38+0000\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -70,47 +70,47 @@ msgstr ""
70
70
  msgid "Comma-separated list of key=value."
71
71
  msgstr ""
72
72
 
73
- #: lib/hammer_cli/options/normalizers.rb:35
73
+ #: lib/hammer_cli/options/normalizers.rb:39
74
74
  msgid "value must be defined as a comma-separated list of key=value"
75
75
  msgstr ""
76
76
 
77
- #: lib/hammer_cli/options/normalizers.rb:46
77
+ #: lib/hammer_cli/options/normalizers.rb:57
78
78
  msgid "Comma separated list of values."
79
79
  msgstr ""
80
80
 
81
- #: lib/hammer_cli/options/normalizers.rb:58
81
+ #: lib/hammer_cli/options/normalizers.rb:69
82
82
  msgid "One of true/false, yes/no, 1/0."
83
83
  msgstr ""
84
84
 
85
- #: lib/hammer_cli/options/normalizers.rb:68
85
+ #: lib/hammer_cli/options/normalizers.rb:79
86
86
  msgid "value must be one of true/false, yes/no, 1/0"
87
87
  msgstr ""
88
88
 
89
- #: lib/hammer_cli/options/normalizers.rb:107
89
+ #: lib/hammer_cli/options/normalizers.rb:118
90
90
  msgid "Unable to parse JSON input"
91
91
  msgstr ""
92
92
 
93
- #: lib/hammer_cli/options/normalizers.rb:120
93
+ #: lib/hammer_cli/options/normalizers.rb:131
94
94
  msgid "One of %s"
95
95
  msgstr ""
96
96
 
97
- #: lib/hammer_cli/options/normalizers.rb:127
97
+ #: lib/hammer_cli/options/normalizers.rb:138
98
98
  msgid "value must be one of '%s'"
99
99
  msgstr ""
100
100
 
101
- #: lib/hammer_cli/options/normalizers.rb:146
101
+ #: lib/hammer_cli/options/normalizers.rb:157
102
102
  msgid "Date and time in YYYY-MM-DD HH:MM:SS or ISO 8601 format"
103
103
  msgstr ""
104
104
 
105
- #: lib/hammer_cli/options/normalizers.rb:153
105
+ #: lib/hammer_cli/options/normalizers.rb:164
106
106
  msgid "'%s' is not a valid date"
107
107
  msgstr ""
108
108
 
109
- #: lib/hammer_cli/options/normalizers.rb:164
109
+ #: lib/hammer_cli/options/normalizers.rb:175
110
110
  msgid "Any combination (comma separated list) of '%s'"
111
111
  msgstr ""
112
112
 
113
- #: lib/hammer_cli/options/normalizers.rb:184
113
+ #: lib/hammer_cli/options/normalizers.rb:195
114
114
  msgid "value must be a combination of '%s'"
115
115
  msgstr ""
116
116
 
@@ -17,9 +17,8 @@
17
17
  <locale>te</locale>
18
18
  <locale>pa</locale>
19
19
  <locale>kn</locale>
20
- <locale>de</locale>
21
- <locale>es</locale>
22
- <locale>gl</locale>
20
+ <locale map-from="de">de-DE</locale>
21
+ <locale map-from="es">es-ES</locale>
23
22
  <locale map-from="pt_BR">pt-BR</locale>
24
23
  <locale map-from="bn">bn-IN</locale>
25
24
  <locale map-from="ta">ta-IN</locale>
@@ -54,7 +54,7 @@
54
54
  "allow_null": false,
55
55
  "full_name": "organization_ids",
56
56
  "validator": "Array of numbers",
57
- "expected_type": "Array",
57
+ "expected_type": "array",
58
58
  "description": "",
59
59
  "required": false
60
60
  },
@@ -107,7 +107,7 @@
107
107
  "allow_null": false,
108
108
  "full_name": "documented[array_param]",
109
109
  "validator": "Must be Array",
110
- "expected_type": "string",
110
+ "expected_type": "array",
111
111
  "description": "",
112
112
  "required": true
113
113
  }
@@ -56,6 +56,18 @@ describe HammerCLI::Options::Normalizers do
56
56
  formatter.format("a=1,b=2,c=3").must_equal({'a' => '1', 'b' => '2', 'c' => '3'})
57
57
  end
58
58
 
59
+ it "should parse arrays" do
60
+ formatter.format("a=1,b=[1,2,3],c=3").must_equal({'a' => '1', 'b' => ['1', '2', '3'], 'c' => '3'})
61
+ end
62
+
63
+ it "should parse array with one item" do
64
+ formatter.format("a=1,b=[abc],c=3").must_equal({'a' => '1', 'b' => ['abc'], 'c' => '3'})
65
+ end
66
+
67
+ it "should parse empty array" do
68
+ formatter.format("a=1,b=[],c=3").must_equal({'a' => '1', 'b' => [], 'c' => '3'})
69
+ end
70
+
59
71
  it "should parse a comma separated string 2" do
60
72
  proc { formatter.format("a=1,b,c=3") }.must_raise ArgumentError
61
73
  end
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.1.2
4
+ version: 0.1.3
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-08-13 00:00:00.000000000 Z
12
+ date: 2014-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp
@@ -645,4 +645,3 @@ test_files:
645
645
  - test/unit/modules_test.rb
646
646
  - test/unit/test_helper.rb
647
647
  - test/unit/connection_test.rb
648
- has_rdoc: