skywriter 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +5 -0
- data/lib/skywriter/resource.rb +16 -0
- data/lib/skywriter/resource_property.rb +1 -1
- data/lib/skywriter/version.rb +1 -1
- data/spec/skywriter/resource_property_spec.rb +12 -0
- data/spec/skywriter/resource_spec.rb +7 -0
- metadata +23 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fde16fb8be39c32aa5364af16170764b02dfcf71
|
4
|
+
data.tar.gz: 1eb8698ecaf18efac663611ca90a98328fbd1108
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9c3b97dd176a7de60c4ffa8ffd88867071626f2e01bc16706f343a0732ee203abe0c177c12a568b9f97b3164a977dbc79c59b71eb4638ce1457ac707973c6c1
|
7
|
+
data.tar.gz: 529c4668a7d74e8af00cc58adf59a2ff23630144ac5781319ca780bc8758f2b288522e701bdec843a695d7b6cba67fd161d1e92dcabc79b83d9947cac6440ebd
|
data/CHANGES.md
CHANGED
data/lib/skywriter/resource.rb
CHANGED
@@ -111,6 +111,22 @@ module Skywriter
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
+
# Sugar for using an attribute of this resource in another resource.
|
115
|
+
#
|
116
|
+
# @example
|
117
|
+
# i = EC2::Instance.new("myInstance", ....)
|
118
|
+
# dns = Route53::RecordSet.new("masterDNS",
|
119
|
+
# ResourceRecords: [{ i[:PublicDnsName] }],
|
120
|
+
# ...)
|
121
|
+
#
|
122
|
+
# @param attribute_name [Symbol,String] The attribute the function
|
123
|
+
# retrieves from the resource.
|
124
|
+
#
|
125
|
+
# @return [Hash] A hash describing a GetAtt Function
|
126
|
+
def [](attribute_name)
|
127
|
+
Function.get_att(logical_name, attribute_name.to_s)
|
128
|
+
end
|
129
|
+
|
114
130
|
# @api private
|
115
131
|
#
|
116
132
|
# @param dependency [Skywriter::Resource] A Resource upon which this resource depends.
|
@@ -21,7 +21,7 @@ module Skywriter
|
|
21
21
|
def as_json(*)
|
22
22
|
@as_json ||= property_definitions.each_with_object({}) do |property_definition, hash|
|
23
23
|
if (value = property_value(property_definition))
|
24
|
-
hash[property_definition.name] = value
|
24
|
+
hash[property_definition.name] = value.as_json
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/lib/skywriter/version.rb
CHANGED
@@ -33,6 +33,18 @@ describe Skywriter::ResourceProperty do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "#as_json" do
|
36
|
+
context "with pointer in resource property" do
|
37
|
+
let(:resource) do
|
38
|
+
resource_class.new("resource")
|
39
|
+
end
|
40
|
+
|
41
|
+
subject { resource_property_class.new(foo_bar: resource.as_pointer) }
|
42
|
+
|
43
|
+
it "returns expected value" do
|
44
|
+
expect(subject.as_json).to eq("FooBar" => {"Ref" => 'resource'})
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
36
48
|
context "with missing properties" do
|
37
49
|
subject { resource_property_class.new(foo_bar: '1').as_json }
|
38
50
|
|
@@ -150,6 +150,13 @@ describe Skywriter::Resource do
|
|
150
150
|
end
|
151
151
|
end
|
152
152
|
end
|
153
|
+
|
154
|
+
describe "#[]" do
|
155
|
+
it "return the expected function" do
|
156
|
+
resource = resource_class.new('resource')
|
157
|
+
expect(resource[:PublicDnsName]).to eq({ "Fn::GetAtt" => ['resource', 'PublicDnsName'] })
|
158
|
+
end
|
159
|
+
end
|
153
160
|
end
|
154
161
|
|
155
162
|
describe "The implementation" do
|
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
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Michael
|
@@ -9,104 +9,104 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: require_all
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '1.3'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.3'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: activesupport
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '4.0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '4.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: bundler
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ~>
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '1.5'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '1.5'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '2.14'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ~>
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '2.14'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: pry
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - '>='
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - '>='
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: fuubar
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - '>='
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - '>='
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
description: Writes AWS CloudFormation templates.
|
@@ -117,9 +117,9 @@ executables: []
|
|
117
117
|
extensions: []
|
118
118
|
extra_rdoc_files: []
|
119
119
|
files:
|
120
|
-
-
|
121
|
-
-
|
122
|
-
-
|
120
|
+
- .gitignore
|
121
|
+
- .rspec
|
122
|
+
- .travis.yml
|
123
123
|
- CHANGES.md
|
124
124
|
- Gemfile
|
125
125
|
- LICENSE.md
|
@@ -279,17 +279,17 @@ require_paths:
|
|
279
279
|
- lib
|
280
280
|
required_ruby_version: !ruby/object:Gem::Requirement
|
281
281
|
requirements:
|
282
|
-
- -
|
282
|
+
- - '>='
|
283
283
|
- !ruby/object:Gem::Version
|
284
284
|
version: '0'
|
285
285
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
286
286
|
requirements:
|
287
|
-
- -
|
287
|
+
- - '>='
|
288
288
|
- !ruby/object:Gem::Version
|
289
289
|
version: '0'
|
290
290
|
requirements: []
|
291
291
|
rubyforge_project:
|
292
|
-
rubygems_version: 2.
|
292
|
+
rubygems_version: 2.0.14
|
293
293
|
signing_key:
|
294
294
|
specification_version: 4
|
295
295
|
summary: Writes cloud formations
|
@@ -304,3 +304,4 @@ test_files:
|
|
304
304
|
- spec/skywriter/resource_spec.rb
|
305
305
|
- spec/skywriter/template_spec.rb
|
306
306
|
- spec/spec_helper.rb
|
307
|
+
has_rdoc:
|