sparkle_formation 3.0.26 → 3.0.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +6 -0
  3. data/lib/sparkle_formation/composition.rb +17 -17
  4. data/lib/sparkle_formation/error.rb +2 -5
  5. data/lib/sparkle_formation/function_struct.rb +27 -31
  6. data/lib/sparkle_formation/provider/aws.rb +32 -31
  7. data/lib/sparkle_formation/provider/azure.rb +18 -19
  8. data/lib/sparkle_formation/provider/google.rb +20 -22
  9. data/lib/sparkle_formation/provider/heat.rb +17 -17
  10. data/lib/sparkle_formation/provider/terraform.rb +14 -15
  11. data/lib/sparkle_formation/provider.rb +0 -2
  12. data/lib/sparkle_formation/resources/aws.rb +129 -149
  13. data/lib/sparkle_formation/resources/aws_resources.json +9208 -5542
  14. data/lib/sparkle_formation/resources/azure.rb +2 -5
  15. data/lib/sparkle_formation/resources/azure_resources.json +12367 -2901
  16. data/lib/sparkle_formation/resources/google.rb +1 -4
  17. data/lib/sparkle_formation/resources/heat.rb +0 -4
  18. data/lib/sparkle_formation/resources/heat_resources.json +2616 -2062
  19. data/lib/sparkle_formation/resources/rackspace.rb +0 -4
  20. data/lib/sparkle_formation/resources/terraform.rb +2 -6
  21. data/lib/sparkle_formation/resources.rb +20 -24
  22. data/lib/sparkle_formation/sparkle.rb +56 -66
  23. data/lib/sparkle_formation/sparkle_attribute/aws.rb +61 -34
  24. data/lib/sparkle_formation/sparkle_attribute/azure.rb +12 -8
  25. data/lib/sparkle_formation/sparkle_attribute/google.rb +18 -15
  26. data/lib/sparkle_formation/sparkle_attribute/heat.rb +22 -7
  27. data/lib/sparkle_formation/sparkle_attribute/rackspace.rb +0 -2
  28. data/lib/sparkle_formation/sparkle_attribute/terraform.rb +11 -5
  29. data/lib/sparkle_formation/sparkle_attribute.rb +13 -7
  30. data/lib/sparkle_formation/sparkle_collection/rainbow.rb +5 -7
  31. data/lib/sparkle_formation/sparkle_collection.rb +13 -15
  32. data/lib/sparkle_formation/sparkle_formation.rb +116 -112
  33. data/lib/sparkle_formation/sparkle_struct.rb +30 -24
  34. data/lib/sparkle_formation/translation/heat.rb +57 -58
  35. data/lib/sparkle_formation/translation/rackspace.rb +48 -49
  36. data/lib/sparkle_formation/translation.rb +34 -37
  37. data/lib/sparkle_formation/utils.rb +6 -13
  38. data/lib/sparkle_formation/version.rb +1 -1
  39. data/sparkle_formation.gemspec +1 -1
  40. metadata +9 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 33f948df7a83782e8ab90fd9900cae9e88e5e4bb
4
- data.tar.gz: 9329bf4f33788f8ad4589828f1a38ace0c3c0af7
2
+ SHA256:
3
+ metadata.gz: 19b9bff2dd1817a3ea403221d40cdcd9b6f8b8f999670f3a1baa37a36cd0ab9c
4
+ data.tar.gz: 5c0627a7fcc3cb91c68a7576276d8c6431632111cd1b7a0a4135fe68fea1d346
5
5
  SHA512:
6
- metadata.gz: 63f3a963ac6233c943c897df5e9d462933384060e42e6beb00a6502186a3f35f6e97659a66b757e60d48a3b44322bc31f8bd2bb5a5dd5a37262db3fbcc2f55c8
7
- data.tar.gz: 35ede30d5db9519d4d8c41db21119d4d9de5328ce525f41d086f583a6212b7a2a3a5102feb9579a537c1a1f56f5a4128f04dbbcf29f7808a1d172c559aa60ac6
6
+ metadata.gz: 382e8fbc12ed460abedd332e734902dff596a2a86b52606a4950c6c7bd64cf8ea591ad3e4a6baa23c12ef65171f62cdafa6d89901710bc04ad7fd6181dd57421
7
+ data.tar.gz: 3cac5a75ec2fe95ad0a67284a0db2bc7cd1b7679a0a117ce6c10f6c41998ed4e247883bfc441519501f6be71b4810e4022c488c229d1ed85d840cf21f81bc235
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v3.0.28
2
+ * Fix sub! when no hash is provided (#236)
3
+ * Only run template extraction when required
4
+ * Use explicit type checks when searching for nested stacks
5
+ * Fix output bubbling to use proper nil checking
6
+
1
7
  # v3.0.26
2
8
  * Allow Fn::Sub helper to accept no arguments
3
9
  * Fix Ruby 2.4 deprecation warnings
@@ -24,10 +24,10 @@ class SparkleFormation
24
24
  # @option args [Array<Component>] :components seed components for composition
25
25
  # @option args [Array<Override>] :overrides seed overrides for composition
26
26
  # @return [self]
27
- def initialize(origin, args={})
28
- unless(origin.is_a?(SparkleFormation))
27
+ def initialize(origin, args = {})
28
+ unless origin.is_a?(SparkleFormation)
29
29
  raise TypeError.new 'Composition requires `SparkleFormation` instance as origin. ' \
30
- "Received origin type `#{origin.class}`."
30
+ "Received origin type `#{origin.class}`."
31
31
  end
32
32
  @origin = origin
33
33
  @components_list = []
@@ -62,11 +62,11 @@ class SparkleFormation
62
62
  # @param item [Component, Override]
63
63
  # @param location [Symbol] :prepend or :append (defaults to :append)
64
64
  # @return [self]
65
- def add_component(item, location=:append)
66
- unless(item.is_a?(Component) || item.is_a?(Override))
65
+ def add_component(item, location = :append)
66
+ unless item.is_a?(Component) || item.is_a?(Override)
67
67
  raise TypeError.new("Expecting `Component` or `Override` but received `#{item.class}`")
68
68
  end
69
- if(item.respond_to?(:key) && component_keys.include?(item.key))
69
+ if item.respond_to?(:key) && component_keys.include?(item.key)
70
70
  # do nothing
71
71
  else
72
72
  case location
@@ -76,7 +76,7 @@ class SparkleFormation
76
76
  components_list.unshift(item)
77
77
  else
78
78
  raise ArgumentError.new 'Unknown addition location provided. Valid: `:append, :prepend`. ' \
79
- "Received: `#{location.inspect}`"
79
+ "Received: `#{location.inspect}`"
80
80
  end
81
81
  end
82
82
  self
@@ -87,8 +87,8 @@ class SparkleFormation
87
87
  # @param item [Override]
88
88
  # @param location [Symbol] :prepend or :append (defaults to :append)
89
89
  # @return [self]
90
- def add_override(item, location=:append)
91
- unless(item.is_a?(Override))
90
+ def add_override(item, location = :append)
91
+ unless item.is_a?(Override)
92
92
  raise TypeError.new("Expecting `Override` but received `#{item.class}`")
93
93
  end
94
94
  case location
@@ -98,7 +98,7 @@ class SparkleFormation
98
98
  overrides_list.unshift(item)
99
99
  else
100
100
  raise ArgumentError.new 'Unknown addition location provided. Valid: ' \
101
- "`:append, :prepend`. Received: `#{location.inspect}`"
101
+ "`:append, :prepend`. Received: `#{location.inspect}`"
102
102
  end
103
103
  self
104
104
  end
@@ -109,7 +109,7 @@ class SparkleFormation
109
109
  # @param location [Symbol] :prepend or :append (defaults to :append)
110
110
  # @yield component block (optional)
111
111
  # @return [self]
112
- def new_component(key, location=:append, &block)
112
+ def new_component(key, location = :append, &block)
113
113
  comp = Component.new(origin, key, block)
114
114
  add_component(comp, location)
115
115
  self
@@ -121,8 +121,8 @@ class SparkleFormation
121
121
  # @param location [Symbol] :prepend or :append (defaults to :append)
122
122
  # @yield override block
123
123
  # @return [self]
124
- def new_override(args={}, location=:append, &block)
125
- if(args.is_a?(Symbol))
124
+ def new_override(args = {}, location = :append, &block)
125
+ if args.is_a?(Symbol)
126
126
  location = args
127
127
  args = {}
128
128
  end
@@ -137,7 +137,7 @@ class SparkleFormation
137
137
  # @yieldparam [Component, Override]
138
138
  # @return [self]
139
139
  def each
140
- if(block_given?)
140
+ if block_given?
141
141
  composite.each do |item|
142
142
  yield item
143
143
  end
@@ -162,14 +162,14 @@ class SparkleFormation
162
162
  # @return [Array]
163
163
  def seed_value(items, type)
164
164
  type = [type].flatten.compact
165
- if(items)
165
+ if items
166
166
  items.each do |item|
167
167
  valid_item = type.any? do |klass|
168
168
  item.is_a?(klass)
169
169
  end
170
- unless(valid_item)
170
+ unless valid_item
171
171
  raise TypeError.new "Invalid type encountered within collection `#{item.class}`. " \
172
- "Expected `#{type.map(&:to_s).join('`, `')}`."
172
+ "Expected `#{type.map(&:to_s).join('`, `')}`."
173
173
  end
174
174
  end
175
175
  items.dup
@@ -16,7 +16,7 @@ class SparkleFormation
16
16
  attr_reader :name
17
17
 
18
18
  def initialize(*args)
19
- opts = args.detect{|o| o.is_a?(Hash)}
19
+ opts = args.detect { |o| o.is_a?(Hash) }
20
20
  args.delete(opts) if opts
21
21
  super(args)
22
22
  @name = opts[:name] if opts
@@ -24,7 +24,7 @@ class SparkleFormation
24
24
 
25
25
  # @return [String] customized message including name
26
26
  def to_s
27
- if(name)
27
+ if name
28
28
  "Failed to locate item named: `#{name}`"
29
29
  else
30
30
  'Failed to locate item'
@@ -39,12 +39,9 @@ class SparkleFormation
39
39
 
40
40
  # Template internals
41
41
  class Resource < NotFound; end
42
-
43
42
  end
44
43
 
45
44
  # Deprecation error
46
45
  class Deprecated < Error; end
47
-
48
46
  end
49
-
50
47
  end
@@ -16,12 +16,12 @@ class SparkleFormation
16
16
  # @param f_name [String] name of function
17
17
  # @param args [Array<Object>] argument list
18
18
  # @return [self]
19
- def initialize(f_name=nil, *args)
19
+ def initialize(f_name = nil, *args)
20
20
  super()
21
21
  @_fn_name = f_name.to_s
22
22
  @_fn_args = args
23
23
  @_fn_args.map! do |l_arg|
24
- if(l_arg.is_a?(_klass))
24
+ if l_arg.is_a?(_klass)
25
25
  l_arg = l_arg._root
26
26
  l_arg._parent(self)
27
27
  end
@@ -33,13 +33,13 @@ class SparkleFormation
33
33
  def _clone(*_)
34
34
  new_inst = _klass_new(_fn_name, *_fn_args)
35
35
  new_inst._data.replace(__hashish[
36
- @table.map{ |_key, _value|
37
- if(_key.is_a?(::AttributeStruct))
36
+ @table.map { |_key, _value|
37
+ if _key.is_a?(::AttributeStruct)
38
38
  _key = _key._clone
39
39
  else
40
40
  _key = _do_dup(_key)
41
41
  end
42
- if(_value.is_a?(::AttributeStruct))
42
+ if _value.is_a?(::AttributeStruct)
43
43
  _value = _value._clone
44
44
  else
45
45
  _value = _do_dup(_value)
@@ -57,7 +57,7 @@ class SparkleFormation
57
57
 
58
58
  # @return [TrueClass, FalseClass]
59
59
  def eql?(_other)
60
- if(_other.respond_to?(:_dump) && _other.respond_to?(:_parent))
60
+ if _other.respond_to?(:_dump) && _other.respond_to?(:_parent)
61
61
  ::MultiJson.dump(_dump).hash ==
62
62
  ::MultiJson.dump(_other._dump).hash &&
63
63
  _parent == _other._parent
@@ -88,7 +88,7 @@ class SparkleFormation
88
88
  # @param args [Object<Array>] argument list
89
89
  # @return [Object]
90
90
  def method_missing(name, *args)
91
- if(args.empty?)
91
+ if args.empty?
92
92
  super
93
93
  else
94
94
  @table['_function_'] = _klass_new(name, *args)
@@ -100,7 +100,7 @@ class SparkleFormation
100
100
  # @param val [Integer, String]
101
101
  # @return [FunctionStruct]
102
102
  def [](val)
103
- if(val.is_a?(::String) && __single_quote_strings)
103
+ if val.is_a?(::String) && __single_quote_strings
104
104
  _set("['#{val}']")
105
105
  else
106
106
  _set("[#{val.inspect}]")
@@ -111,39 +111,39 @@ class SparkleFormation
111
111
  #
112
112
  # @return [String]
113
113
  def _dump
114
- unless(@table.empty?)
114
+ unless @table.empty?
115
115
  key, value = @table.first
116
116
  suffix = _eval_join(
117
117
  *[
118
- key == '_function_' ? nil : key,
119
- !value.nil? ? value._dump : nil
120
- ].compact
118
+ key == '_function_' ? nil : key,
119
+ !value.nil? ? value._dump : nil,
120
+ ].compact
121
121
  )
122
122
  end
123
- if(_fn_name)
123
+ if _fn_name
124
124
  args = _fn_args.map do |arg|
125
- if(arg.respond_to?(:_dump))
125
+ if arg.respond_to?(:_dump)
126
126
  arg._dump
127
- elsif(arg.is_a?(::Symbol))
127
+ elsif arg.is_a?(::Symbol)
128
128
  quote = __single_quote_strings ? "'" : '"'
129
129
  "#{quote}#{::Bogo::Utility.camel(arg.to_s, false)}#{quote}"
130
- elsif(arg.is_a?(::String) && __single_quote_strings)
130
+ elsif arg.is_a?(::String) && __single_quote_strings
131
131
  "'#{arg}'"
132
132
  else
133
133
  arg.inspect
134
134
  end
135
135
  end.join(', ')
136
- unless(_fn_name.to_s.empty?)
136
+ unless _fn_name.to_s.empty?
137
137
  function_name = args.empty? ? "#{_fn_name}#{__empty_argument_list}" : "#{_fn_name}(#{args})"
138
138
  end
139
139
  internal = _eval_join(
140
140
  *[
141
- function_name,
142
- suffix
143
- ].compact
141
+ function_name,
142
+ suffix,
143
+ ].compact
144
144
  )
145
- if(root? || (!__single_anchor? && function_name))
146
- if(!root? && __quote_nested_funcs?)
145
+ if root? || (!__single_anchor? && function_name)
146
+ if !root? && __quote_nested_funcs?
147
147
  quote = __single_quote_strings ? "'" : '"'
148
148
  end
149
149
  "#{quote}#{__anchor_start}#{internal}#{__anchor_stop}#{quote}"
@@ -154,6 +154,7 @@ class SparkleFormation
154
154
  suffix
155
155
  end
156
156
  end
157
+
157
158
  alias_method :_sparkle_dump, :_dump
158
159
 
159
160
  # Join arguments into a string for remote evaluation
@@ -162,9 +163,9 @@ class SparkleFormation
162
163
  # @return [String]
163
164
  def _eval_join(*args)
164
165
  args = args.compact
165
- args.delete_if(&:empty?)
166
+ args.delete_if &:empty?
166
167
  args.slice(1, args.size).to_a.inject(args.first) do |memo, item|
167
- if(item.start_with?('['))
168
+ if item.start_with?('[')
168
169
  memo += item
169
170
  else
170
171
  memo += ".#{item}"
@@ -215,7 +216,6 @@ class SparkleFormation
215
216
  def __single_quote_strings
216
217
  true
217
218
  end
218
-
219
219
  end
220
220
 
221
221
  # Function struct specialized for Azure variables to check nested
@@ -236,14 +236,14 @@ class SparkleFormation
236
236
  # the function if found.
237
237
  def _dump
238
238
  # Remap nested function keys if possible
239
- if(_fn_context && _fn_context.root!.data![_fn_name] && _fn_context.root!.data![_fn_name].data![_fn_args.first])
239
+ if _fn_context && _fn_context.root!.data![_fn_name] && _fn_context.root!.data![_fn_name].data![_fn_args.first]
240
240
  __valid_keys = _fn_context.root!.data![_fn_name].data![_fn_args.first].keys!
241
241
  __current_key = @table.keys.first
242
242
  __match_key = __current_key.to_s.downcase.gsub('_', '')
243
243
  __key_remap = __valid_keys.detect do |__nested_key|
244
244
  __nested_key.to_s.downcase.gsub('_', '') == __match_key
245
245
  end
246
- if(__key_remap)
246
+ if __key_remap
247
247
  @table[__key_remap] = @table.delete(@table.keys.first)
248
248
  end
249
249
  end
@@ -283,7 +283,6 @@ class SparkleFormation
283
283
  def _klass
284
284
  ::SparkleFormation::JinjaExpressionStruct
285
285
  end
286
-
287
286
  end
288
287
 
289
288
  # FunctionStruct for jinja statements
@@ -313,7 +312,6 @@ class SparkleFormation
313
312
  def _klass
314
313
  ::SparkleFormation::JinjaStatementStruct
315
314
  end
316
-
317
315
  end
318
316
 
319
317
  # FunctionStruct for customized google functions
@@ -343,7 +341,6 @@ class SparkleFormation
343
341
  def _klass
344
342
  ::SparkleFormation::GoogleStruct
345
343
  end
346
-
347
344
  end
348
345
 
349
346
  # FunctionStruct for customized terraform functions
@@ -382,6 +379,5 @@ class SparkleFormation
382
379
  def _klass
383
380
  ::SparkleFormation::TerraformStruct
384
381
  end
385
-
386
382
  end
387
383
  end
@@ -17,13 +17,13 @@ class SparkleFormation
17
17
  statements = []
18
18
  compile.resources.keys!.each do |r_name|
19
19
  r_object = compile.resources[r_name]
20
- if(r_object['Policy'])
20
+ if r_object['Policy']
21
21
  r_object['Policy'].keys!.each do |effect|
22
22
  statements.push(
23
23
  'Effect' => effect.to_s.capitalize,
24
- 'Action' => [r_object['Policy'][effect]].flatten.compact.map{|i| "Update:#{i}"},
24
+ 'Action' => [r_object['Policy'][effect]].flatten.compact.map { |i| "Update:#{i}" },
25
25
  'Resource' => "LogicalResourceId/#{r_name}",
26
- 'Principal' => '*'
26
+ 'Principal' => '*',
27
27
  )
28
28
  end
29
29
  r_object.delete!('Policy')
@@ -33,7 +33,7 @@ class SparkleFormation
33
33
  'Effect' => 'Allow',
34
34
  'Action' => 'Update:*',
35
35
  'Resource' => '*',
36
- 'Principal' => '*'
36
+ 'Principal' => '*',
37
37
  )
38
38
  Smash.new('Statement' => statements)
39
39
  end
@@ -51,15 +51,15 @@ class SparkleFormation
51
51
  def apply_deep_nesting(*args, &block)
52
52
  outputs = collect_outputs
53
53
  nested_stacks(:with_resource).each do |stack, resource|
54
- unless(stack.nested_stacks.empty?)
54
+ unless stack.nested_stacks.empty?
55
55
  stack.apply_deep_nesting(*args)
56
56
  end
57
- unless(stack.root?)
57
+ unless stack.root?
58
58
  stack.compile.parameters.keys!.each do |parameter_name|
59
59
  next if stack.compile.parameters.set!(parameter_name).stack_unique == true
60
- if(!stack.parent.compile.parameters.data![parameter_name].nil?)
60
+ if !stack.parent.compile.parameters.data![parameter_name].nil?
61
61
  resource.properties.parameters.set!(parameter_name, resource.ref!(parameter_name))
62
- elsif(output_name = output_matched?(parameter_name, outputs.keys))
62
+ elsif output_name = output_matched?(parameter_name, outputs.keys)
63
63
  next if outputs[output_name] == stack
64
64
  stack_output = stack.make_output_available(output_name, outputs)
65
65
  resource.properties.parameters.set!(parameter_name, stack_output)
@@ -67,7 +67,7 @@ class SparkleFormation
67
67
  end
68
68
  end
69
69
  end
70
- if(block_given?)
70
+ if block_given?
71
71
  extract_templates(&block)
72
72
  end
73
73
  compile
@@ -88,18 +88,20 @@ class SparkleFormation
88
88
  nested_stacks(:with_resource, :with_name).each do |_stack, stack_resource, stack_name|
89
89
  remap_nested_parameters(compile, parameters, stack_name, stack_resource, output_map)
90
90
  end
91
- extract_templates(&block)
91
+ if block_given?
92
+ extract_templates(&block)
93
+ end
92
94
  compile.parameters parameters
93
- if(args.include?(:bubble_outputs))
95
+ if args.include?(:bubble_outputs)
94
96
  outputs_hash = Hash[
95
- output_map do |name, value|
97
+ output_map.map do |name, value|
96
98
  [name, {'Value' => {'Fn::GetAtt' => value}}]
97
99
  end
98
100
  ]
99
- if(compile.outputs)
101
+ unless compile.outputs.nil?
100
102
  compile._merge(compile._klass_new(outputs_hash))
101
103
  else
102
- compile.outputs output_hash
104
+ compile.outputs outputs_hash
103
105
  end
104
106
  end
105
107
  compile
@@ -122,26 +124,26 @@ class SparkleFormation
122
124
  )
123
125
  )
