cloudformation-ruby-dsl 0.5.3 → 0.5.4

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: da465e2c61c5e0ed8e43f200ecc5bcada19c4d15
4
- data.tar.gz: 944159f87d612d6c5cc9ec1273c7f0d359c72e81
3
+ metadata.gz: 3c4ac135faa6e385379b3156225d4408853fe025
4
+ data.tar.gz: 683175d8ba2a0933803e4cdfdb07eaed10a00a2c
5
5
  SHA512:
6
- metadata.gz: 2b3e19f1204f0f1fb87aee2322f2aeaed7b516aaefd453857af5b8b832678e8ca919459f788e143909476ad763ac376093ca69757829b3286217384dfeffe082
7
- data.tar.gz: bdcfbe758e2538f545888597e893b79116e99d2b26d3b5953d200df4ca450b360684d403e5d04520ec2c3597948372e28027b79e10758ee3c8f6430ffb21e324
6
+ metadata.gz: 8d25c190a403f173dd70def2b7b59bad1682e969cf3ccf6b786e2901a6a33f20c15ca59ce00520bf51e13acabd383ddcb65c57d7ee78efc974064ab071ccf808
7
+ data.tar.gz: 034d390533c3197d2f2fbffeeed5b4ccb352a6c40475d389cacb997b9a255e3f4111f7e39caa2f05906566499ee54629e497ac3b7525db7255e51cc537b716f9
data/README.md CHANGED
@@ -20,6 +20,14 @@ Run `gem install cloudformation-ruby-dsl` to install system-wide.
20
20
 
21
21
  To use in a specific project, add `gem 'cloudformation-ruby-dsl'` to your Gemfile, and then run `bundle`.
22
22
 
23
+ ## Releasing
24
+
25
+ See [Releasing](docs/Releasing.md).
26
+
27
+ ## Contributing
28
+
29
+ See [Contributing](docs/Contributing.md).
30
+
23
31
  ## Usage
24
32
 
25
33
  To convert existing JSON templates to use the DSL, run
