cloudformula 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -11
- data/lib/cloudformula/template.rb +5 -1
- data/lib/cloudformula/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 254f2c27d4bf0b5a1338019b969155de36fbea74
|
4
|
+
data.tar.gz: e1ed2fd4df8176bb8a9a2c1e414fdca7da9b5578
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4fdef9ca82ff90911bee704501951ce5320fa299ad71d94b346c2e03f611341117ae6de58ff973d9236c90ddbba3f8056e5acd5c7c51d8e851fbfbf6866cbca
|
7
|
+
data.tar.gz: 8018c365ffb61578398d44695aaee18913d0a622e1e1243278f047f5417565d0e442a2348b1450a853e831c919cb68bc22dfb2b6a793459198ef96c5b1a690f6
|
data/README.md
CHANGED
@@ -46,8 +46,6 @@ stack = CloudFormula.create_stack('us-east-1', 'stack-name', template)
|
|
46
46
|
CloudFormula.update_stack('us-east-1', 'stack-name', template)
|
47
47
|
```
|
48
48
|
|
49
|
-
TODO - see api documentation
|
50
|
-
|
51
49
|
## Creating templates
|
52
50
|
|
53
51
|
Templates are Ruby ERB, which means you have the full power of Ruby available.
|
@@ -57,7 +55,7 @@ Templates are Ruby ERB, which means you have the full power of Ruby available.
|
|
57
55
|
Normally, variables output in your ERB templates using `<%= %>` will be automatically JSON-escaped. You can change
|
58
56
|
this behavior by using the `raw` helper. For instance:
|
59
57
|
|
60
|
-
```
|
58
|
+
```erb
|
61
59
|
<%= raw @foo %>
|
62
60
|
```
|
63
61
|
|
@@ -68,11 +66,12 @@ be JSON-escaped.
|
|
68
66
|
|
69
67
|
Basic partial functionality is available. You can include a partial inside a template as follows:
|
70
68
|
|
71
|
-
```
|
69
|
+
```erb
|
72
70
|
<%= render 'path/to/template.json.erb', { :param1 => 'value1', :param2 => 'value2', ... } %>
|
73
71
|
```
|
74
72
|
|
75
|
-
ERB variables are not automatically passed through to partials - you'll have to explicitly pass them.
|
73
|
+
ERB variables are not automatically passed through to partials - you'll have to explicitly pass them. Paths are
|
74
|
+
first tried relative to caller, and then to the source template.
|
76
75
|
|
77
76
|
### Validation
|
78
77
|
|
@@ -83,7 +82,7 @@ for information on how to use the helpers.
|
|
83
82
|
|
84
83
|
Use pre-defined helpers by creating a Hash named `@validations` in your ERB template. For example:
|
85
84
|
|
86
|
-
```
|
85
|
+
```erb
|
87
86
|
<%
|
88
87
|
@validations = {
|
89
88
|
:param1 => { :presence => true },
|
@@ -162,7 +161,7 @@ Ensures a value exists and has a length greater than 0
|
|
162
161
|
|
163
162
|
You can also write custom validations by raising errors:
|
164
163
|
|
165
|
-
```
|
164
|
+
```erb
|
166
165
|
<%
|
167
166
|
# Validate parameters
|
168
167
|
raise 'Required parameter "@foo" is missing.' if @foo.nil? || @foo.empty?
|
@@ -200,7 +199,26 @@ This gem should not be used with untrusted templates or parameters.
|
|
200
199
|
## Contributing
|
201
200
|
|
202
201
|
1. Fork it
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
202
|
+
1. Create your feature branch (`git checkout -b my-new-feature`)
|
203
|
+
1. Commit your changes (`git commit -am 'Add some feature'`)
|
204
|
+
1. Push to the branch (`git push origin my-new-feature`)
|
205
|
+
1. Create new Pull Request
|
206
|
+
|
207
|
+
## New Releases
|
208
|
+
|
209
|
+
1. Make sure all the rspec and integration tests pass.
|
210
|
+
1. Bump the version in lib/cloudformula/version.rb
|
211
|
+
1. Build the gem (`gem build cloudformula.gemspec`)
|
212
|
+
1. Smoke test the build
|
213
|
+
```
|
214
|
+
$ gem install ./cloudformula-x.y.z.gem
|
215
|
+
Successfully installed cloudformula-x.y.z
|
216
|
+
1 gem installed
|
217
|
+
|
218
|
+
$ irb
|
219
|
+
>> require 'cloudformula'
|
220
|
+
=> true
|
221
|
+
>> "[]".try_to_json # should output "\"[]\""
|
222
|
+
=> "\"[]\""
|
223
|
+
```
|
224
|
+
1. Push the gem to RubyGems.org (`gem push cloudformula-x-y-z.gem`)
|
@@ -39,6 +39,10 @@ module CloudFormula
|
|
39
39
|
# @return [String] The result of generating the template
|
40
40
|
def render(source, parameters = {})
|
41
41
|
raw CloudFormula::Template.new(source, parameters).generate
|
42
|
+
rescue Errno::ENOENT
|
43
|
+
# retry the path, but relative to its parent template
|
44
|
+
relative_to_parent = Pathname.new(@source).parent + source
|
45
|
+
raw CloudFormula::Template.new(relative_to_parent, parameters).generate
|
42
46
|
end
|
43
47
|
|
44
48
|
# Returns the CloudFormation stack options defined by the template.
|
@@ -96,4 +100,4 @@ module CloudFormula
|
|
96
100
|
end
|
97
101
|
|
98
102
|
end
|
99
|
-
end
|
103
|
+
end
|
data/lib/cloudformula/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudformula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kabam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
159
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.
|
160
|
+
rubygems_version: 2.2.2
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: CloudFormula is a tool which generates and uploads CloudFormation templates
|