124
126
  end
125
- if(bubble_path.empty?)
126
- if(drip_path.size == 1)
127
+ if bubble_path.empty?
128
+ if drip_path.size == 1
127
129
  parent = drip_path.first.parent
128
- if(parent && parent.compile.parameters.data![output_name])
130
+ if parent && parent.compile.parameters.data![output_name]
129
131
  return compile.ref!(output_name)
130
132
  end
131
133
  end
132
134
  raise ArgumentError.new "Failed to detect available bubbling path for output `#{output_name}`. " <<
133
- 'This may be due to a circular dependency! ' <<
134
- "(Output Path: #{outputs[output_name].root_path.map(&:name).join(' > ')} " <<
135
- "Requester Path: #{root_path.map(&:name).join(' > ')})"
135
+ 'This may be due to a circular dependency! ' <<
136
+ "(Output Path: #{outputs[output_name].root_path.map(&:name).join(' > ')} " <<
137
+ "Requester Path: #{root_path.map(&:name).join(' > ')})"
136
138
  end
137
139
  result = compile.attr!(bubble_path.first.name, "Outputs.#{output_name}")
138
- if(drip_path.size > 1)
140
+ if drip_path.size > 1
139
141
  parent = drip_path.first.parent
140
142
  drip_path.unshift(parent) if parent
