cloud_shaped 0.1.3 → 1.0.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: 0fdc611b70fc3544aade1219d677b5048d4c53af
4
- data.tar.gz: b0d8936622fdf2cf4b18767aa15c53c3c3a433c2
3
+ metadata.gz: 81578102167a9548f023eb99b7fe9d3302fced4e
4
+ data.tar.gz: 036c15cb87e71bf50808816ebfd4a406656e1f2e
5
5
  SHA512:
6
- metadata.gz: b9b0676e9f7c504de7195197eadd4388eb9dc152a718c06b0b7e983086319148527abe29da03b9f4717b2c4783d9b5fb04d4952e6709e993e978ab46e52ac046
7
- data.tar.gz: b9a67eb5d1a5c1c943fd0874d24822c26123b6a3d870a87420063fba10336e326a34df5a58ba63ca6c517651c332093e27a378c714d5b634d9d7b923ea69dc78
6
+ metadata.gz: ba1bb9c3342bd70f0e32968ed64cbe0b9940aa47e0474c8f09dbfe4a98378543d9398f9001bc067b607d0bd0304b262484c7215bddaaa157d1883cfb71ea4011
7
+ data.tar.gz: b60601ccf0ace938272dbe70cae75abacd3ed60656cb13fcdf86629aff1f747f6b6bf1dbbd5bcd4bd317c7819fb6e3010707fcd9d67062fd19fc7db3805a4abf
@@ -0,0 +1,20 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'cloud_shaped'
4
+ require 'yaml'
5
+
6
+ template = CloudShaped.template do
7
+
8
+ self.description = "Make a bucket"
9
+
10
+ self.metadata["foo"] = {
11
+ "bar" => "baz"
12
+ }
13
+
14
+ def_resource "myBucket", "AWS::S3::Bucket" do |b|
15
+ b["BucketName"] = "my-bucket"
16
+ end
17
+
18
+ end
19
+
20
+ puts YAML.dump(template)
@@ -6,7 +6,8 @@ module CloudShaped
6
6
  #
7
7
  class TemplateBuilder
8
8
 
9
- def initialize(settings = {})
9
+ def initialize
10
+ @metadata = {}
10
11
  @parameters = {}
11
12
  @mappings = {}
12
13
  @resources = {}
@@ -18,6 +19,8 @@ module CloudShaped
18
19
  def template
19
20
  {}.tap do |template|
20
21
  template["AWSTemplateFormatVersion"] = '2010-09-09'
22
+ template["Description"] = description if description
23
+ template["Metadata"] = metadata unless metadata.empty?
21
24
  template["Parameters"] = parameters unless parameters.empty?
22
25
  template["Mappings"] = mappings unless mappings.empty?
23
26
  template["Resources"] = resources
@@ -82,6 +85,9 @@ module CloudShaped
82
85
  outputs[name] = output(value)
83
86
  end
84
87
 
88
+ attr_accessor :description
89
+ attr_reader :metadata
90
+
85
91
  protected
86
92
 
87
93
  attr_reader :parameters
@@ -1,3 +1,3 @@
1
1
  module CloudShaped
2
- VERSION = "0.1.3"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -21,6 +21,15 @@ describe CloudShaped::TemplateBuilder do
21
21
 
22
22
  end
23
23
 
24
+ describe "#description=" do
25
+
26
+ it "sets the Description" do
27
+ template_builder.description = "My awesome template"
28
+ expect(template["Description"]).to eq("My awesome template")
29
+ end
30
+
31
+ end
32
+
24
33
  describe "#def_resource" do
25
34
 
26
35
  it "defines a Resource" do
@@ -160,4 +169,17 @@ describe CloudShaped::TemplateBuilder do
160
169
 
161
170
  end
162
171
 
172
+ describe "#metadata" do
173
+
174
+ it "allows attachment of stack metadata" do
175
+ template_builder.metadata["Foo"] = { "bar" => "baz" }
176
+ expected_metadata = {
177
+ "Foo" => {
178
+ "bar" => "baz"
179
+ }
180
+ }
181
+ expect(template["Metadata"]).to eq(expected_metadata)
182
+ end
183
+
184
+ end
163
185
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud_shaped
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-13 00:00:00.000000000 Z
11
+ date: 2015-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -69,6 +69,7 @@ files:
69
69
  - cloud_shaped.gemspec
70
70
  - examples/buckets.rb
71
71
  - examples/macro.rb
72
+ - examples/simple.rb
72
73
  - lib/cloud_shaped.rb
73
74
  - lib/cloud_shaped/camelate.rb
74
75
  - lib/cloud_shaped/core_methods.rb