cfoo 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9931c4f2da716f3ca432c931800fa66967df5a0
4
- data.tar.gz: 9f957d8022ffcd26ad2276d6623f4ebac4c83850
3
+ metadata.gz: 890a22d97ca8850585de4afcefa16687e3a1a471
4
+ data.tar.gz: 2cbaaedd141069c700edad7a33cdf2b55771e0cf
5
5
  SHA512:
6
- metadata.gz: 99ab838edd86404818f4a0c0d57ab706b7ec3099a359cc02420caa59910644f181ed83e6cf6f19946719b5cfce47d7117875dfac38deee96177156dc48726f3c
7
- data.tar.gz: 24f9dbf1768f3f57b95a4ecebc81d37b266cc7744fdff40a37723b1fcadc36f500503b3e515946dda6d1572184a8cf8a29723d394a91817953039a64a7e45be8
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 "ref.yml" containing
20
+ Given I have a file "getatt.yml" containing
21
21
  """
22
22
  Attribute: !GetAtt [ BastionHost, PublicIp ]
23
23
  """
24
- When I process "ref.yml"
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
  """
@@ -1,3 +1,3 @@
1
1
  module Cfoo
2
- CLOUDFORMATION_FUNCTIONS = %w[Base64 FindInMap GetAtt GetAZs Join]
2
+ CLOUDFORMATION_FUNCTIONS = %w[Base64 FindInMap GetAtt GetAZs Join Select And Equals If Not Or]
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Cfoo
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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
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: 2014-09-28 00:00:00.000000000 Z
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.2.1
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