141
143
  drip_path.each_slice(2) do |base_sparkle, ref_sparkle|
142
144
  next unless ref_sparkle
143
145
  base_sparkle.compile.resources[ref_sparkle.name].properties.parameters.set!(output_name, result)
144
- ref_sparkle.compile.parameters.set!(output_name){ type 'String' } # TODO: <<<<------ type check and prop
146
+ ref_sparkle.compile.parameters.set!(output_name) { type 'String' } # TODO: <<<<------ type check and prop
145
147
  result = compile.ref!(output_name)
146
148
  end
147
149
  end
@@ -164,26 +166,26 @@ class SparkleFormation
164
166
  # be added to container stack and it will not use outputs
165
167
  def remap_nested_parameters(template, parameters, stack_name, stack_resource, output_map)
166
168
  stack_parameters = stack_resource.properties.stack.compile.parameters
167
- unless(stack_parameters.nil?)
169
+ unless stack_parameters.nil?
168
170
  stack_parameters._dump.each do |pname, pval|
169
- if(pval['StackUnique'])
171
+ if pval['StackUnique']
170
172
  check_name = [stack_name, pname].join
171
173
  else
172
174
  check_name = pname
173
175
  end
174
- if(parameters.keys.include?(check_name))
175
- if(list_type?(parameters[check_name]['Type']))
176
+ if parameters.keys.include?(check_name)
177
+ if list_type?(parameters[check_name]['Type'])
176
178
  new_val = {'Fn::Join' => [',', {'Ref' => check_name}]}
