sparkle_formation 3.0.16 → 3.0.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sparkle_formation.rb +1 -0
- data/lib/sparkle_formation/function_struct.rb +38 -0
- data/lib/sparkle_formation/provider/aws.rb +1 -1
- data/lib/sparkle_formation/provider/azure.rb +10 -5
- data/lib/sparkle_formation/sparkle_attribute/azure.rb +10 -1
- data/lib/sparkle_formation/sparkle_formation.rb +9 -7
- data/lib/sparkle_formation/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: 14385f4b5ede6c882f0f996a4f19c58c551d6b26
|
4
|
+
data.tar.gz: e4a313a0d73d91d7fa512d2e67dfc70f8e281e3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5ec3a38b93458caf38e9119cdcfc07c97726955ea68630af1504afd33f3a61af4e4f01a7a44623da62e448dbc0f9d5c81f40f223161d0059e7b69f1dddb0489
|
7
|
+
data.tar.gz: 5158012d4f61b3f2a1f1afcc555fd6a5004ae534b9d8a6a10b3583c82dae0ce48e4694408752d24487ff3412de2c839d7efb45997d8f4d4d237c1b904dd941a5
|
data/CHANGELOG.md
CHANGED
data/lib/sparkle_formation.rb
CHANGED
@@ -5,6 +5,7 @@ require 'attribute_struct'
|
|
5
5
|
# Unicorns and rainbows
|
6
6
|
class SparkleFormation
|
7
7
|
autoload :Aws, 'sparkle_formation/aws'
|
8
|
+
autoload :AzureVariableStruct, 'sparkle_formation/function_struct'
|
8
9
|
autoload :Composition, 'sparkle_formation/composition'
|
9
10
|
autoload :Error, 'sparkle_formation/error'
|
10
11
|
autoload :FunctionStruct, 'sparkle_formation/function_struct'
|
@@ -175,6 +175,44 @@ class SparkleFormation
|
|
175
175
|
|
176
176
|
end
|
177
177
|
|
178
|
+
# Function struct specialized for Azure variables to check nested
|
179
|
+
# variable function value and properly match defined case
|
180
|
+
class AzureVariableStruct < FunctionStruct
|
181
|
+
# [SparkleStruct] context of function usage
|
182
|
+
attr_reader :_fn_context
|
183
|
+
|
184
|
+
# Set current function context
|
185
|
+
#
|
186
|
+
# @param ctx [SparkleStruct] current context
|
187
|
+
# @return [SparkleStruct]
|
188
|
+
def _fn_context=(ctx)
|
189
|
+
@_fn_context = ctx
|
190
|
+
end
|
191
|
+
|
192
|
+
# Wrapper to check for nested function call and properly case
|
193
|
+
# the function if found.
|
194
|
+
def _dump
|
195
|
+
# Remap nested function keys if possible
|
196
|
+
if(_fn_context && _fn_context.root!.data![_fn_name] && _fn_context.root!.data![_fn_name].data![_fn_args.first])
|
197
|
+
__valid_keys = _fn_context.root!.data![_fn_name].data![_fn_args.first].keys!
|
198
|
+
__current_key = @table.keys.first
|
199
|
+
__match_key = __current_key.to_s.downcase.gsub('_', '')
|
200
|
+
__key_remap = __valid_keys.detect do |__nested_key|
|
201
|
+
__nested_key.to_s.downcase.gsub('_', '') == __match_key
|
202
|
+
end
|
203
|
+
if(__key_remap)
|
204
|
+
@table[__key_remap] = @table.delete(@table.keys.first)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
super
|
208
|
+
end
|
209
|
+
|
210
|
+
# @return [Class]
|
211
|
+
def _klass
|
212
|
+
::SparkleFormation::AzureVariableStruct
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
178
216
|
# FunctionStruct for jinja expressions
|
179
217
|
class JinjaExpressionStruct < FunctionStruct
|
180
218
|
|
@@ -57,7 +57,7 @@ class SparkleFormation
|
|
57
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.
|
60
|
+
if(!stack.parent.compile.parameters.data![parameter_name].nil?)
|
61
61
|
resource.properties.parameters.set!(parameter_name, resource.ref!(parameter_name))
|
62
62
|
elsif(output_name = output_matched?(parameter_name, outputs.keys))
|
63
63
|
next if outputs[output_name] == stack
|
@@ -33,11 +33,16 @@ class SparkleFormation
|
|
33
33
|
unless(stack.nested_stacks.empty?)
|
34
34
|
stack.apply_deep_nesting(*args)
|
35
35
|
end
|
36
|
-
stack.
|
37
|
-
|
38
|
-
next if
|
39
|
-
|
40
|
-
|
36
|
+
unless(stack.root?)
|
37
|
+
stack.compile.parameters.keys!.each do |parameter_name|
|
38
|
+
next if stack.compile.parameters.set!(parameter_name).stack_unique == true
|
39
|
+
if(!stack.parent.compile.parameters.data![parameter_name].nil?)
|
40
|
+
resource.properties.parameters.set!(parameter_name, resource.ref!(parameter_name))
|
41
|
+
elsif(output_name = output_matched?(parameter_name, outputs.keys))
|
42
|
+
next if outputs[output_name] == stack
|
43
|
+
stack_output = stack.make_output_available(output_name, outputs)
|
44
|
+
resource.properties.parameters.set!(parameter_name, stack_output)
|
45
|
+
end
|
41
46
|
end
|
42
47
|
end
|
43
48
|
end
|
@@ -69,7 +69,6 @@ class SparkleFormation
|
|
69
69
|
'uri',
|
70
70
|
'deployment',
|
71
71
|
'parameters',
|
72
|
-
'variables',
|
73
72
|
'listKeys',
|
74
73
|
'providers',
|
75
74
|
'reference',
|
@@ -103,6 +102,16 @@ class SparkleFormation
|
|
103
102
|
alias_method "#{f_name}!".to_sym, "_#{f_name}".to_sym
|
104
103
|
end
|
105
104
|
|
105
|
+
# Variables generator
|
106
|
+
#
|
107
|
+
# @return [SparkleFormation::AzureVariableStruct]
|
108
|
+
def _variables(*args)
|
109
|
+
x = ::SparkleFormation::AzureVariableStruct.new('variables', *args)
|
110
|
+
x._fn_context = self
|
111
|
+
x
|
112
|
+
end
|
113
|
+
alias_method :variables!, :_variables
|
114
|
+
|
106
115
|
# @overload _resource_id(resource_name)
|
107
116
|
# Customized resourceId generator that will perform automatic
|
108
117
|
# lookup on defined resources for building the function if Symbol
|
@@ -755,14 +755,16 @@ class SparkleFormation
|
|
755
755
|
if(compile[:resources])
|
756
756
|
compile.resources.keys!.map do |key|
|
757
757
|
if(stack_resource_type?(compile.resources[key].type))
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
758
|
+
if(compile.resources[key].properties.stack.is_a?(::SparkleFormation))
|
759
|
+
result = [compile.resources[key].properties.stack]
|
760
|
+
if(args.include?(:with_resource))
|
761
|
+
result.push(compile[:resources][key])
|
762
|
+
end
|
763
|
+
if(args.include?(:with_name))
|
764
|
+
result.push(key)
|
765
|
+
end
|
766
|
+
result.size == 1 ? result.first : result
|
764
767
|
end
|
765
|
-
result.size == 1 ? result.first : result
|
766
768
|
end
|
767
769
|
end.compact
|
768
770
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparkle_formation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: attribute_struct
|