skywriter 1.0.0 → 1.0.1

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: 0b6bcdd3dc26381dd3faf2f0d77d59796a1fba6e
4
- data.tar.gz: c2cd5bb2a4bbdc44700a4a416becd8cc1b1e8b7b
3
+ metadata.gz: 21e9ce779f11dc3f1518c50799d1ad7889783be7
4
+ data.tar.gz: 8243e639f2e81b2199356555e4cb1fb2afc0f1c8
5
5
  SHA512:
6
- metadata.gz: 0956c5fd85eca4883d6e707756e5c8be094132a7f9c3cde9a660272db1e92fab98dfe502b93f550a619f52dd3e8df1b1349b32ae11f03b6cb174ece6a8c23bf7
7
- data.tar.gz: bdb99f0ea00674303d8763dd81c2728575d15b7914feb41c2a797cd90532f3245793276ae47b986bdb2d3d1c4d0cfbe29b0a2eb51c7078708447d2f0278f5628
6
+ metadata.gz: 41ad5d4b828fa5b40762ddb0b12a2a6183f40c5d33af1e55cf77b9c5a5e7b87cd87931b8506f5dd6730b7ce8cc1a0b2ca6c51602c82599b37acedffe2cd9e09a
7
+ data.tar.gz: 401a89ec7ac21a2c20026b94648e55894d2fed3cc01e4532808503ac69c0d910a0c260851bf64186da49caf6923792b5523733f52b55ca0d3ad29cb268d194da
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 1.0.1
4
+
5
+ * Fix Security Group Rule resource versus resource property. - Peter Whiteside
6
+
3
7
  ## 1.0.0
4
8
 
5
9
  * Initial release. - Ben Hamill, Ryan Michael, Josh Smith, Peter Whiteside
data/README.md CHANGED
@@ -11,6 +11,8 @@ runnable code provides some benefits like variable assignment, that make the
11
11
  need to use CloudFormation's build-in functions superfluous (of course,
12
12
  Skywriter still has helpers for those functions, if you need them).
13
13
 
