sparkle_formation 3.0.24 → 3.0.26

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: 7f10d97f5400c05205b7164247b875d778ae0491
4
- data.tar.gz: 6b3dd43d3cbd5a63117f03c7241bb47cc1fa3926
3
+ metadata.gz: 33f948df7a83782e8ab90fd9900cae9e88e5e4bb
4
+ data.tar.gz: 9329bf4f33788f8ad4589828f1a38ace0c3c0af7
5
5
  SHA512:
6
- metadata.gz: d7aafb751e1c143ac1e19fbb2b18965f66a7d7b92d6d5254495dc05603462bec8359d0866f7be643bb5603106e9be2352fd627e6669f13873d27c0d0e27a2dc6
7
- data.tar.gz: 12e0402332fd2b41605847be8c10243648203a3e8d63facfe230cd86a3660f8e9a4335c9e51f76c4466a93e322f18ebd2fc5c43afcc3e69d51cc077a1ceb0e58
6
+ metadata.gz: 63f3a963ac6233c943c897df5e9d462933384060e42e6beb00a6502186a3f35f6e97659a66b757e60d48a3b44322bc31f8bd2bb5a5dd5a37262db3fbcc2f55c8
7
+ data.tar.gz: 35ede30d5db9519d4d8c41db21119d4d9de5328ce525f41d086f583a6212b7a2a3a5102feb9579a537c1a1f56f5a4128f04dbbcf29f7808a1d172c559aa60ac6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # v3.0.26
2
+ * Allow Fn::Sub helper to accept no arguments
3
+ * Fix Ruby 2.4 deprecation warnings
4
+ * Only store compile state when value is set
5
+ * Fix FunctionStruct clone behavior for Azure
6
+ * Lookup resources for taggable? helper through loaded provider
7
+
1
8
  # v3.0.24
2
9
  * Update value storage to handle FunctionStruct usage
3
10
  * Add Complex data type to allowed compile time parameter types
@@ -29,9 +29,25 @@ class SparkleFormation
29
29
  end
30
30
  end
31
31
 
32
- # # Create a clone of this instance
32
+ # Create a clone of this instance
33
33
  def _clone(*_)
34
- _klass.new(_fn_name, *_fn_args)
34
+ new_inst = _klass_new(_fn_name, *_fn_args)
35
+ new_inst._data.replace(__hashish[
36
+ @table.map{ |_key, _value|
37
+ if(_key.is_a?(::AttributeStruct))
38
+ _key = _key._clone
39
+ else
40
+ _key = _do_dup(_key)
41
+ end
42
+ if(_value.is_a?(::AttributeStruct))
43
+ _value = _value._clone
44
+ else
45
+ _value = _do_dup(_value)
46
+ end
47
+ [_key, _value]
48
+ }
49
+ ])
50
+ new_inst
35
51
  end
36
52
 
37
53
  # @return [Numeric] hash value for instance
@@ -138,6 +154,7 @@ class SparkleFormation
138
154
  suffix
139
155
  end
140
156
  end
157
+ alias_method :_sparkle_dump, :_dump
141
158
 
142
159
  # Join arguments into a string for remote evaluation
143
160
  #
@@ -108,9 +108,18 @@ class SparkleFormation
108
108
 
109
109
  # NOTE: Enable access to top level constants but do not
110
110
  # include deprecated constants to prevent warning outputs
111
+ deprecated_constants = [
112
+ :Config,
113
+ :TimeoutError,
114
+ :Fixnum,
115
+ :Bignum,
116
+ :NIL,
117
+ :TRUE,
118
+ :FALSE
119
+ ]
111
120
  ::Object.constants.each do |const|
112
121
  unless(self.const_defined?(const)) # rubocop:disable Style/RedundantSelf
113
- next if const == :Config || const == :TimeoutError
122
+ next if deprecated_constants.include?(const)
114
123
  self.const_set(const, ::Object.const_get(const)) # rubocop:disable Style/RedundantSelf
115
124
  end
116
125
  end
@@ -42,9 +42,9 @@ class SparkleFormation
42
42
  # @param string [String, Hash] string to apply substitution
43
43
  # @param variables [Hash] key value mappings for substitution
44
44
  # @return [Hash]
45
- def _cf_sub(string, variables)
46
- __t_hashish(variables)
47
- {'Fn::Sub' => [string, variables]}
45
+ def _cf_sub(string, variables = nil)
46
+ __t_hashish(variables) if variables
47
+ {'Fn::Sub' => [string, variables].compact}
48
48
  end
49
49
  alias_method :_sub, :_cf_sub
50
50
  alias_method :sub!, :_cf_sub
@@ -329,7 +329,7 @@ class SparkleFormation
329
329
  # @return [TrueClass, FalseClass] resource can be tagged
330
330
  def taggable?
331
331
  if(self[:type])
332
- resource = _self.lookup(self[:type].gsub('::', '_').downcase)
332
+ resource = _self._provider._resources.lookup(self[:type].gsub('::', '_').downcase)
333
333
  resource && resource[:properties].include?('Tags')
334
334
  else
335
335
  if(_parent)
@@ -689,8 +689,8 @@ class SparkleFormation
689
689
  # @option args [Hash] :state local state parameters
690
690
  # @return [SparkleStruct]
691
691
  def compile(args={})
692
- if(args.key?(:state))
693
- @compile_state = args[:state]
692
+ if(args.key?(:state) && args.is_a?(Hash))
693
+ @compile_state = args[:state].to_smash
694
694
  unmemoize(:compile)
695
695
  end
696
696
  memoize(:compile) do
@@ -758,7 +758,9 @@ class SparkleFormation
758
758
  storage_compile_state[param_key] = compile_state[param_key]
759
759
  end
760
760
  end
761
- compiled.outputs.compile_state.value MultiJson.dump(storage_compile_state)
761
+ unless(storage_compile_state.empty?)
762
+ compiled.outputs.compile_state.value MultiJson.dump(storage_compile_state)
763
+ end
762
764
  compiled
763
765
  end
764
766
 
@@ -123,11 +123,15 @@ class SparkleFormation
123
123
  else
124
124
  sym = function_bubbler(sym)
125
125
  end
126
- # Always reset parent in case this is a clone
126
+ # When setting an AttributeStruct type instance check parent or context if
127
+ # available and reset if it has been moved.
127
128
  if(@table[sym].is_a?(::AttributeStruct))
128
- if(@table[sym]._parent.nil?)
129
- @table[sym] = @table[sym]._clone
130
- else
129
+ if(@table[sym].is_a?(::SparkleFormation::FunctionStruct))
130
+ if(@table[sym].respond_to?(:_fn_context) && @table[sym]._fn_context != self)
131
+ @table[sym] = @table[sym]._clone
132
+ @table[sym]._fn_context = self
133
+ end
134
+ elsif(@table[sym]._parent != self)
131
135
  @table[sym]._parent(self)
132
136
  end
133
137
  end
@@ -1,5 +1,5 @@
1
1
  # Unicorns and rainbows
2
2
  class SparkleFormation
3
3
  # Current library version
4
- VERSION = Gem::Version.new('3.0.24')
4
+ VERSION = Gem::Version.new('3.0.26')
5
5
  end
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.24
4
+ version: 3.0.26
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-06-25 00:00:00.000000000 Z
11
+ date: 2017-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attribute_struct
@@ -249,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
249
  version: '0'
250
250
  requirements: []
251
251
  rubyforge_project:
252
- rubygems_version: 2.4.8
252
+ rubygems_version: 2.6.11
253
253
  signing_key:
254
254
  specification_version: 4
255
255
  summary: Orchestration Template Generator