aws-cfn-compiler 0.9.17 → 0.9.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws/cfn/compiler/base.rb +1 -0
- data/lib/aws/cfn/compiler/mixins/parse.rb +24 -33
- data/lib/aws/cfn/compiler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 019dafeae443d80e16ceb89976cf30631d604549
|
4
|
+
data.tar.gz: b1084eebc7b900226f28cf1e8495f907a8557ad5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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)
|
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.
|
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-
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|