177
179
  else
178
180
  new_val = {'Ref' => check_name}
179
181
  end
180
182
  template.resources.set!(stack_name).properties.parameters.set!(pname, new_val)
181
- elsif(output_map[check_name])
183
+ elsif output_map[check_name]
182
184
  template.resources.set!(stack_name).properties.parameters.set!(
183
- pname, 'Fn::GetAtt' => output_map[check_name]
185
+ pname, 'Fn::GetAtt' => output_map[check_name],
184
186
  )
185
187
  else
186
- if(list_type?(pval['Type']))
188
+ if list_type?(pval['Type'])
187
189
  new_val = {'Fn::Join' => [',', {'Ref' => check_name}]}
188
190
  else
189
191
  new_val = {'Ref' => check_name}
@@ -193,7 +195,7 @@ class SparkleFormation
193
195
  end
194
196
  end
195
197
  end
196
- unless(stack_resource.properties.stack.compile.outputs.nil?)
198
+ unless stack_resource.properties.stack.compile.outputs.nil?
197
199
  stack_resource.properties.stack.compile.outputs.keys!.each do |oname|
198
200
  output_map[oname] = [stack_name, "Outputs.#{oname}"]
199
201
  end
@@ -208,7 +210,6 @@ class SparkleFormation
208
210
  def list_type?(type)
