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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21e9ce779f11dc3f1518c50799d1ad7889783be7
4
- data.tar.gz: 8243e639f2e81b2199356555e4cb1fb2afc0f1c8
3
+ metadata.gz: fde16fb8be39c32aa5364af16170764b02dfcf71
4
+ data.tar.gz: 1eb8698ecaf18efac663611ca90a98328fbd1108
5
5
  SHA512:
6
- metadata.gz: 41ad5d4b828fa5b40762ddb0b12a2a6183f40c5d33af1e55cf77b9c5a5e7b87cd87931b8506f5dd6730b7ce8cc1a0b2ca6c51602c82599b37acedffe2cd9e09a
7
- data.tar.gz: 401a89ec7ac21a2c20026b94648e55894d2fed3cc01e4532808503ac69c0d910a0c260851bf64186da49caf6923792b5523733f52b55ca0d3ad29cb268d194da
6
+ metadata.gz: a9c3b97dd176a7de60c4ffa8ffd88867071626f2e01bc16706f343a0732ee203abe0c177c12a568b9f97b3164a977dbc79c59b71eb4638ce1457ac707973c6c1
7
+ data.tar.gz: 529c4668a7d74e8af00cc58adf59a2ff23630144ac5781319ca780bc8758f2b288522e701bdec843a695d7b6cba67fd161d1e92dcabc79b83d9947cac6440ebd
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changes
2
2
 
3
+ ## 1.1.0
4
+
5
+ * Fix ResourceProperty#as_json for rich values
6
+ * Add Resource#[] sugar for GetAtt Function.
7
+
3
8
  ## 1.0.1
4
9
 
5
10
  * Fix Security Group Rule resource versus resource property. - Peter Whiteside
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Skywriter
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -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.1
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-01 00:00:00.000000000 Z
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
- - ".gitignore"
121
- - ".rspec"
122
- - ".travis.yml"
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.2.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: