rubycfn 0.0.8 → 0.0.9

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: 1e1ddb4bc14986f09f2ae4323ece08e80fd690e2
4
- data.tar.gz: 23340bef42fc6010b374681ae0370cbf91ccfefb
3
+ metadata.gz: 19aba32d0480c42cbc8070c1c10e821b568f99a5
4
+ data.tar.gz: 16b03c2a0fb30a528d04981c1dc07d8de281f5b8
5
5
  SHA512:
6
- metadata.gz: 916800447fb3b053847f6b7de92004bd1f062c18d57ff1b069323a817ffdd21eb7ff344cb444cf868e10c3e590c2348448126a6c48593e649d84b8ed22f26822
7
- data.tar.gz: c4f8c5bdf44b0e6c14517614ef815d14520745f0e3c17eb6c57d02610e6136c34792043250554bcb6e392feda34ca14d70158133c7300d666a5f3ecc152efbda
6
+ metadata.gz: d7dcbeb1c60c17662e96bc5e53dfdcc735e10b79f30429829d87319f1c1cc8d22456284c1b988224b999e446c3ffcc43385c82a285eb14a12dde26883f450ec2
7
+ data.tar.gz: 94ce17cae7ff31af550b82ec0293a55ffb9ff7ff89f63ab668a3a1279e4ea586bb2a2afa21ca5267cd4c486e4c7339d842fb8f841af61b246d10a51d845c7af2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubycfn (0.0.8)
4
+ rubycfn (0.0.9)
5
5
  activesupport (~> 5.1.5)
6
6
  json (~> 2.1.0)
7
7
  neatjson (~> 0.8.4)
data/README.md CHANGED
@@ -12,7 +12,7 @@ or, create a Gemfile with this content:
12
12
  ```
13
13
  source "https://rubygems.org"
14
14
 
15
- gem "rubycfn", "~> 0.0.8"
15
+ gem "rubycfn", "~> 0.0.9"
16
16
 
17
17
  ```
18
18
 
@@ -1,4 +1,4 @@
1
1
  # Rubycfn version
2
2
  module Rubycfn
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
data/lib/rubycfn.rb CHANGED
@@ -96,8 +96,10 @@ module Rubycfn
96
96
  end
97
97
  end
98
98
 
99
- def self.description(description)
100
- TOPLEVEL_BINDING.eval("@description = '#{description}'")
99
+ def self.description(description = "")
100
+ unless description.nil?
101
+ TOPLEVEL_BINDING.eval("@description = '#{description}'")
102
+ end
101
103
  end
102
104
 
103
105
  def self.parameter(name, arguments)
@@ -180,6 +182,7 @@ module Rubycfn
180
182
  yield self, i if block_given?
181
183
  res = {
182
184
  "#{name.to_s}#{i == 0 ? "" : i+1}": {
185
+ DependsOn: TOPLEVEL_BINDING.eval("@depends_on"),
183
186
  Properties: TOPLEVEL_BINDING.eval("@properties"),
184
187
  Type: arguments[:type]
185
188
  }
@@ -5,17 +5,70 @@ require "active_support/concern"
5
5
 
6
6
  describe Rubycfn do
7
7
 
8
- module RSpec
8
+ module RspecStack
9
+ extend ActiveSupport::Concern
9
10
  include Rubycfn
11
+
12
+ included do
13
+ description "RSpec Test Stack"
14
+
15
+ resource :rspec_resource_name,
16
+ type: "Rspec::Test",
17
+ amount: 2 do |r|
18
+ r.property(:name) { "RSpec" }
19
+ end
20
+ end
10
21
  end
11
22
 
23
+ CloudFormation = include RspecStack
24
+ RspecStack = CloudFormation.render_template
25
+ Given(:json) { JSON.parse(RspecStack) }
26
+
12
27
  context "renders template" do
13
- let(:template) { JSON.parse(RSpec.render_template) }
28
+ let(:template) { json }
14
29
  subject { template }
15
30
 
16
31
  it { should_not have_key 'Parameters' }
17
32
  it { should_not have_key 'Outputs' }
18
- it { should_not have_key 'Resources' }
33
+
34
+ it { should have_key 'Description' }
35
+ it { should have_key 'Resources' }
19
36
  it { should have_key 'AWSTemplateFormatVersion' }
37
+
38
+ context "has description" do
39
+ let(:description) { template["Description"] }
40
+ subject { description }
41
+
42
+ it { should eq "RSpec Test Stack" }
43
+ end
44
+
45
+ context "created resource" do
46
+ let(:resources) { template["Resources"] }
47
+ subject { resources }
48
+
49
+ it { should have_key "RspecResourceName" }
50
+
51
+ context "has resource type" do
52
+ let(:resource) { resources["RspecResourceName"] }
53
+ subject { resource }
54
+
55
+ it { should have_key "Type" }
56
+ it { should have_key "Properties" }
57
+
58
+ context "resource type is correct" do
59
+ let(:type) { resource["Type"] }
60
+ subject { type }
61
+
62
+ it { should eq "Rspec::Test" }
63
+ end
64
+
65
+ context "has name property" do
66
+ let(:properties) { resource["Properties"] }
67
+ subject { properties }
68
+
69
+ it { should have_key "Name" }
70
+ end
71
+ end
72
+ end
20
73
  end
21
74
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubycfn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Vink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-10 00:00:00.000000000 Z
11
+ date: 2018-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: neatjson