sparkle_formation 0.2.6 → 0.2.8

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: 629f237b850e9be0623bc58499ee7576018730a4
4
- data.tar.gz: 9b602ddb998707e16a1c45ff08e12b5a175a485c
3
+ metadata.gz: 606dadd19767aa72a3e8a3efeb079d060146d7bc
4
+ data.tar.gz: b2364fa255d7fa852edcb43fe803814c1892f909
5
5
  SHA512:
6
- metadata.gz: d527b10cca86fb282187e4e9c6672dd89957b00b8ffa6b8c7ace56b6ab3c67e639f425a89cd9091798c0073d9a1495ed4d75b17bed50026ec78c2f9298df14ae
7
- data.tar.gz: d4c775dcd1114e10d3c707ce863c836125ee035bc4bfbd2122261340c330844fec335ba6ca8b28b7e497b25ae914d2bb7e7b0f4b298c6a771b2130d250f90c28
6
+ metadata.gz: 2485a030c1069bf8bbcd39b8ef8f320e4bc6c9e2ac696cdb78acb24be19f1ad4df96c6a7c5f93c196793f76d8eb5134fc456a981fffa96642ce23fdeb495a7d3
7
+ data.tar.gz: 37f0b4351f4e3b5072a8f4c73cd03393abd710e64751ff31e03a98812d7fa23b4dad491cd798c167b28ae67a01bc0708ca03ad54d75ecf4a78bd23c41b55f613
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v0.2.8
2
+ * Relax isolated nesting check (resources only)
3
+ * Include condition within generated hash within `if!` helper (#32)
4
+ * Auto process String arguments provided to `if!`
5
+ * Fix array nesting within `or!`
6
+
1
7
  ## v0.2.6
2
8
  * Add initial nested stack implementation
3
9
  * Update user docs generation
data/README.md CHANGED
@@ -26,9 +26,9 @@ we can just convert it into a single file (ec2_example.rb):
26
26
  SparkleFormation.new('ec2_example') do
27
27
  description "AWS CloudFormation Sample Template ..."
28
28
 
29
- parameters.keyname do
29
+ parameters.key_name do
30
30
  description 'Name of EC2 key pair'
31
- type 'string'
31
+ type 'String'
32
32
  end
33
33
 
34
34
  mappings.region_map do
@@ -100,7 +100,7 @@ make this easier to maintain.
100
100
 
101
101
  # Components
102
102
 
103
- Lets say we have a handful of CF templates we want to maintain, and all of those
103
+ Lets say we have a handful of CFN templates we want to maintain, and all of those
104
104
  templates use the same AMI. Instead of copying that information into all the
105
105
  templates, lets create an AMI component instead, and then load it into the actual
106
106
  templates.
@@ -127,13 +127,13 @@ end
127
127
  Now, we can modify our initial example to use this component (ec2_example.rb):
128
128
 
129
129
  ```ruby
130
- SparkleFormation.new('ec2_example').load(:ami) do
130
+ SparkleFormation.new('ec2_example').load(:ami).overrides do
131
131
 
132
132
  description "AWS CloudFormation Sample Template ..."
133
133
 
134
- parameters.keyname do
134
+ parameters.key_name do
135
135
  description 'Name of EC2 key pair'
136
- type 'string'
136
+ type 'String'
137
137
  end
138
138
 
139
139
  dynamic!(:ec2_instance, :foobar) do
@@ -203,15 +203,15 @@ SparkleFormation.dynamic(:node,
203
203
  ) do |_name, _config|
204
204
 
205
205
  if(_config[:key_name])
206
- parameters.keyname do
206
+ parameters.set!("#{_name}_key_name".to_sym) do
207
207
  description 'Name of EC2 key pair'
208
- type 'string'
208
+ type 'String'
209
209
  end
210
210
  end
211
211
 
212
212
  dynamic!(:ec2_instance, _name) do
213
213
  properties do
214
- key_name _config.fetch(:key_name, ref!(:key_name))
214
+ key_name _config.fetch(:key_name, ref!("#{_name}_key_name".to_sym))
215
215
  image_id map!(:region_map, 'AWS::Region', :ami)
216
216
  user_data baes64!('80')
217
217
  end
@@ -156,8 +156,8 @@ class SparkleFormation
156
156
  # @param false_value [Object]
157
157
  # @return [Hash]
158
158
  def _if(cond, true_value, false_value)
159
- cond = cond.is_a?(Symbol) ? _condition(cond) : cond
160
- {'Fn::If' => _array(true_value, false_value)}
159
+ cond = cond.is_a?(Symbol) || cond.is_a?(String) ? _condition(cond) : cond
160
+ {'Fn::If' => _array(cond, true_value, false_value)}
161
161
  end
162
162
  alias_method :if!, :_if
163
163
 
@@ -214,7 +214,7 @@ class SparkleFormation
214
214
  def _or(v1, v2)
215
215
  {
216
216
  'Fn::Or' => _array(
217
- [v1,v2].map{|v|
217
+ *[v1,v2].map{|v|
218
218
  if(v.is_a?(Symbol) || v.is_a?(String))
219
219
  _condition(v)
220
220
  else
@@ -416,8 +416,9 @@ class SparkleFormation
416
416
  # @return [TrueClass, FalseClass] includes _only_ nested stacks
417
417
  def isolated_nests?
418
418
  hash = compile.dump!
419
- (hash.keys == ['Resources'] || hash.keys == ['Resources', 'AWSTemplateFormatVersion']) &&
420
- !hash['Resources'].detect{|_, r| r['Type'] != 'AWS::CloudFormation::Stack'}
419
+ hash.fetch('Resources', {}).all? do |name, resource|
420
+ resource['Type'] == 'AWS::CloudFormation::Stack'
421
+ end
421
422
  end
422
423
 
423
424
  # Apply stack nesting logic. Will extract unique parameters from
@@ -18,5 +18,5 @@
18
18
 
19
19
  class SparkleFormation
20
20
  # Current library version
21
- VERSION = Gem::Version.new('0.2.6')
21
+ VERSION = Gem::Version.new('0.2.8')
22
22
  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: 0.2.6
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-22 00:00:00.000000000 Z
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attribute_struct