@@ -42,7 +50,7 @@ Below are the various functions currently available in the DSL. See [the example
42
50
  Add the named object to the appropriate collection.
43
51
  - `parameter(name, options)` (may be marked :Immutable, which will raise error on a later change)
44
52
  - `mapping(name, options)`
45
- - `condition(name, options)`
53
+ - `condition(name, conditions)`
46
54
  - `resource(name, options)`
47
55
  - `output(name, options)`
48
56
 
@@ -57,6 +65,14 @@ Invoke an intrinsic CloudFormation function.
57
65
  - `select(index, list)`
58
66
  - `ref(name)`
59
67
 
68
+ Intrinsic conditionals are also supported, with some syntactic sugar.
69
+ - `fn_not(condition)`
70
+ - `fn_or(*condition_list)`
71
+ - `fn_and(*condition_list)`
72
+ - `fn_if(condition, value_if_true, value_if_false)`
73
+ - `equal(lhsOperand, rhsOperand)`
74
+ - `not_equal(lhsOperand, rhsOperand)`
75
+
60
76
  Reference a CloudFormation pseudo parameter.
61
77
  - `aws_account_id()`
62
78
  - `aws_notification_arns()`
@@ -76,4 +92,4 @@ Additional capabilities for file inclusion, etc.
76
92
 
77
93
  ### Default Region
78
94
 
79
- The tool defaults to region 'us-east-1'. To change this set either 'EC2_REGION' or 'AWS_DEFAULT_REGION' environment variables.
95
+ The tool defaults to region `us-east-1`. To change this set either `EC2_REGION` or `AWS_DEFAULT_REGION` in your environment.
@@ -0,0 +1,21 @@
1
+ # Contributing
2
+
3
+ Thanks for your interest in contributing! Here are some things you should know.
4
+
5
+ ## Getting started
6
+
7
+ To get started:
8
+
9
+ - fork this project on github
10
+ - create a new branch named after the change you want to make; i.e., `git checkout -b mynewfeature`
11
+ - make your changes and commit them
12
+ - send a pull request to this project from your fork/branch
13
+
14
+ Once you've sent your pull request, one of the project collaborators will review it and provide feedback. Please accept this commentary as constructive! It is intended as such.
15
+
16
+ ## git
17
+
18
+ We're opinionated about git. Don't be surprised if we ask you to update your pull request to meet the following standards.
19
+
20
+ - rebase+squash your branch into a single commit. For clean git history, we'd prefer we merged in just 1 commit that contains the entire set of changes.
21
+ - don't write commit messages longer than 50 characters. See [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/) for some examples of how to achieve this, and why.
data/docs/Releasing.md ADDED
@@ -0,0 +1,20 @@
1
+ # Releasing
2
+
3
+ ## Performing releases
4
+
5
+ 0. Merge the desired commits to master. But merge them cleanly! See: [merging](#merging)
6
+ 1. Edit and commit the version file in `lib/cloudformation-ruby-dsl/version.rb`. Bump the version based on the [version specification](#versioning-specification)
7
+ 2. `git push` to origin/master
8
+ 3. `rake release`
9
+
10
+ ## Versioning specification
11
+
12
+ For this project, we will follow the methodology proposed by http://semver.org/spec/v2.0.0.html.
13
+
14
+ 1. Major versions break existing interfaces.
15
+ 2. Minor versions are additive only.
16
+ 3. Patch versions are for backward-compatible bug fixes.
17
+
18
+ ## Merging
19
+
20
+ When you use the shiny green "Merge" button on a pull request, github creates a separate commit for the merge (because of the use of the `--no-ff` option). This is noisy and makes git history confusing. Instead of using the green merge button, merge the branch into master using [git-land](https://github.com/bazaarvoice/git-land#git-land) (or manually follow the steps described in the project).
@@ -172,7 +172,8 @@ template do
172
172
  }
173
173
 
174
174
  resource 'InstanceProfile', :Type => 'AWS::IAM::InstanceProfile', :Properties => {
175
- :Path => '/',
175
+ # use cfn intrinsic conditional to choose the 2nd value because the expression evaluates to false
176
+ :Path => fn_if(equals(3, 0), '/unselected/', '/'),
176
177
  :Roles => [ ref('InstanceRole') ],
177
178
  }
178
179
 
@@ -189,6 +190,9 @@ template do
189
190
  :Path => '/',
190
191
  }
191
192
 
193
+ # add conditions that can be used elsewhere in the template
194
+ condition 'myCondition', fn_and(equals("one", "two"), not_equals("three", "four"))
195
+
192
196
  output 'EmailSNSTopicARN',
193
197
  :Value => ref('EmailSNSTopic'),
194
198
  :Description => 'ARN of SNS Topic used to send emails on events.'
@@ -391,6 +391,30 @@ end
391
391
  # Variant of join that matches the native CFN syntax.
392
392
  def join_list(delim, list) { :'Fn::Join' => [ delim, list ] } end
393
393
 
394
+ def equal(one, two) { :'Fn::Equals' => [one, two] } end
395
+
396
+ def fn_not(condition) { :'Fn::Not' => [condition] } end
397
+
398
+ def fn_or(*condition_list)
399
+ case condition_list.length
400
+ when 0..1 then raise "fn_or needs at least 2 items."
401
+ when 2..10 then { :'Fn::Or' => condition_list }
402
+ else raise "fn_or needs a list of 2-10 items that evaluate to true/false."
403
+ end
404
+ end
405
+
406
+ def fn_and(*condition_list)
407
+ case condition_list.length
408
+ when 0..1 then raise "fn_and needs at least 2 items."
409
+ when 2..10 then { :'Fn::And' => condition_list }
410
+ else raise "fn_and needs a list of 2-10 items that evaluate to true/false."
411
+ end
412
+ end
413
+
414
+ def fn_if(cond, if_true, if_false) { :'Fn::If' => [cond, if_true, if_false] } end
415
+
416
+ def not_equal(one, two) fn_not(equal(one,two)) end
417
+
394
418
  def select(index, list) { :'Fn::Select' => [ index, list ] } end
395
419
 
396
420
  def ref(name) { :Ref => name } end
@@ -15,7 +15,7 @@
15
15
  module Cfn
16
16
  module Ruby
17
17
  module Dsl
18
- VERSION = "0.5.3"
18
+ VERSION = "0.5.4"
19
19
  end
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudformation-ruby-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shawn Smith
@@ -15,62 +15,62 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2015-05-08 00:00:00.000000000 Z
18
+ date: 2015-05-19 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: detabulator
22
22
  requirement: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  type: :runtime
28
28
  prerelease: false
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: json
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: xml-simple
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: bundler
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  type: :runtime
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  description: Ruby DSL library that provides a wrapper around the cfn-cmd.
@@ -88,13 +88,15 @@ executables:
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
- - ".gitignore"
91
+ - .gitignore
92
92
  - Gemfile
93
93
  - LICENSE.txt
94
94
  - README.md
95
95
  - Rakefile
96
96
  - bin/cfntemplate-to-ruby
97
97
  - cloudformation-ruby-dsl.gemspec
98
+ - docs/Contributing.md
99
+ - docs/Releasing.md
98
100
  - examples/cloudformation-ruby-script.rb
99
101
  - examples/maps/map.json
100
102
  - examples/maps/map.rb
@@ -181,17 +183,17 @@ require_paths:
181
183
  - bin
182
184
  required_ruby_version: !ruby/object:Gem::Requirement
183
185
  requirements:
184
- - - ">="
186
+ - - '>='
185
187
  - !ruby/object:Gem::Version
186
188
  version: '0'
187
189
  required_rubygems_version: !ruby/object:Gem::Requirement
188
190
  requirements:
189
- - - ">="
191
+ - - '>='
190
192
  - !ruby/object:Gem::Version
191
193
  version: '0'
192
194
  requirements: []
193
195
  rubyforge_project:
194
- rubygems_version: 2.2.2
196
+ rubygems_version: 2.0.14
195
197
  signing_key:
196
198
  specification_version: 4
197
199
  summary: Ruby DSL library that provides a wrapper around the cfn-cmd. Written by