chemtrail 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ec55c365a8264e6d464a846cb9187e47eb1d53d2
4
+ data.tar.gz: 22587299703794f1e4d01b6f18d9d83e6e4548e0
5
+ SHA512:
6
+ metadata.gz: 2d6c928e51908ba77528aa0daaebf8f01d6a2552c885f5e3660cd659f1e1354cdfe951e2115702cec6351628b21e231a2fb39216944d80a64775762396fddf5b
7
+ data.tar.gz: 67b79e1a9312d3aba409ddfb2912b51105ba6412563a47dad5b6d7ba0c911ad66c14ed6bda7709d0d89515c899091c79fffcdc84334f6df16d0863cf326ab3d5
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ chemtrail
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p353
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ rvm:
2
+ - 1.9.3
3
+ - 2.0.0
4
+ script: script/ci.sh
5
+
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem "guard-rspec"
7
+ gem "guard-bundler"
8
+ end
data/Guardfile ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ guard :bundler do
4
+ watch('Gemfile')
5
+ watch(/^.+\.gemspec/)
6
+ end
7
+
8
+ guard :rspec do
9
+ watch(%r{^spec/.+_spec\.rb$})
10
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
11
+ watch('spec/spec_helper.rb') { 'spec' }
12
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Doc Ritezel
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ Chemtrail [![Build Status](https://travis-ci.org/minifast/chemtrail.png)](https://travis-ci.org/minifast/chemtrail) [![Code Climate](https://codeclimate.com/github/minifast/chemtrail.png)](https://codeclimate.com/github/minifast/chemtrail)
2
+ ==========
3
+
4
+ Chemtrail lets you build and test CloudFormation templates.
5
+
6
+
7
+ Origin
8
+ ------
9
+
10
+ Gems like [cloud_formatter](https://github.com/songkick/cloud_formatter),
11
+ [cloud_builder](https://github.com/Optaros/cloud_builder) and
12
+ [cfndsl](https://github.com/howech/cfndsl) are pretty cool for building small
13
+ CloudFormation stacks. A more complex stack involves references, which needs
14
+ an object hierarchy and testing.
15
+
16
+
17
+ Installation
18
+ ------------
19
+
20
+ Add this line to your application's Gemfile:
21
+
22
+ gem 'chemtrail'
23
+
24
+ And then execute:
25
+
26
+ $ bundle
27
+
28
+ Or install it yourself as:
29
+
30
+ $ gem install chemtrail
31
+
32
+
33
+ Usage
34
+ -----
35
+
36
+
37
+ Contributing
38
+ ------------
39
+
40
+ 1. Fork it
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create new Pull Request
data/chemtrail.gemspec 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 'chemtrail/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "chemtrail"
8
+ spec.version = Chemtrail::VERSION
9
+ spec.authors = ["Doc Ritezel"]
10
+ spec.email = ["pair+doc@ministryofvelocity.com"]
11
+ spec.description = %q{Seed your CloudFormation stack}
12
+ spec.summary = %q{Build, create and maintain your CloudFormation stack}
13
+ spec.homepage = "https://github.com/minifast/chemtrail"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "aws-sdk-core"
22
+ spec.add_dependency "hashie"
23
+ spec.add_dependency "thor"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "gem-release"
27
+ spec.add_development_dependency "rspec"
28
+ end
@@ -0,0 +1,27 @@
1
+ class Chemtrail::Declaration
2
+ attr_reader :id, :type
3
+
4
+ def initialize(id, type, specifications = {})
5
+ @id = id
6
+ @type = type
7
+ @specifications = specifications
8
+ end
9
+
10
+ def specifications
11
+ @specifications ||= {}
12
+ end
13
+
14
+ def to_reference
15
+ {
16
+ "Ref" => id
17
+ }
18
+ end
19
+
20
+ def to_hash
21
+ {
22
+ id => {
23
+ "Type" => type
24
+ }.merge(specifications)
25
+ }
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ class Chemtrail::Section < Array
2
+ def to_hash
3
+ map(&:to_hash).reduce(Hash.new, :merge)
4
+ end
5
+ end
@@ -0,0 +1,36 @@
1
+ require "chemtrail/section"
2
+
3
+ class Chemtrail::Template
4
+ attr_reader :description
5
+
6
+ def initialize(description)
7
+ @description = description
8
+ end
9
+
10
+ def parameters
11
+ @parameters ||= Chemtrail::Section.new
12
+ end
13
+
14
+ def mappings
15
+ @mappings ||= Chemtrail::Section.new
16
+ end
17
+
18
+ def resources
19
+ @resources ||= Chemtrail::Section.new
20
+ end
21
+
22
+ def outputs
23
+ @outputs ||= Chemtrail::Section.new
24
+ end
25
+
26
+ def to_hash
27
+ {
28
+ "AWSTemplateFormatVersion" => "2010-09-09",
29
+ "Description" => description,
30
+ "Parameters" => parameters.to_hash,
31
+ "Mappings" => mappings.to_hash,
32
+ "Resources" => resources.to_hash,
33
+ "Outputs" => outputs.to_hash
34
+ }
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ module Chemtrail
2
+ VERSION = "0.0.1"
3
+ end
data/lib/chemtrail.rb ADDED
@@ -0,0 +1,3 @@
1
+ require "chemtrail/version"
2
+ require "chemtrail/template"
3
+ require "chemtrail/declaration"
@@ -0,0 +1,32 @@
1
+ require "spec_helper"
2
+
3
+ describe Chemtrail::Declaration do
4
+ subject(:declaration) { Chemtrail::Declaration.new("parmesan", "String") }
5
+
6
+ describe "#specifications" do
7
+ context "when there are no specifications" do
8
+ its(:specifications) { should be_empty }
9
+ end
10
+
11
+ context "when a specification has been passed into the initializer" do
12
+ subject(:declaration) { Chemtrail::Declaration.new("parmesan", "String", ok: "great") }
13
+
14
+ its(:specifications) { should == {ok: "great"} }
15
+ end
16
+ end
17
+
18
+ describe "#to_reference" do
19
+ its(:to_reference) { should == { "Ref" => "parmesan" } }
20
+ end
21
+
22
+ describe "#to_hash" do
23
+ its(:to_hash) { should have_key "parmesan" }
24
+ specify { declaration.to_hash["parmesan"].should include("Type" => "String") }
25
+
26
+ context "when there is a specification" do
27
+ before { declaration.specifications[:ducks] = "amazing" }
28
+
29
+ specify { declaration.to_hash["parmesan"].should include(ducks: "amazing") }
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,13 @@
1
+ require "spec_helper"
2
+
3
+ describe Chemtrail::Section do
4
+ let(:entry) { double(:entry, to_hash: {tacos: "great"}) }
5
+
6
+ subject(:section) { Chemtrail::Section.new }
7
+
8
+ describe "#to_hash" do
9
+ before { section << entry }
10
+
11
+ its(:to_hash) { should == {tacos: "great"} }
12
+ end
13
+ end
@@ -0,0 +1,91 @@
1
+ require "spec_helper"
2
+
3
+ describe Chemtrail::Template do
4
+ let(:fake_mapping) { double(:mapping, to_hash: {"mapping" => "json"}) }
5
+ let(:fake_output) { double(:output, to_hash: {"output" => "json"}) }
6
+ let(:fake_parameter) { double(:parameter, to_hash: {"parameter" => "json"}) }
7
+ let(:fake_resource) { double(:resource, to_hash: {"resource" => "json"}) }
8
+
9
+ subject(:template) { Chemtrail::Template.new("wat") }
10
+
11
+ describe "#parameters" do
12
+ context "when the template has parameters" do
13
+ before { template.parameters << fake_parameter }
14
+
15
+ its(:parameters) { should =~ [fake_parameter] }
16
+ end
17
+
18
+ context "when the template does not have parameters" do
19
+ its(:parameters) { should be_empty }
20
+ end
21
+ end
22
+
23
+ describe "#mappings" do
24
+ context "when the template has mappings" do
25
+ before { template.mappings << fake_mapping }
26
+
27
+ its(:mappings) { should == [fake_mapping] }
28
+ end
29
+
30
+ context "when the template does not have mappings" do
31
+ its(:mappings) { should be_empty }
32
+ end
33
+ end
34
+
35
+ describe "#resources" do
36
+ context "when the template has resources" do
37
+ before { template.resources << fake_resource }
38
+
39
+ its(:resources) { should == [fake_resource] }
40
+ end
41
+
42
+ context "when the template does not have resources" do
43
+ its(:resources) { should be_empty }
44
+ end
45
+ end
46
+
47
+ describe "#outputs" do
48
+ context "when the template has outputs" do
49
+ before { template.outputs << fake_output }
50
+
51
+ its(:outputs) { should == [fake_output] }
52
+ end
53
+
54
+ context "when the template does not have outputs" do
55
+ its(:outputs) { should be_empty }
56
+ end
57
+ end
58
+
59
+ describe "#to_hash" do
60
+ its(:to_hash) { should include("AWSTemplateFormatVersion" => "2010-09-09") }
61
+ its(:to_hash) { should include("Description" => "wat") }
62
+ its(:to_hash) { should have_key "Parameters" }
63
+ its(:to_hash) { should have_key "Mappings" }
64
+ its(:to_hash) { should have_key "Resources" }
65
+ its(:to_hash) { should have_key "Outputs" }
66
+
67
+ context "when the template has parameters" do
68
+ before { template.parameters << fake_parameter }
69
+
70
+ its(:to_hash) { should include("Parameters" => {"parameter" => "json"}) }
71
+ end
72
+
73
+ context "when the template has mappings" do
74
+ before { template.mappings << fake_mapping }
75
+
76
+ its(:to_hash) { should include("Mappings" => {"mapping" => "json"}) }
77
+ end
78
+
79
+ context "when the template has resources" do
80
+ before { template.resources << fake_resource }
81
+
82
+ its(:to_hash) { should include("Resources" => {"resource" => "json"}) }
83
+ end
84
+
85
+ context "when the template has outputs" do
86
+ before { template.outputs << fake_output }
87
+
88
+ its(:to_hash) { should include("Outputs" => {"output" => "json"}) }
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,8 @@
1
+ require "chemtrail"
2
+
3
+ RSpec.configure do |config|
4
+ config.treat_symbols_as_metadata_keys_with_true_values = true
5
+ config.run_all_when_everything_filtered = true
6
+ config.filter_run :focus
7
+ config.order = 'random'
8
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chemtrail
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Doc Ritezel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: hashie
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: gem-release
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Seed your CloudFormation stack
98
+ email:
99
+ - pair+doc@ministryofvelocity.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - .rspec
106
+ - .ruby-gemset
107
+ - .ruby-version
108
+ - .travis.yml
109
+ - Gemfile
110
+ - Guardfile
111
+ - LICENSE.txt
112
+ - README.md
113
+ - chemtrail.gemspec
114
+ - lib/chemtrail.rb
115
+ - lib/chemtrail/declaration.rb
116
+ - lib/chemtrail/section.rb
117
+ - lib/chemtrail/template.rb
118
+ - lib/chemtrail/version.rb
119
+ - spec/lib/chemtrail/declaration_spec.rb
120
+ - spec/lib/chemtrail/section_spec.rb
121
+ - spec/lib/chemtrail/template_spec.rb
122
+ - spec/spec_helper.rb
123
+ homepage: https://github.com/minifast/chemtrail
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 2.0.14
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: Build, create and maintain your CloudFormation stack
147
+ test_files:
148
+ - spec/lib/chemtrail/declaration_spec.rb
149
+ - spec/lib/chemtrail/section_spec.rb
150
+ - spec/lib/chemtrail/template_spec.rb
151
+ - spec/spec_helper.rb