sparkle_formation 2.1.0 → 2.1.2

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: 7ed2f1e3bec855db611f4a8fcd7c3e3c509aa209
4
- data.tar.gz: d6dc132ef582d52c55080c4a4e80d60fbb28c702
3
+ metadata.gz: 79efaae651919d5ed404a9738852cb86b41c2057
4
+ data.tar.gz: 339d1d3eb57ef4e35c29ccd475f66b7d8942e9f1
5
5
  SHA512:
6
- metadata.gz: 09bd692653d5f7816a332fc2d7f772760bac7e13e34e8314518f99ec48604146a5c8bdf5ce3a321a4599307dcbf6b5673800979a9497c75e708722772882c4c0
7
- data.tar.gz: e4958183360a572b03aff5ebeab2a9c2ea6db984f8db91bb146b0d26b59665290096a43a0d05e425ecdcfd6c096bb080205a25c3e44f0ce798f34632a9affe4e
6
+ metadata.gz: c555423571e62575d59b4eb5022b0ff616a681b2b6a30419c3b0124f3a9f2ea5ee6063ef42d6479a7ed05d8b722338ef5db99016ee1ae025a0ab6e2dd8a2b2ae
7
+ data.tar.gz: f0bde668d2cc2e972e59f08369176dfaf1a84af468af72e0879dbb2e8e1475a16e06252ecd063a67877188fad556044385cff0415d7fa1592b1d65952f7efdc4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v2.1.2
2
+ * Add helper for copying SparkleFormation::Collection settings
3
+ * Use collections helper to ensure expected pack ordering
4
+ * Add support for template location via path within SparkleFormation::Collection
5
+
1
6
  # v2.1.0
2
7
  * Add template inheritance support (#145)
3
8
  * Add layer merging support for templates, components, and dynamics (#145)
@@ -16,6 +16,17 @@ class SparkleFormation
16
16
  @sparkles = []
17
17
  end
18
18
 
19
+ # Apply collection settings to this collection
20
+ #
21
+ # @param collection [SparkleFormation::Collection]
22
+ # @return [self]
23
+ # @note will overwrite existing set packs
24
+ def apply(collection)
25
+ @root = collection.sparkles.last
26
+ @sparkles = collection.sparkles.slice(0, collection.sparkles.length - 1) || []
27
+ self
28
+ end
29
+
19
30
  # Set the root sparkle which forces highest precedence
20
31
  #
21
32
  # @param sparkle [Sparkle]
@@ -132,6 +143,17 @@ class SparkleFormation
132
143
  result = nil
133
144
  error = nil
134
145
  result = send(type_name)[name]
146
+ if(result.nil? && type_name == 'templates')
147
+ t_direct = sparkles.map do |pack|
148
+ begin
149
+ pack.get(:template, name)
150
+ rescue Error::NotFound
151
+ end
152
+ end.compact.last
153
+ if(t_direct)
154
+ result = send(type_name)[t_direct[:name]]
155
+ end
156
+ end
135
157
  unless(result)
136
158
  error_klass = Error::NotFound.const_get(
137
159
  Bogo::Utility.camel(type)
@@ -286,11 +286,7 @@ class SparkleFormation
286
286
  type struct._self.stack_resource_type
287
287
  end
288
288
  unless(struct._self.sparkle.empty?)
289
- struct._self.sparkle.size.times do |idx|
290
- nested_template.sparkle.add_sparkle(
291
- struct._self.sparkle.sparkle_at(idx)
292
- )
293
- end
289
+ nested_template.sparkle.apply(struct._self.sparkle)
294
290
  end
295
291
  struct.resources[resource_name].properties.stack nested_template
296
292
  if(block_given?)
@@ -501,9 +497,7 @@ class SparkleFormation
501
497
  if(provider != template.provider)
502
498
  raise TypeError.new "This template `#{name}` cannot inherit template `#{template.name}`! Provider mismatch: `#{provider}` != `#{template.provider}`" # rubocop:disable Metrics/LineLength
503
499
  end
504
- sparkle.size.times do |idx|
505
- template.sparkle.add_sparkle(sparkle.sparkle_at(idx))
506
- end
500
+ template.sparkle.apply(sparkle)
507
501
  template.seed_self
508
502
  blacklisted_templates.replace(
509
503
  (blacklisted_templates + template.blacklisted_templates).map(&:to_s).uniq
@@ -1,5 +1,5 @@
1
1
  # Unicorns and rainbows
2
2
  class SparkleFormation
3
3
  # Current library version
4
- VERSION = Gem::Version.new('2.1.0')
4
+ VERSION = Gem::Version.new('2.1.2')
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sparkle_formation
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts