cfoo 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -2
- data/features/yamly_shortcuts.feature +16 -2
- data/lib/cfoo/constants.rb +1 -1
- data/lib/cfoo/version.rb +1 -1
- data/spec/cfoo/yaml_parser_spec.rb +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 890a22d97ca8850585de4afcefa16687e3a1a471
|
4
|
+
data.tar.gz: 2cbaaedd141069c700edad7a33cdf2b55771e0cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 106acbdf12ff2c523a6b541280935b87db4bb6e1587da7dc82c4a8686d7b3858d5f9696564ae749e19c5e0c0225a5162f08d3aa1639468b7c73ee8919b0c1819
|
7
|
+
data.tar.gz: 342ef4c8482c39fc1a0f74c4529d650fdd970761266792b2c794527095f5cfeb900b2a04f2d2ed15c3a8f1e122458446465986172d778f958b8fa0f6b669cbfd
|
data/README.md
CHANGED
@@ -56,7 +56,7 @@ Snippet from a CloudFormation template (based on [this example](https://s3.amazo
|
|
56
56
|
" --region ", { "Ref" : "AWS::Region" }, " || error_exit 'Failed to run cfn-init'\n",
|
57
57
|
|
58
58
|
"/opt/aws/bin/cfn-signal -e 0 -r \"cfn-init complete\" '", { "Ref" : "WaitHandle" }, "'\n"
|
59
|
-
]]}}
|
59
|
+
]]}}
|
60
60
|
}
|
61
61
|
```
|
62
62
|
|
@@ -66,7 +66,7 @@ Equivalent Cfoo template snippet:
|
|
66
66
|
Properties:
|
67
67
|
ImageId : AWSRegion2AMI[$(AWS::Region)][AMI]
|
68
68
|
InstanceType: $(InstanceType)
|
69
|
-
SecurityGroups:
|
69
|
+
SecurityGroups:
|
70
70
|
- $(FrontendGroup)
|
71
71
|
KeyName: $(KeyName)
|
72
72
|
UserData: !Base64 |
|
@@ -206,6 +206,18 @@ Alternative YAML Type:
|
|
206
206
|
echo 'running script...'
|
207
207
|
```
|
208
208
|
|
209
|
+
##### Condition Function
|
210
|
+
|
211
|
+
CloudFormation:
|
212
|
+
```json
|
213
|
+
{ "Fn::Equals": [ "sg-mysggroup", {"Ref": "ASecurityGroup"} ] },
|
214
|
+
```
|
215
|
+
|
216
|
+
YAML Type:
|
217
|
+
```yaml
|
218
|
+
!Equals [ "sg-mysggroup", $(ASecurityGroup) ]
|
219
|
+
```
|
220
|
+
|
209
221
|
## Goals
|
210
222
|
|
211
223
|
### Primary Goals
|
@@ -17,11 +17,11 @@ Feature: YAMLy shortcuts
|
|
17
17
|
"""
|
18
18
|
|
19
19
|
Scenario: Attribute
|
20
|
-
Given I have a file "
|
20
|
+
Given I have a file "getatt.yml" containing
|
21
21
|
"""
|
22
22
|
Attribute: !GetAtt [ BastionHost, PublicIp ]
|
23
23
|
"""
|
24
|
-
When I process "
|
24
|
+
When I process "getatt.yml"
|
25
25
|
Then the output should match JSON
|
26
26
|
"""
|
27
27
|
{
|
@@ -30,6 +30,20 @@ Feature: YAMLy shortcuts
|
|
30
30
|
}
|
31
31
|
"""
|
32
32
|
|
33
|
+
Scenario: Condition
|
34
|
+
Given I have a file "cond.yml" containing
|
35
|
+
"""
|
36
|
+
Condition: !Equals [ "string a", "string b" ]
|
37
|
+
"""
|
38
|
+
When I process "cond.yml"
|
39
|
+
Then the output should match JSON
|
40
|
+
"""
|
41
|
+
{
|
42
|
+
"AWSTemplateFormatVersion" : "2010-09-09",
|
43
|
+
"Condition": { "Fn::Equals" : [ "string a", "string b" ]}
|
44
|
+
}
|
45
|
+
"""
|
46
|
+
|
33
47
|
Scenario: Join function call
|
34
48
|
Given I have a file "join.yml" containing
|
35
49
|
"""
|
data/lib/cfoo/constants.rb
CHANGED
data/lib/cfoo/version.rb
CHANGED
@@ -51,6 +51,11 @@ module Cfoo
|
|
51
51
|
|
52
52
|
parser.load_file("#{working_dir}/join.yml").should == YAML::DomainType.create("Join", ["", ["a","b","c"]])
|
53
53
|
end
|
54
|
+
it "wraps selects in AWS Select function-calls" do
|
55
|
+
write "#{working_dir}/select.yml", "!Select [1, [a, b, c]]"
|
56
|
+
|
57
|
+
parser.load_file("#{working_dir}/select.yml").should == YAML::DomainType.create("Select", [1, ["a","b","c"]])
|
58
|
+
end
|
54
59
|
it "wraps concatenations in AWS Join function-calls with empty strings" do
|
55
60
|
write "#{working_dir}/concat.yml", "!Concat [a, b, c]"
|
56
61
|
|
@@ -61,6 +66,11 @@ module Cfoo
|
|
61
66
|
|
62
67
|
parser.load_file("#{working_dir}/findinmap.yml").should == YAML::DomainType.create("FindInMap", ["Map", "Key", "Value"])
|
63
68
|
end
|
69
|
+
it "wraps conditions in AWS condition function-calls" do
|
70
|
+
write "#{working_dir}/findinmap.yml", "!Equals [a, b]"
|
71
|
+
|
72
|
+
parser.load_file("#{working_dir}/findinmap.yml").should == YAML::DomainType.create("Equals", ["a", "b"])
|
73
|
+
end
|
64
74
|
it "wraps base64 strings in AWS Base64 function-calls" do
|
65
75
|
write "#{working_dir}/base64.yml", "!Base64 myencodedstring"
|
66
76
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- drrb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
271
271
|
version: '0'
|
272
272
|
requirements: []
|
273
273
|
rubyforge_project:
|
274
|
-
rubygems_version: 2.
|
274
|
+
rubygems_version: 2.4.5
|
275
275
|
signing_key:
|
276
276
|
specification_version: 4
|
277
277
|
summary: Cfoo (pronounced 'sifu') allows you to write your CloudFormation templates
|