sparkle_formation 1.0.0 → 1.0.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: 40ae36e7f30ce66c8f2866c246b873014effd6e1
4
- data.tar.gz: c542ab9daceb4df19c8dfc4b50f1a1f8ac68090e
3
+ metadata.gz: 34e0be284545b28444bd22287a29aaf74a0aa25d
4
+ data.tar.gz: e18497e3c5b66af3e905cd0754e88eb5f1cded54
5
5
  SHA512:
6
- metadata.gz: f75fa1dd08bc0438ffb2a92fa59a157c4d045a09423fd782ac33f92bdfaab3b10172b4697aa4bb31071d7901a7e99c86ea52789c238c3553b18b02278730e405
7
- data.tar.gz: 2deadc43737f86a136dd7de4169d88cd7c5afefcf065685fb64c385b63835f379f6453c4d5a00993cd4f45aa50400b9fa99f6b98f64ba6fe14ec99c84df2b871
6
+ metadata.gz: 1ac1f84363eaa01a0f87eaac6932a4eb03b35170b2f0d1b286eb0c2b8632c8c8fef62b01fa928b14e808bb34b167c130306b09c70acb6e45bdbfa2874790cf44
7
+ data.tar.gz: aa39442b0e3690301b6db50cd7fadea4e3aee04fd687aa99b9da19aa396f6203c01e8eff50454224b036fe4a327a05215398e65afbf2418413c998d1e55bda14
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## v1.0.2
2
+ * Support custom values for stack resource type matching
3
+
1
4
  ## v1.0.0
2
5
 
3
6
  > NOTE: This is a major version release. It includes multiple
@@ -272,7 +272,7 @@ class SparkleFormation
272
272
  # @param stack_name [String, Symbol] logical resource name of stack
273
273
  # @apram output_name [String, Symbol] stack output name
274
274
  def _stack_output(stack_name, output_name)
275
- _attr(_process_key(stack_name), "Outputs.#{_process_key(output_name)}")
275
+ _cf_attr(_process_key(stack_name), "Outputs.#{_process_key(output_name)}")
276
276
  end
277
277
  alias_method :stack_output!, :_stack_output
278
278
 
@@ -17,6 +17,8 @@ class SparkleFormation
17
17
 
18
18
  # @return [String] default stack resource name
19
19
  DEFAULT_STACK_RESOURCE = 'AWS::CloudFormation::Stack'
20
+ # @return [Array<String>] collection of valid stack resource types
21
+ VALID_STACK_RESOURCES = [DEFAULT_STACK_RESOURCE]
20
22
 
21
23
  class << self
22
24
 
@@ -298,6 +300,8 @@ class SparkleFormation
298
300
  attr_reader :parameters
299
301
  # @return [SparkleFormation] parent stack
300
302
  attr_accessor :parent
303
+ # @return [Array<String>] valid stack resource types
304
+ attr_reader :stack_resource_types
301
305
 
302
306
  # Create new instance
303
307
  #
@@ -331,6 +335,10 @@ class SparkleFormation
331
335
  SfnAws.load!
332
336
  end
333
337
  @parameters = set_generation_parameters!(options.fetch(:parameters, {}))
338
+ @stack_resource_types = (
339
+ VALID_STACK_RESOURCES +
340
+ options.fetch(:stack_resource_types, [])
341
+ ).uniq
334
342
  @components = Smash.new
335
343
  @load_order = []
336
344
  @overrides = []
@@ -341,6 +349,14 @@ class SparkleFormation
341
349
  @compiled = nil
342
350
  end
343
351
 
352
+ # Check if type is a registered stack type
353
+ #
354
+ # @param type [String]
355
+ # @return [TrueClass, FalseClass]
356
+ def stack_resource_type?(type)
357
+ stack_resource_types.include?(type)
358
+ end
359
+
344
360
  # @return [SparkleFormation] root stack
345
361
  def root
346
362
  if(parent)
@@ -460,7 +476,7 @@ class SparkleFormation
460
476
  # @return [Array<SparkleFormation>]
461
477
  def nested_stacks(*args)
462
478
  compile.resources.keys!.map do |key|
463
- if(compile.resources[key].type == DEFAULT_STACK_RESOURCE)
479
+ if(stack_resource_type?(compile.resources[key].type))
464
480
  result = [compile.resources[key].properties.stack]
465
481
  if(args.include?(:with_resource))
466
482
  result.push(compile[:resources][key])
@@ -477,7 +493,7 @@ class SparkleFormation
477
493
  def nested?(stack_hash=nil)
478
494
  stack_hash = compile.dump! unless stack_hash
479
495
  !!stack_hash.fetch('Resources', {}).detect do |r_name, resource|
480
- resource['Type'] == DEFAULT_STACK_RESOURCE
496
+ stack_resource_type?(resource['Type'])
481
497
  end
482
498
  end
483
499
 
@@ -485,7 +501,7 @@ class SparkleFormation
485
501
  def isolated_nests?(stack_hash=nil)
486
502
  stack_hash = compile.dump! unless stack_hash
487
503
  stack_hash.fetch('Resources', {}).all? do |name, resource|
488
- resource['Type'] == DEFAULT_STACK_RESOURCE
504
+ stack_resource_type?(resource['Type'])
489
505
  end
490
506
  end
491
507
 
@@ -1,4 +1,4 @@
1
1
  class SparkleFormation
2
2
  # Current library version
3
- VERSION = Gem::Version.new('1.0.0')
3
+ VERSION = Gem::Version.new('1.0.2')
4
4
  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: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-04 00:00:00.000000000 Z
11
+ date: 2015-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attribute_struct