kafo 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kafo might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91d324d1a64249a43c1144c0004d10ec06ac7fdf
4
- data.tar.gz: 8348a33dbabf43af7c171c05512a221b94ebbffe
3
+ metadata.gz: f3f998e2006a64519cc5db13a1af9ed98a894766
4
+ data.tar.gz: 4659343e1af1974cfcd916b77612674b9b168905
5
5
  SHA512:
6
- metadata.gz: 1c4f76dafc8713b732a522bdb76e7edbf8400a6fe10786f487963f7b514d60d0fa95ff348b69638a2ab0fe4d84dad6ac17d2ac33f811f7804fa993d0aaa78c99
7
- data.tar.gz: 11ec6f6db6d8025c67e6f7d8a58872760ea3b95208aff2bd2e70a41051252076848446c9ad29011b366bab01565d5eb43692a60dda9783f96ca403f1381be91a
6
+ metadata.gz: 2874a1f991c8a20d00378e220a4f24465641bc7a9586d151a233181f748cee666b7c7ce0bffc26eb87874b0406e9d4f46daa9e8a5b4711fd5767fd91054573a1
7
+ data.tar.gz: b4059406b9309d066445a46498ccb17f56ee64dbe9546fb833f35bc6596f22eedc5cb093b01f0cc66956881ba8476269fb4fdbb684d27fe360eac93a74c127d8
data/README.md CHANGED
@@ -9,7 +9,7 @@ echo "include some_modules" | puppet apply
9
9
  ```
10
10
  ## Why should I care?
11
11
 
12
- Suppose you work on a software which you want to distribute to a machine in
12
+ Suppose you work on software which you want to distribute to a machine in
13
13
  infrastructure managed by puppet. You write a puppet module for your app.
14
14
  But you also want to be able to distribute this app to a machine outside of
15
15
  puppet infrastructure (e.g. install it to your clients) or you want to install
@@ -271,6 +271,21 @@ bin/foreman-installer --puppetmaster-environments=development --puppetmaster-env
271
271
  In interactive mode you'll be prompted for another value until you specify
272
272
  blank line.
273
273
 
274
+ ## Hash arguments
275
+
276
+ You can use Hash value not unlike Arrays. It's also multivalue type but
277
+ you have to specify a key:value pairs like this.
278
+ ```bash
279
+ bin/foreman-installer --puppet-server-git-branch-map=master:some --puppet-server-git-branch-map=development:another
280
+ ```
281
+
282
+ The same applies in interactive mode, you enter each pair on separate line
283
+ just like with Array, the only difference is that the line must be formatted
284
+ as key:value.
285
+
286
+ When parsing the value, the first colon divides key and value. All other
287
+ colons are ignored.
288
+
274
289
  ## Grouping in interactive mode
275
290
 
276
291
  If your module has too much parameters you may find useful grouping. Every
@@ -188,7 +188,7 @@ module Kafo
188
188
  :default => !!config.app[:colors]
189
189
  self.class.app_option ['-d', '--dont-save-answers'], :flag, 'Skip saving answers to answers.yaml?',
190
190
  :default => !!config.app[:dont_save_answers]
191
- self.class.app_option '--ignore-undocumented', :flag, 'Ignore inconsistent parameters documentation',
191
+ self.class.app_option '--ignore-undocumented', :flag, 'Ignore inconsistent parameter documentation',
192
192
  :default => false
193
193
  self.class.app_option ['-i', '--interactive'], :flag, 'Run in interactive mode'
194
194
  self.class.app_option '--log-level', 'LEVEL', 'Log level for log file output',
@@ -209,7 +209,7 @@ module Kafo
209
209
  modules.each do |mod|
210
210
  self.class.option d("--[no-]enable-#{mod.name}"),
211
211
  :flag,
212
- "Enable puppet module #{mod.name}?",
212
+ "Enable '#{mod.name}' puppet module",
213
213
  :default => mod.enabled?
214
214
  end
215
215
 
@@ -107,4 +107,5 @@ require 'kafo/params/boolean'
107
107
  require 'kafo/params/string'
108
108
  require 'kafo/params/password'
109
109
  require 'kafo/params/array'
110
+ require 'kafo/params/hash'
110
111
  require 'kafo/params/integer'
@@ -0,0 +1,31 @@
1
+ module Kafo
2
+ module Params
3
+ class Hash < Param
4
+ def value=(value)
5
+ super
6
+ @value = typecast(@value)
7
+ end
8
+
9
+ def multivalued?
10
+ true
11
+ end
12
+
13
+ def condition_value
14
+ value.inspect
15
+ end
16
+
17
+ private
18
+
19
+ def typecast(value)
20
+ if value.nil?
21
+ nil
22
+ elsif value.is_a?(::Hash)
23
+ value
24
+ else
25
+ value = [value].flatten
26
+ ::Hash[value.map { |v| v.split(':', 2) }]
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module Kafo
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
@@ -131,7 +131,7 @@ END
131
131
  end
132
132
 
133
133
  def configure_multi(param)
134
- say HighLine.color('every line is a separate value, blank line to quit', :info)
134
+ say HighLine.color('every line is a separate value, blank line to quit, for hash use key:value syntax', :info)
135
135
  say "\ncurrent value: #{HighLine.color(param.value.to_s, :info)} %>"
136
136
  ask("new value:") do |q|
137
137
  q.gather = ""
@@ -2,7 +2,7 @@ require 'kafo_configure/lib/kafo/puppet/report_wrapper'
2
2
 
3
3
  module Puppet::Parser::Functions
4
4
  newfunction(:add_progress) do |args|
5
- supported = %w(2.6. 2.7. 3.0. 3.1. 3.2. 3.3.)
5
+ supported = %w(2.6. 2.7. 3.0. 3.1. 3.2. 3.3. 3.4.)
6
6
  if supported.any? { |version| Puppet::PUPPETVERSION.start_with?(version) }
7
7
  # Monkey patch the transaction to put our wrapper around the report object
8
8
  require 'puppet/transaction'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kafo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Hulan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-03 00:00:00.000000000 Z
11
+ date: 2013-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -197,6 +197,7 @@ files:
197
197
  - lib/kafo/params/password.rb
198
198
  - lib/kafo/params/string.rb
199
199
  - lib/kafo/params/boolean.rb
200
+ - lib/kafo/params/hash.rb
200
201
  - lib/kafo/params/array.rb
201
202
  - lib/kafo/params/integer.rb
202
203
  - lib/kafo/help_builder.rb