cloud_former 0.1.1 → 0.1.2

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: 0c8a5338348beee60df3e124acc8eb8f0ce2c3b7
4
- data.tar.gz: a12c7b867e2fa1601c1e3da80ad8c81b2bfbf103
3
+ metadata.gz: d408999d0a1f6006fb6b712b2d97303200f1b04e
4
+ data.tar.gz: 4314d3bc196854be11d68f6482156038c17b38b2
5
5
  SHA512:
6
- metadata.gz: 686d64a7354454536b525eb6a6306f30b61e2f94137d6f2ca3713902ec90050063c3e25f704b9102dc7366554d578691210a068bd16d0c362051c7cb8909383f
7
- data.tar.gz: e25f90f4b056439271bac6cfdefa213166ef8a2d7b9dc1293ed48efe8bac6deb77a3b2927a4e5fab5b80c8779ead7ea2aad5b97725bb654b32f3043b3509882d
6
+ metadata.gz: 11f9ad101ef463bb127b4e119a266b87c6d09848f7246d5dfb696b24ef86e7ef34984df2bb9887b6e5bd8b444e2800239c9ad70b7cf98e8aad5ceb51edf34fd4
7
+ data.tar.gz: 883b1c471a76a1004da38b63f5e59638c78e85b8af2dd2bcdc0df40dc8570d788abf76737a01c641cf212d8fb385598aa1b6d82a23bfc4c3237f191a033eea3b
@@ -4,7 +4,6 @@ module CloudFormer
4
4
  def initialize
5
5
  @resources = []
6
6
  @parameters = []
7
- @mappings = []
8
7
  @outputs = []
9
8
  end
10
9
 
@@ -16,6 +15,10 @@ module CloudFormer
16
15
  @resources << resource
17
16
  end
18
17
 
18
+ def add_output(key, value)
19
+ @outputs << [key, value]
20
+ end
21
+
19
22
  def dump_json
20
23
  res = { 'AWSTemplateFormatVersion' => '2010-09-09' }
21
24
 
@@ -35,6 +38,17 @@ module CloudFormer
35
38
  res['Resources'] = resource_res
36
39
  end
37
40
 
41
+ if @outputs.any?
42
+ output_res = {}
43
+ @outputs.each do |output|
44
+ if (output[1].is_a?(Resource) || output[1].is_a?(Parameter))
45
+ output_res[output[0]] = { 'Value' => { 'Ref' => output[1].name } }
46
+ else
47
+ output_res[output[0]] = { 'Value' => output[1] }
48
+ end
49
+ end
50
+ res['Outputs'] = output_res
51
+ end
38
52
 
39
53
  res
40
54
  end
@@ -1,3 +1,3 @@
1
1
  module CloudFormer
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Outputs' do
4
+
5
+ let(:template) { CloudFormer::Template.new }
6
+
7
+ describe 'with a literal output' do
8
+ before do
9
+ template.add_output('Hack', 12356)
10
+ end
11
+
12
+ it 'should produce awesome json' do
13
+ expect(template.dump_json['Outputs']).to eq({ "Hack" => { "Value" => 12356 } })
14
+ end
15
+ end
16
+
17
+ describe 'with a parameter output' do
18
+
19
+ let(:param) { CloudFormer::StringParameter.new('ack') }
20
+
21
+ before do
22
+ template.add_output('Hack', param)
23
+ end
24
+
25
+ it 'should work with a ref' do
26
+ expect(template.dump_json['Outputs']).to eq({ "Hack" => { "Value" => { 'Ref' => 'ack' } } })
27
+ end
28
+ end
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud_former
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aubrey Holland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-12 00:00:00.000000000 Z
11
+ date: 2014-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -177,6 +177,7 @@ files:
177
177
  - lib/cloud_former/template.rb
178
178
  - lib/cloud_former/version.rb
179
179
  - spec/metadata_spec.rb
180
+ - spec/output_spec.rb
180
181
  - spec/parameter_spec.rb
181
182
  - spec/resources/auto_scaling/auto_scaling_group_spec.rb
182
183
  - spec/resources/auto_scaling/launch_configuration_spec.rb
@@ -212,6 +213,7 @@ specification_version: 4
212
213
  summary: A Ruby DSL for creating CloudFormation templates
213
214
  test_files:
214
215
  - spec/metadata_spec.rb
216
+ - spec/output_spec.rb
215
217
  - spec/parameter_spec.rb
216
218
  - spec/resources/auto_scaling/auto_scaling_group_spec.rb
217
219
  - spec/resources/auto_scaling/launch_configuration_spec.rb