209
211
  type == 'CommaDelimitedList' || type.start_with?('List<')
210
212
  end
211
-
212
213
  end
213
214
  end
214
215
  end
@@ -41,15 +41,15 @@ class SparkleFormation
41
41
  def apply_deep_nesting(*args, &block)
42
42
  outputs = collect_outputs
43
43
  nested_stacks(:with_resource).each do |stack, resource|
44
- unless(stack.nested_stacks.empty?)
44
+ unless stack.nested_stacks.empty?
45
45
  stack.apply_deep_nesting(*args)
46
46
  end
47
- unless(stack.root?)
47
+ unless stack.root?
48
48
  stack.compile.parameters.keys!.each do |parameter_name|
49
49
  next if stack.compile.parameters.set!(parameter_name).stack_unique == true
50
- if(!stack.parent.compile.parameters.data![parameter_name].nil?)
50
+ if !stack.parent.compile.parameters.data![parameter_name].nil?
51
51
  resource.properties.parameters.set!(parameter_name, resource.ref!(parameter_name))
52
- elsif(output_name = output_matched?(parameter_name, outputs.keys))
52
+ elsif output_name = output_matched?(parameter_name, outputs.keys)
53
53
  next if outputs[output_name] == stack
54
54
  stack_output = stack.make_output_available(output_name, outputs)
