cf_parameters 0.1.1
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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +56 -0
- data/Rakefile +2 -0
- data/bin/cf_parameters +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/cf_parameters.gemspec +28 -0
- data/lib/cf_parameters.rb +19 -0
- data/lib/cf_parameters/version.rb +3 -0
- data/some.yml +2 -0
- metadata +92 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 80fba8c8d0c99fab4d69ea7fe289f8650082fb47
|
4
|
+
data.tar.gz: cb701eb3c6b5fd940d66db3541598f3eb063237c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 171349a1de0d860583d3fdaec1beaa92acd6b854e847018dba88c69340fddeacd5b1fade1d91600ab94e200e0f05b6e4cd01dcd64f8b333022587739abea688e
|
7
|
+
data.tar.gz: 1cb007d47bcc96ac460d7eda537d9ddd1bf20e13b0354fd42d645f9ba9fbf98ab3a34d83f4f7ce9ebe66b9180c8617b953a364a923fcef1ea404fccdaed01ad0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Jose Luis Ordiales Coscia
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# CfParameters
|
2
|
+
|
3
|
+
CloudFormation JSON files to specify input parameters are cumbersome to
|
4
|
+
[write](http://blogs.aws.amazon.com/application-management/post/Tx1A23GYVMVFKFD/Passing-Parameters-to-CloudFormation-Stacks-with-the-AWS-CLI-and-Powershell).
|
5
|
+
They also don't provide any easy way to specify values from environment
|
6
|
+
variables. This small script allows you to specify key/value pairs in YAML
|
7
|
+
format with the added capability of resolving those values from environment
|
8
|
+
variables if the value starts with $. You can write the output to a file and
|
9
|
+
pass that to CloudFormation together with your template.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'cf_parameters'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install cf_parameters
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
```bash
|
29
|
+
cat some.yml
|
30
|
+
|
31
|
+
key1: value1
|
32
|
+
key2: $SOME_ENV_VAR
|
33
|
+
|
34
|
+
export SOME_ENV_VAR=5
|
35
|
+
|
36
|
+
cf_parameters some.yml
|
37
|
+
|
38
|
+
[
|
39
|
+
{
|
40
|
+
"ParameterKey": "key1",
|
41
|
+
"ParamterValue": "value1"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"ParameterKey": "key2",
|
45
|
+
"ParamterValue": "5"
|
46
|
+
}
|
47
|
+
]
|
48
|
+
|
49
|
+
```
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
1. Fork it ( https://github.com/[my-github-username]/easy_cf_parameters/fork )
|
53
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
54
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
55
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
56
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/cf_parameters
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "cf_parameters"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cf_parameters/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cf_parameters"
|
8
|
+
spec.version = CfParameters::VERSION
|
9
|
+
spec.authors = ["Jose Luis Ordiales Coscia"]
|
10
|
+
spec.email = ["jlordiales@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Convert YAML to the JSON File format expected by CloudFormation}
|
13
|
+
spec.description = %q{CloudFormation JSON files to specify input parameters are cumbersome
|
14
|
+
to write. They also don't provide any easy way to specify values from enviroment variables.
|
15
|
+
This small script allows you to specify key/value pairs in YAML format with the added
|
16
|
+
capability of resolving those values from enviroment variables. You can write the output to a
|
17
|
+
file and pass that to CloudFormation together with your template.}
|
18
|
+
spec.homepage = "https://github.com/jlordiales/easy_cf_parameters.git"
|
19
|
+
spec.license = "MIT"
|
20
|
+
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
spec.bindir = "bin"
|
23
|
+
spec.executables = "cf_parameters"
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.8"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "cf_parameters/version"
|
2
|
+
require "yaml"
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module CfParameters
|
6
|
+
class CFParameterGenerator
|
7
|
+
def get_cf_parameters(yamlInput)
|
8
|
+
yaml_parameters = YAML.load_file(yamlInput)
|
9
|
+
cf_parameters = []
|
10
|
+
|
11
|
+
yaml_parameters.each do |key, value|
|
12
|
+
realValue = if value.start_with?("$") then ENV[value[1..-1]] else value end
|
13
|
+
new_parameter = {"ParameterKey" => key, "ParamterValue" => realValue}
|
14
|
+
cf_parameters.push(new_parameter)
|
15
|
+
end
|
16
|
+
JSON.pretty_generate(cf_parameters)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/some.yml
ADDED
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cf_parameters
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jose Luis Ordiales Coscia
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: "CloudFormation JSON files to specify input parameters are cumbersome\n
|
42
|
+
\ to write. They also don't provide any easy way to specify values from enviroment
|
43
|
+
variables.\n This small script allows you to specify key/value pairs in YAML format
|
44
|
+
with the added\n capability of resolving those values from enviroment variables.
|
45
|
+
You can write the output to a \n file and pass that to CloudFormation together
|
46
|
+
with your template."
|
47
|
+
email:
|
48
|
+
- jlordiales@gmail.com
|
49
|
+
executables:
|
50
|
+
- cf_parameters
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- ".gitignore"
|
55
|
+
- ".rspec"
|
56
|
+
- ".travis.yml"
|
57
|
+
- Gemfile
|
58
|
+
- LICENSE.txt
|
59
|
+
- README.md
|
60
|
+
- Rakefile
|
61
|
+
- bin/cf_parameters
|
62
|
+
- bin/console
|
63
|
+
- bin/setup
|
64
|
+
- cf_parameters.gemspec
|
65
|
+
- lib/cf_parameters.rb
|
66
|
+
- lib/cf_parameters/version.rb
|
67
|
+
- some.yml
|
68
|
+
homepage: https://github.com/jlordiales/easy_cf_parameters.git
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 2.4.6
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: Convert YAML to the JSON File format expected by CloudFormation
|
92
|
+
test_files: []
|