aws-cfn-compiler 0.9.17 → 0.9.18

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2105a3aa92d4cdb15dabc7291f32a9e713ed005
4
- data.tar.gz: 272bb57033e267313b23d2c7a1994f3b2ae9c7fd
3
+ metadata.gz: 019dafeae443d80e16ceb89976cf30631d604549
4
+ data.tar.gz: b1084eebc7b900226f28cf1e8495f907a8557ad5
5
5
  SHA512:
6
- metadata.gz: bd87a92ddf6f11014474efd1ed29c2437a120dc6124eb642f530c9cf08b4ac13ee9ec888d9aa311c945f65802e30ba6ad9f6d49fab38936f0d2b5c11d0f7252d
7
- data.tar.gz: f9759dfd8f0705f55b10e24bb8ed221b97e6561ed86fe07a65a1e95b65a8af03499d77892aa632f7752d755a383e8af5846e22bd9c060cb2bfd70b7d640964e3
6
+ metadata.gz: 4a5a32097b35d96fcc853affbce36e3ac03a516ad443a8742e78b38cd309f99831b3e1d0e5b8c49a90f9faa8aeaeca0cd79d78ef3a7de6e1ccea891c5a509598
7
+ data.tar.gz: 5f55f0c6564dd2a5f74f2c64a7fb27d8a6e8a04e8b167e062f12628dcaf5ea3a6aa76cea3be6b498586187b46e833d38ae5b6d5b389cbe1c2a28664f57cc6ab2
@@ -21,6 +21,7 @@ module Aws
21
21
  end
22
22
 
23
23
  def dynamic_item(section,resource,hash)
24
+ abort! "Invalid section '#{section}'\nValid sections are: #{@all_sections.join(',')}" unless @all_sections.include?(section)
24
25
  unless @dynamic_items.has_key?(section)
25
26
  @dynamic_items[section] ||= {}
26
27
  end
@@ -81,8 +81,9 @@ module Aws
81
81
  @items[section] ||= {}
82
82
  @dynamic_items[section] ||= {}
83
83
  get = {}
84
- item = {}
85
84
  spec[section].each do |rsrc|
85
+ item = {}
86
+ item[section] ||= {}
86
87
  @logger.debug "\tUsing #{section}::#{rsrc}"
87
88
  refp,sub,base,rel = map_resource_reference(rsrc)
88
89
  if refp.nil?
@@ -96,7 +97,7 @@ module Aws
96
97
  end
97
98
  set = get[path]
98
99
  if set[base]
99
- if item.has_key?(base)
100
+ if item[section].has_key?(base)
100
101
  @logger.error " !! error: Duplicate item: #{section}/#{base}"
101
102
  abort!
102
103
  end
@@ -113,46 +114,40 @@ module Aws
113
114
  next if content.size==0
114
115
 
115
116
  if filename =~ /\.(rb|ruby)\z/i
116
- dict = parse_rb_file(base, section, filename)
117
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
118
+ item = parse_rb_file(base, section, filename)
136
119
  elsif filename =~ /\.js(|on)\z/i
137
- item.merge! JSON.parse(content)
120
+ item[section].merge! JSON.parse(content)
138
121
  elsif filename =~ /\.ya?ml\z/i
139
- item.merge! YAML.load(content)
122
+ item[section].merge! YAML.load(content)
140
123
  else
141
124
  next
142
125
  end
143
126
 
144
- unless item.has_key?(base)
127
+ unless item[section].has_key?(base)
145
128
  filn = if @config[:expandedpaths]
146
129
  filename
147
130
  else
148
131
  short_path(filename,2)
149
132
  end
150
- @logger.error " !! error: Brick in #{filn} does not define #{section}/#{base}!?\nIt defines these: #{item.keys}"
133
+ @logger.error " !! error: Brick in #{filn} does not define #{section}/#{base}!?\nIt defines these: #{item[section].keys}"
151
134
  abort!
152
135
  end
153
136
  rescue
154
137
  abort! " !! error: #{$!}"
155
138
  end
139
+ item.each { |sect,hash|
140
+ hash.keys.each do |key|
141
+ if @items.has_key?(sect)
142
+ if @items[sect].has_key?(key)
143
+ abort! " !! error: Duplicate item: #{sect}/#{key}"
144
+ end
145
+ else
146
+ @items[sect] ||= {}
147
+ end
148
+ end
149
+ @items[sect].merge! hash
150
+ }
156
151
  else
157
152
  pm = []
158
153
  set.map { |r,f|
@@ -162,12 +157,6 @@ module Aws
162
157
  abort! " !! error: #{section}/#{base} not found! Possible matches: #{pm}"
163
158
  end
164
159
  end
165
- item.keys.each { |key|
166
- if @items[section].has_key?(key)
167
- abort! " !! error: Duplicate item: #{section}/#{key}"
168
- end
169
- }
170
- @items[section].merge! item
171
160
 
172
161
  unless @items[section].keys.count == (spec[section].count + @dynamic_items[section].keys.count)
173
162
  @logger.error "#{section} section check failed! \nRequested: #{spec[section]}\n Found: #{@items[section].keys}\n Dynamic: #{@dynamic_items[section].keys}\n"+
@@ -200,9 +189,11 @@ module Aws
200
189
  abort! "Cannot compile #{source_file}\n\n" + e.message + "\n\n" + e.backtrace.to_s
201
190
  end
202
191
  unless @dsl.dict[section.to_sym]
203
- abort! "Unable to compile/expand #{filename} for #{section}/#{base}"
192
+ abort! "Unable to compile/expand #{filename} for #{section}/#{base}.\n(No #{section} were created?!)"
204
193
  end
205
- sym_to_s(@dsl.dict)
194
+ dict = sym_to_s(@dsl.dict)
195
+ @dsl = Aws::Cfn::Dsl::Template.new(@config[:directory])
196
+ dict
206
197
  end
207
198
 
208
199
  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.17'
4
+ VERSION = '0.9.18'
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.17
4
+ version: 0.9.18
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-18 00:00:00.000000000 Z
11
+ date: 2014-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print