55
55
  resource.properties.parameters.set!(parameter_name, stack_output)
@@ -57,7 +57,7 @@ class SparkleFormation
57
57
  end
58
58
  end
59
59
  end
60
- if(block_given?)
60
+ if block_given?
61
61
  extract_templates(&block)
62
62
  end
63
63
  compile
@@ -79,7 +79,7 @@ class SparkleFormation
79
79
  remap_nested_parameters(compile, parameters, stack_name, stack_resource, output_map)
80
80
  end
81
81
  extract_templates(&block)
82
- if(args.include?(:bubble_outputs))
82
+ if args.include?(:bubble_outputs)
83
83
  output_map.each do |o_name, o_val|
84
84
  compile.outputs._set(o_name).value compile._stack_output(*o_val)
85
85
  end
@@ -104,20 +104,20 @@ class SparkleFormation
104
104
  )
105
105
  )
106
106
  end
107
- if(bubble_path.empty?)
108
- if(drip_path.size == 1)
107
+ if bubble_path.empty?
108
+ if drip_path.size == 1
109
109
  parent = drip_path.first.parent
110
- if(parent && !parent.compile.parameters._set(output_name).nil?)
110
+ if parent && !parent.compile.parameters._set(output_name).nil?
111
111
  return compile.parameter!(output_name)