14
+ [RDoc](http://rubydoc.info/gems/skywriter/frames)
15
+
14
16
 
15
17
  ## Features
16
18
 
@@ -36,6 +38,47 @@ Resource.new(
36
38
  # }}
37
39
  ```
38
40
 
41
+ ### Template Merging
42
+
43
+ `Template#merge` can be helpful for intelligently merging two CloudFormation
44
+ templates. If the same resource exists in both templates it will be included
45
+ in the output, but if two different resources with the same logical name exist
46
+ and exception will be raised. Otherwise the output will be the union of the
47
+ two templates.
48
+
49
+ ``` ruby
50
+ Template.new(
51
+ resources: [Resource.new('ResourceName', foo: 'bar')]
52
+ ).merge(
53
+ Template.new(
54
+ resources: [Resource.new('ResourceName', foo: 'bar')]
55
+ )
56
+ ).as_json['Resources'] # => {'Resource' => {'Foo' => 'bar'}}
57
+
58
+
59
+ Template.new(
60
+ resources: [Resource.new('ResourceName', foo: 'bar')]
61
+ ).merge(
62
+ Template.new(
63
+ resources: [Resource.new('ResourceName', baz: 'qux')]
64
+ )
65
+ ).as_json # => Skywriter::Template::MergeError raised
66
+ ```
67
+
68
+ Note that you can create a `Template` instance from an existing
69
+ CloudFormation template. This can be useful for making incremental
70
+ changes to existing documents.
71
+
72
+ ``` ruby
73
+ my_old_janky_cf_template = File.open('cf.json')
74
+
75
+ Template.new(
76
+ JSON.load(my_old_janky_cf_template)
77
+ ).merge(
78
+ new_hotness
79
+ )
80
+ ```
81
+
39
82
  See the example section below for some more concrete examples.
40
83
 
41
84
 
@@ -101,7 +144,7 @@ my_db = Skywriter::Resource::RDS::DBInstance.new(
101
144
  availability_zone: "us-east-1a",
102
145
  db_name: "my_db",
103
146
  engine: "MySQL",
104
- db_security_groups: ["old_sg", my_db_sg.as_pointer]
147
+ db_security_groups: ["old_sg", my_db_sg.as_pointer(with: :logical_name)]
105
148
  )
106
149
 
107
150
 
@@ -3,21 +3,16 @@ module Skywriter
3
3
  module EC2
4
4
  # AWS::EC2::SecurityGroupEgress Resource
5
5
  #
6
- class SecurityGroupEgress < Skywriter::ResourceProperty::EC2::SecurityGroupRule
7
- property :DestinationSecurityGroupId
6
+ class SecurityGroupEgress
7
+ include Skywriter::Resource
8
+
8
9
  property :GroupId
10
+ property :IpProtocol
11
+ property :CidrIp
12
+ property :DestinationSecurityGroupId
13
+ property :FromPort
14
+ property :ToPort
9
15
  end
10
16
  end
11
17
  end
12
-
13
- # This is just for aliasing purposes. Despite the fact that Amazon documents
14
- # this class as a resource, it is, in fact, a resource property in all ways.
15
- # So, we put it in the place you'd expect if you were looking at the
16
- # CloudFormation documentations. And we're aliasing it below in the place
17
- # where you'd expect it if you have your head right about how this behaves.
18
- class ResourceProperty
19
- module EC2
20
- SecurityGroupEgress = Skywriter::Resource::EC2::SecurityGroupEgress
21
- end
22
- end
23
18
  end
@@ -3,24 +3,19 @@ module Skywriter
3
3
  module EC2
4
4
  # AWS::EC2::SecurityGroupIngress Resource
5
5
  #
6
- class SecurityGroupIngress < Skywriter::ResourceProperty::EC2::SecurityGroupRule
6
+ class SecurityGroupIngress
7
+ include Skywriter::Resource
8
+
7
9
  property :GroupName
8
10
  property :GroupId
11
+ property :IpProtocol
12
+ property :CidrIp
9
13
  property :SourceSecurityGroupName
10
14
  property :SourceSecurityGroupId
11
15
  property :SourceSecurityGroupOwnerId
16
+ property :FromPort
17
+ property :ToPort
12
18
  end
13
19
  end
14
20
  end
15
-
16
- # This is just for aliasing purposes. Despite the fact that Amazon documents
17
- # this class as a resource, it is, in fact, a resource property in all ways.
18
- # So, we put it in the place you'd expect if you were looking at the
19
- # CloudFormation documentations. And we're aliasing it below in the place
20
- # where you'd expect it if you have your head right about how this behaves.
21
- class ResourceProperty
22
- module EC2
23
- SecurityGroupIngress = Skywriter::Resource::EC2::SecurityGroupIngress
24
- end
25
- end
26
21
  end
@@ -6,6 +6,10 @@ module Skywriter
6
6
  property :ToPort
7
7
  property :IpProtocol
8
8
  property :CidrIp
9
+ property :SourceSecurityGroupId
10
+ property :SourceSecurityGroupName
11
+ property :SourceSecurityGroupOwnerId
12
+ property :DestinationSecurityGroupId
9
13
  end
10
14
  end
11
15
  end
@@ -1,3 +1,3 @@
1
1
  module Skywriter
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -124,8 +124,6 @@ describe "The implementation" do
124
124
  Skywriter::ResourceProperty::EC2::NetworkInterfacePrivateIPSpecification,
125
125
  Skywriter::ResourceProperty::EC2::PortRange,
126
126
  Skywriter::ResourceProperty::EC2::SecurityGroupRule,
127
- Skywriter::Resource::EC2::SecurityGroupEgress,
128
- Skywriter::Resource::EC2::SecurityGroupIngress,
129
127
  Skywriter::ResourceProperty::EC2::Tag,
130
128
  Skywriter::ResourceProperty::ElasticBeanstalk::EnvironmentTier,
131
129
  Skywriter::ResourceProperty::ElasticBeanstalk::OptionSetting,
@@ -178,6 +178,8 @@ describe "The implementation" do
178
178
  Skywriter::Resource::EC2::Route,
179
179
  Skywriter::Resource::EC2::RouteTable,
180
180
  Skywriter::Resource::EC2::SecurityGroup,
181
+ Skywriter::Resource::EC2::SecurityGroupIngress,
182
+ Skywriter::Resource::EC2::SecurityGroupEgress,
181
183
  Skywriter::Resource::EC2::SubnetNetworkAclAssociation,
182
184
  Skywriter::Resource::EC2::SubnetRouteTableAssociation,
183
185
  Skywriter::Resource::EC2::Subnet,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skywriter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Michael
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-14 00:00:00.000000000 Z
12
+ date: 2014-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: require_all
@@ -289,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
289
  version: '0'
290
290
  requirements: []
291
291
  rubyforge_project:
292
- rubygems_version: 2.2.0
292
+ rubygems_version: 2.2.2
293
293
  signing_key:
294
294
  specification_version: 4
295
295
  summary: Writes cloud formations