aws-cfn-compiler 0.9.16 → 0.9.17

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: 2fa67c6abac790de18d8b0e01297ca6f9190f58d
4
- data.tar.gz: 3d35bcff65de84a375eeef9ddc206fdf91d99404
3
+ metadata.gz: c2105a3aa92d4cdb15dabc7291f32a9e713ed005
4
+ data.tar.gz: 272bb57033e267313b23d2c7a1994f3b2ae9c7fd
5
5
  SHA512:
6
- metadata.gz: c416e8f8966bddeb7050927ab9091fd744d271702c4ebfcae19952ebe9cd95610fbc8006af7052e42e3c4fb6169cdc479ce6b46f75aad54a031a828edaf0a7e1
7
- data.tar.gz: 6638aa837d9eeaecf4641422ec5eff9ad1f2b81038602c17240d22c0ea69c94ed6652a0c040d19b22e3549b1468be3647c9c3748e3ef8b2823bcf94b7779e935
6
+ metadata.gz: bd87a92ddf6f11014474efd1ed29c2437a120dc6124eb642f530c9cf08b4ac13ee9ec888d9aa311c945f65802e30ba6ad9f6d49fab38936f0d2b5c11d0f7252d
7
+ data.tar.gz: f9759dfd8f0705f55b10e24bb8ed221b97e6561ed86fe07a65a1e95b65a8af03499d77892aa632f7752d755a383e8af5846e22bd9c060cb2bfd70b7d640964e3
@@ -21,6 +21,9 @@ module Aws
21
21
  end
22
22
 
23
23
  def dynamic_item(section,resource,hash)
24
+ unless @dynamic_items.has_key?(section)
25
+ @dynamic_items[section] ||= {}
26
+ end
24
27
  @dynamic_items[section][resource] = hash
25
28
  end
26
29
 
@@ -113,7 +113,26 @@ module Aws
113
113
  next if content.size==0
114
114
 
115
115
  if filename =~ /\.(rb|ruby)\z/i
116
- item.merge! parse_rb_file(base, section, filename)
116
+ dict = parse_rb_file(base, section, filename)
117
+ # Ruby bricks can now define resources across section boundaries!
118
+ dict.each do |sect, itmh|
119
+ # Simply merge all the items in the section we are working in as before
120
+ if sect == section
121
+ item.merge! itmh
122
+ else
123
+ # And for items in other sections define the section or check for dups
124
+ if @items.has_key?(sect)
125
+ itmh.each { |key|
126
+ if @items[sect].has_key?(key)
127
+ abort! " !! error: Duplicate item: #{sect}/#{key}"
128
+ end
129
+ }
130
+ else
131
+ @items[sect] ||= {}
132
+ end
133
+ @items[sect].merge! itmh
134
+ end
135
+ end
117
136
  elsif filename =~ /\.js(|on)\z/i
118
137
  item.merge! JSON.parse(content)
119
138
  elsif filename =~ /\.ya?ml\z/i
@@ -151,21 +170,28 @@ module Aws
151
170
  @items[section].merge! item
152
171
 
153
172
  unless @items[section].keys.count == (spec[section].count + @dynamic_items[section].keys.count)
154
- abort! " !! error: Suspect that a #{section} item was missed or not properly named (Brick name and file name mismatch?)! \nRequested: #{spec[section]}\n Found: #{@items[section].keys}"
173
+ @logger.error "#{section} section check failed! \nRequested: #{spec[section]}\n Found: #{@items[section].keys}\n Dynamic: #{@dynamic_items[section].keys}\n"+
174
+ " !! Suspect that a #{section} item was missed, duplicated or not properly named (Brick name and file name mismatch?)!"
175
+ @dynamic_items[section].each do |k,_|
176
+ if @items.has_key?(k)
177
+ @logger.error "Dynamic #{section}/#{k} duplicates a static resource!"
178
+ end
179
+ end
180
+ abort! 'Cannot continue'
155
181
  end
156
182
  end
157
183
 
158
184
  end
159
185
 
160
186
  def parse_rb_file(base, section, filename)
161
- Aws::Cfn::Compiler.binding ||= {}
162
- Aws::Cfn::Compiler.binding[section] ||= {}
187
+ Aws::Cfn::Compiler.binding ||= {}
188
+ Aws::Cfn::Compiler.binding[section] ||= {}
163
189
  Aws::Cfn::Compiler.binding[section][base] ||= {
164
- brick_path: @config[:brick_path],
165
- brick_path_list: @config[:brick_path_list],
166
- template: @dsl,
167
- logger: @logger,
168
- compiler: self
190
+ :brick_path => @config[:brick_path],
191
+ :brick_path_list => @config[:brick_path_list],
192
+ :template => @dsl,
193
+ :logger => @logger,
194
+ :compiler => self
169
195
  }
170
196
  source_file = File.expand_path(filename)
171
197
  begin
@@ -176,7 +202,7 @@ module Aws
176
202
  unless @dsl.dict[section.to_sym]
177
203
  abort! "Unable to compile/expand #{filename} for #{section}/#{base}"
178
204
  end
179
- sym_to_s(@dsl.dict[section.to_sym])
205
+ sym_to_s(@dsl.dict)
180
206
  end
181
207
 
182
208
  def sym_to_s(hash)
@@ -1,7 +1,7 @@
1
1
  module Aws
2
2
  module Cfn
3
3
  module Compiler
4
- VERSION = '0.9.16'
4
+ VERSION = '0.9.17'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-cfn-compiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.16
4
+ version: 0.9.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - PKinney
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-12 00:00:00.000000000 Z
11
+ date: 2014-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print