112
112
  end
113
113
  end
114
114
  raise ArgumentError.new "Failed to detect available bubbling path for output `#{output_name}`. " <<
115
- 'This may be due to a circular dependency! ' <<
116
- "(Output Path: #{outputs[output_name].root_path.map(&:name).join(' > ')} " <<
117
- "Requester Path: #{root_path.map(&:name).join(' > ')})"
115
+ 'This may be due to a circular dependency! ' <<
116
+ "(Output Path: #{outputs[output_name].root_path.map(&:name).join(' > ')} " <<
117
+ "Requester Path: #{root_path.map(&:name).join(' > ')})"
118
118
  end
119
119
  result = compile._stack_output(bubble_path.first.name, output_name)
120
- if(drip_path.size > 1)
120
+ if drip_path.size > 1
121
121
  parent = drip_path.first.parent
122
122
  drip_path.unshift(parent) if parent
123
123
  drip_path.each_slice(2) do |base_sparkle, ref_sparkle|
@@ -147,19 +147,19 @@ class SparkleFormation
147
147
  def remap_nested_parameters(template, parameters, stack_name, stack_resource, output_map)
148
148
  nested_template = stack_resource.properties.stack.compile
149
149
  stack_parameters = nested_template.parameters
150
- unless(stack_parameters.nil?)
150
+ unless stack_parameters.nil?
151
151
  stack_parameters._keys.each do |pname|
152
152
  pval = stack_parameters[pname]
153
- unless(pval.stack_unique.nil?)
153
+ unless pval.stack_unique.nil?
154
154
  check_name = [stack_name, pname].join
155
155
  else
156
156
  check_name = pname
157
157
  end
158
- if(!parameters._set(check_name).nil?)
158
+ if !parameters._set(check_name).nil?
159
159
  template.resources._set(stack_name).properties.parameters._set(pname).value(
160
160
  template._parameter(check_name)
161
161
  )
162
- elsif(output_map[check_name])
162
+ elsif output_map[check_name]
163
163
  template.resources._set(stack_name).properties.parameters._set(pname).value(
164
164
  template._stack_output(*output_map[check_name])
165
165
  )
@@ -171,14 +171,13 @@ class SparkleFormation
171
171
  end
172
172
  end
173
173
  end
174
- unless(nested_template.outputs.nil?)
174
+ unless nested_template.outputs.nil?
175
175
  nested_template.outputs.keys!.each do |oname|
176
176
  output_map[oname] = [stack_name, oname]
177
177
  end
178
178
  end
179
179
  true
180
180
  end
181
-
182
181
  end
183
182
  end
184
183
  end