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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +9 -9
- data/lib/sparkle_formation/sparkle_attribute.rb +3 -3
- data/lib/sparkle_formation/sparkle_formation.rb +3 -2
- 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: 606dadd19767aa72a3e8a3efeb079d060146d7bc
|
4
|
+
data.tar.gz: b2364fa255d7fa852edcb43fe803814c1892f909
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
29
|
+
parameters.key_name do
|
30
30
|
description 'Name of EC2 key pair'
|
31
|
-
type '
|
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
|
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.
|
134
|
+
parameters.key_name do
|
135
135
|
description 'Name of EC2 key pair'
|
136
|
-
type '
|
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.
|
206
|
+
parameters.set!("#{_name}_key_name".to_sym) do
|
207
207
|
description 'Name of EC2 key pair'
|
208
|
-
type '
|
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!(
|
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
|
-
|
420
|
-
|
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
|
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.
|
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:
|
11
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: attribute_struct
|