cloudformation-ruby-dsl 0.4.11 → 0.4.12

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: 8538fca31a8ff409e404bfc7730f6ee4edcc577e
4
- data.tar.gz: cff8518a2114ffd576abd524f47a5d29f844127d
3
+ metadata.gz: 87b89f992d041a66fac78a11afd099ace363ae6c
4
+ data.tar.gz: d70726355a5e57afc2efc67823578159da150e3f
5
5
  SHA512:
6
- metadata.gz: 4c4ae2ae27b8c5a1e1dc0610736e9c34255f7ac3f1be750dec9564aa70093bb350bdc0596e22a17b161f404c204a281cb2d2e94a0e5890153be1b8e1b5cae197
7
- data.tar.gz: f6e8e6c344d521b8edd8a45a009e221ba6d487a0a88a98cd4c53ff306b9083050f0fb99a25401eb64701cb566b901984a7c26bec0cbc19ba10a656e88ecf3793
6
+ metadata.gz: 6c66d35817b955ef46ab6d8fc96e859af62ac1c044bf419202f525baddf542f37805adb4cd6fadd6b7fbebdf3f8da0ea99d51fa582c9c0ada90b52cbbffd3e8c
7
+ data.tar.gz: 04c800f473523eb221ef9be31fd211470d96c9eb9934d8f7a89a5de4be00db99aa45056ebbb89349026b92acc334e0435a22f1a85e4bf9c470039f443d86a3f3
@@ -34,4 +34,5 @@ Gem::Specification.new do |gem|
34
34
 
35
35
  gem.add_runtime_dependency 'detabulator'
36
36
  gem.add_runtime_dependency 'json'
37
+ gem.add_runtime_dependency 'xml-simple'
37
38
  end
@@ -20,15 +20,10 @@ unless RUBY_VERSION >= '1.9'
20
20
  end
21
21
 
22
22
  require 'rubygems'
23
- require 'csv'
24
23
  require 'json'
25
24
  require 'yaml'
26
25
  require 'erb'
27
-
28
- # A custom converter to replace the String "(nil)" with NilClass
29
- CSV::Converters[:nil_to_nil] = lambda do |field|
30
- field && field == '(nil)' ? nil : field
31
- end
26
+ require 'xmlsimple'
32
27
 
33
28
  ############################# Command-line and "cfn-cmd" Support
34
29
 
@@ -205,9 +200,16 @@ def cfn_cmd(template)
205
200
  exit(true)
206
201
  end
207
202
 
203
+ def extract_kv_string(hash, prefix='')
204
+ key = "#{prefix}Key"
205
+ value = "#{prefix}Value"
206
+ hash["member"].map {|a| "#{a[key]}=#{a[value]}" }.join(';') rescue ''
207
+ end
208
+
208
209
  def exec_describe_stack cfn_options_string
209
- csv_data = exec_capture_stdout("cfn-cmd cfn-describe-stacks #{cfn_options_string} --headers --show-long")
210
- CSV.parse_line(csv_data, :quote_char => "'", :headers => true, :converters => :nil_to_nil)
210
+ xml_data = exec_capture_stdout("cfn-cmd cfn-describe-stacks #{cfn_options_string} --show-xml")
211
+ xml = XmlSimple.xml_in(xml_data, :ForceArray => false)["DescribeStacksResult"]["Stacks"]["member"]
212
+ { "TAGS" => extract_kv_string(xml["Tags"]), "PARAMETERS" => extract_kv_string(xml["Parameters"], "Parameter") }
211
213
  end
212
214
 
213
215
  def exec_capture_stdout command
@@ -15,7 +15,7 @@
15
15
  module Cfn
16
16
  module Ruby
17
17
  module Dsl
18
- VERSION = "0.4.11"
18
+ VERSION = "0.4.12"
19
19
  end
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudformation-ruby-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shawn Smith
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2015-03-26 00:00:00.000000000 Z
18
+ date: 2015-03-31 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: detabulator
@@ -45,6 +45,20 @@ dependencies:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: xml-simple
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
48
62
  description: Ruby DSL library that provides a wrapper around the cfn-cmd.
49
63
  email:
50
64
  - Shawn.Smith@bazaarvoice.com