stackup 0.5.0 → 0.6.0

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: 72ac043517d513f34ee9d26b0575dd09490244d3
4
- data.tar.gz: a7964f8761f674eadc3dbd9bef961f3761e9b964
3
+ metadata.gz: 7968636aea4da953ab3902af33236e0705ad4d26
4
+ data.tar.gz: 7c1f9ad8bc8f02f9a59e0a74692c4c54548d171f
5
5
  SHA512:
6
- metadata.gz: a1b6073edf68ff4dd0a75ed31e73787fbd549c2523370eaf1b4c51fd07bbeb5a21e524edc75f1a898b98389af462af28286b3022b9cd12dfbf915c2d27d32362
7
- data.tar.gz: 252fc02edab1de1d593b840238e28d10e59427a5a32d119ee50dad819aa614d4b989ecb3bd0f3b8c80abed6888ad285ed032d208ab3d13cf9f33a660bfcdbaab
6
+ metadata.gz: 2d7cfc30af2ada8982ccdb9fda1b438da8add5f759c20767304d8f5a1a71b857e5c44bb9b3084e73104990b7ea39e1e2e672db5dc606e5b2fbac345a159bd99f
7
+ data.tar.gz: 62dd4d15cf71214870ff0b5ba1234b9d4c7f3f22e58724de38789c91817d4f8f8dda04cfc954f81a66b3f9a6c6d14d3cfb96fbb9fd64c0ee7f8965e02209629d
data/.gitattributes ADDED
@@ -0,0 +1,17 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
3
+
4
+ # Custom for Visual Studio
5
+ *.cs diff=csharp
6
+
7
+ # Standard to msysgit
8
+ *.doc diff=astextplain
9
+ *.DOC diff=astextplain
10
+ *.docx diff=astextplain
11
+ *.DOCX diff=astextplain
12
+ *.dot diff=astextplain
13
+ *.DOT diff=astextplain
14
+ *.pdf diff=astextplain
15
+ *.PDF diff=astextplain
16
+ *.rtf diff=astextplain
17
+ *.RTF diff=astextplain
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .rbenv-*
6
+ .ruby-version
7
+ .yardoc
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
20
+ .rvmrc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,47 @@
1
+ Eval:
2
+ Exclude:
3
+ - "Rakefile"
4
+
5
+ Metrics/AbcSize:
6
+ Enabled: false
7
+
8
+ Metrics/LineLength:
9
+ Max: 120
10
+
11
+ Metrics/MethodLength:
12
+ Max: 30
13
+
14
+ Style/ClassAndModuleChildren:
15
+ EnforcedStyle: nested
16
+ Exclude:
17
+ - "spec/**/*"
18
+
19
+ Style/Documentation:
20
+ Exclude:
21
+ - "spec/**/*"
22
+
23
+ Style/EmptyLinesAroundBlockBody:
24
+ Enabled: false
25
+
26
+ Style/EmptyLinesAroundClassBody:
27
+ EnforcedStyle: empty_lines
28
+
29
+ Style/EmptyLinesAroundModuleBody:
30
+ Enabled: false
31
+
32
+ Style/Encoding:
33
+ EnforcedStyle: when_needed
34
+ Enabled: true
35
+
36
+ Style/FileName:
37
+ Exclude:
38
+ - "bin/*"
39
+
40
+ Style/HashSyntax:
41
+ EnforcedStyle: hash_rockets
42
+
43
+ Style/StringLiterals:
44
+ EnforcedStyle: double_quotes
45
+
46
+ Style/WordArray:
47
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
data/bin/stackup CHANGED
@@ -4,6 +4,7 @@ $LOAD_PATH << File.expand_path("../../lib", __FILE__)
4
4
 
5
5
  require "clamp"
6
6
  require "console_logger"
7
+ require "diffy"
7
8
  require "multi_json"
8
9
  require "stackup"
9
10
  require "stackup/version"
@@ -74,6 +75,12 @@ Clamp do
74
75
  puts "Stack #{change}" unless change.nil?
75
76
  end
76
77
 
78
+ def load_data(file)
79
+ YAML.load_file(file)
80
+ rescue Errno::ENOENT
81
+ signal_error "no such file: #{file.inspect}"
82
+ end
83
+
77
84
  subcommand "status", "Print stack status." do
78
85
 
79
86
  def execute
@@ -115,12 +122,47 @@ Clamp do
115
122
  end
116
123
  end
117
124
 
125
+ end
126
+
127
+ subcommand "diff", "Compare template/params to current stack." do
128
+
129
+ option ["-t", "--template"], "FILE", "template file",
130
+ :attribute_name => :template_file
131
+
132
+ option ["-p", "--parameters"], "FILE", "parameters file",
133
+ :attribute_name => :parameters_file
134
+
135
+ option "--diff-format", "FORMAT", "'text', 'color', or 'html'", :default => "color"
136
+
137
+ def execute
138
+ # rubocop:disable Style/GuardClause
139
+ if template_file
140
+ template = load_data(template_file)
141
+ diff_data(stack.template, template)
142
+ end
143
+ if parameters_file
144
+ parameters = hashify_parameters(load_data(parameters_file))
145
+ diff_data(stack.parameters, parameters)
146
+ end
147
+ end
148
+
118
149
  private
119
150
 
120
- def load_data(file)
121
- YAML.load_file(file)
122
- rescue Errno::ENOENT
123
- signal_error "no such file: #{file.inspect}"
151
+ def diff_data(existing_data, pending_data)
152
+ existing = format_data(existing_data) + "\n"
153
+ pending = format_data(pending_data) + "\n"
154
+ diff = Diffy::Diff.new(existing, pending).to_s(diff_format.to_sym)
155
+ return if diff =~ /\A\s*\Z/
156
+ puts diff
157
+ end
158
+
159
+ def hashify_parameters(parameters)
160
+ return parameters unless parameters.is_a?(Array)
161
+ {}.tap do |result|
162
+ parameters.each do |p|
163
+ result[p["parameter_key"]] = p["parameter_value"]
164
+ end
165
+ end
124
166
  end
125
167
 
126
168
  end
@@ -0,0 +1,6 @@
1
+ [
2
+ {
3
+ "parameter_key": "IndexDoc",
4
+ "parameter_value": "default.htm"
5
+ }
6
+ ]
@@ -0,0 +1 @@
1
+ IndexDoc: index.htm
@@ -1,13 +1,20 @@
1
1
  {
2
2
  "AWSTemplateFormatVersion": "2010-09-09",
3
- "Description": "AWS CloudFormation Sample Template S3_Website_Bucket_With_Retain_On_Delete: Sample template showing how to create a publicly accessible S3 bucket configured for website access with a deletion policy of retail on delete. **WARNING** This template creates an S3 bucket that will NOT be deleted when the stack is deleted. You will be billed for the AWS resources used if you create a stack from this template.",
3
+ "Description": "AWS CloudFormation Sample Template",
4
+ "Parameters": {
5
+ "IndexDoc": {
6
+ "Description": "Website index doc",
7
+ "Type": "String",
8
+ "Default": "index.html"
9
+ }
10
+ },
4
11
  "Resources": {
5
12
  "S3Bucket": {
6
13
  "Type": "AWS::S3::Bucket",
7
14
  "Properties": {
8
15
  "AccessControl": "PublicRead",
9
16
  "WebsiteConfiguration": {
10
- "IndexDocument": "index.html",
17
+ "IndexDocument": { "Ref": "IndexDoc" },
11
18
  "ErrorDocument": "error.html"
12
19
  }
13
20
  }
@@ -1,5 +1,5 @@
1
1
  module Stackup
2
2
 
3
- VERSION = "0.5.0"
3
+ VERSION = "0.6.0"
4
4
 
5
5
  end
data/stackup.gemspec CHANGED
@@ -13,13 +13,18 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/realestate-com-au/stackup"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = Dir["**/*"].reject { |f| File.directory?(f) }
17
- spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
16
+ spec.files = `git ls-files`.split("\n")
17
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+
18
19
  spec.require_paths = ["lib"]
19
20
 
21
+ spec.bindir = "bin"
22
+ spec.executables << "stackup"
23
+
20
24
  spec.add_dependency "aws-sdk", "~> 2.0"
21
25
  spec.add_dependency "clamp", "~> 1.0"
22
26
  spec.add_dependency "console_logger"
27
+ spec.add_dependency "diffy", "~> 3.0.5"
23
28
  spec.add_dependency "multi_json"
24
29
 
25
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Williams
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-14 00:00:00.000000000 Z
12
+ date: 2015-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -53,6 +53,20 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: diffy
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 3.0.5
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 3.0.5
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: multi_json
58
72
  requirement: !ruby/object:Gem::Requirement
@@ -76,35 +90,18 @@ executables:
76
90
  extensions: []
77
91
  extra_rdoc_files: []
78
92
  files:
93
+ - ".gitattributes"
94
+ - ".gitignore"
95
+ - ".rspec"
96
+ - ".rubocop.yml"
97
+ - ".travis.yml"
79
98
  - Gemfile
80
- - Gemfile.lock
81
99
  - README.md
82
100
  - Rakefile
83
101
  - bin/stackup
84
- - doc/Stackup.html
85
- - doc/Stackup/ErrorMappingProxy.html
86
- - doc/Stackup/InvalidStateError.html
87
- - doc/Stackup/NoSuchStack.html
88
- - doc/Stackup/NoUpdateRequired.html
89
- - doc/Stackup/Service.html
90
- - doc/Stackup/ServiceError.html
91
- - doc/Stackup/Stack.html
92
- - doc/Stackup/StackUpdateError.html
93
- - doc/Stackup/StackWatcher.html
94
- - doc/_index.html
95
- - doc/class_list.html
96
- - doc/css/common.css
97
- - doc/css/full_list.css
98
- - doc/css/style.css
99
- - doc/file.README.html
100
- - doc/file_list.html
101
- - doc/frames.html
102
- - doc/index.html
103
- - doc/js/app.js
104
- - doc/js/full_list.js
105
- - doc/js/jquery.js
106
- - doc/method_list.html
107
- - doc/top-level-namespace.html
102
+ - examples/parameters.json
103
+ - examples/parameters.yml
104
+ - examples/template.json
108
105
  - lib/stackup.rb
109
106
  - lib/stackup/error_handling.rb
110
107
  - lib/stackup/errors.rb
@@ -112,16 +109,10 @@ files:
112
109
  - lib/stackup/stack.rb
113
110
  - lib/stackup/stack_watcher.rb
114
111
  - lib/stackup/version.rb
115
- - pkg/stackup-0.2.0.gem
116
- - pkg/stackup-0.3.0.gem
117
- - pkg/stackup-0.4.0.gem
118
112
  - spec/spec_helper.rb
119
113
  - spec/stackup/stack_spec.rb
120
114
  - spec/stackup/stack_watcher_spec.rb
121
115
  - stackup.gemspec
122
- - woollyams/parameters.json
123
- - woollyams/template.json
124
- - woollyams/template.yml
125
116
  homepage: https://github.com/realestate-com-au/stackup
126
117
  licenses:
127
118
  - MIT
@@ -146,4 +137,7 @@ rubygems_version: 2.4.5.1
146
137
  signing_key:
147
138
  specification_version: 4
148
139
  summary: Manage CloudFormation stacks
149
- test_files: []
140
+ test_files:
141
+ - spec/spec_helper.rb
142
+ - spec/stackup/stack_spec.rb
143
+ - spec/stackup/stack_watcher_spec.rb
data/Gemfile.lock DELETED
@@ -1,65 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- stackup (0.5.0)
5
- aws-sdk (~> 2.0)
6
- clamp (~> 1.0)
7
- console_logger
8
- multi_json
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- ast (2.1.0)
14
- astrolabe (1.3.1)
15
- parser (~> 2.2)
16
- aws-sdk (2.1.27)
17
- aws-sdk-resources (= 2.1.27)
18
- aws-sdk-core (2.1.27)
19
- jmespath (~> 1.0)
20
- aws-sdk-resources (2.1.27)
21
- aws-sdk-core (= 2.1.27)
22
- byebug (6.0.2)
23
- clamp (1.0.0)
24
- console_logger (1.0.0)
25
- diff-lcs (1.2.5)
26
- jmespath (1.1.3)
27
- multi_json (1.11.2)
28
- parser (2.2.2.6)
29
- ast (>= 1.1, < 3.0)
30
- powerpack (0.1.1)
31
- rainbow (2.0.0)
32
- rake (10.4.2)
33
- rspec (3.3.0)
34
- rspec-core (~> 3.3.0)
35
- rspec-expectations (~> 3.3.0)
36
- rspec-mocks (~> 3.3.0)
37
- rspec-core (3.3.2)
38
- rspec-support (~> 3.3.0)
39
- rspec-expectations (3.3.1)
40
- diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.3.0)
42
- rspec-mocks (3.3.2)
43
- diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.3.0)
45
- rspec-support (3.3.0)
46
- rubocop (0.34.2)
47
- astrolabe (~> 1.3)
48
- parser (>= 2.2.2.5, < 3.0)
49
- powerpack (~> 0.1)
50
- rainbow (>= 1.99.1, < 3.0)
51
- ruby-progressbar (~> 1.4)
52
- ruby-progressbar (1.7.5)
53
-
54
- PLATFORMS
55
- ruby
56
-
57
- DEPENDENCIES
58
- byebug
59
- rake (~> 10.0)
60
- rspec (~> 3.3)
61
- rubocop (~> 0.32)
62
- stackup!
63
-
64
- BUNDLED WITH
65
- 1.10.6
data/doc/Stackup.html DELETED
@@ -1,202 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- Module: Stackup
8
-
9
- &mdash; Documentation by YARD 0.8.7.6
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- hasFrames = window.top.frames.main ? true : false;
19
- relpath = '';
20
- framesUrl = "frames.html#!Stackup.html";
21
- </script>
22
-
23
-
24
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
-
26
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
-
28
-
29
- </head>
30
- <body>
31
- <div id="header">
32
- <div id="menu">
33
-
34
- <a href="_index.html">Index (S)</a> &raquo;
35
-
36
-
37
- <span class="title">Stackup</span>
38
-
39
-
40
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
- </div>
42
-
43
- <div id="search">
44
-
45
- <a class="full_list_link" id="class_list_link"
46
- href="class_list.html">
47
- Class List
48
- </a>
49
-
50
- <a class="full_list_link" id="method_list_link"
51
- href="method_list.html">
52
- Method List
53
- </a>
54
-
55
- <a class="full_list_link" id="file_list_link"
56
- href="file_list.html">
57
- File List
58
- </a>
59
-
60
- </div>
61
- <div class="clear"></div>
62
- </div>
63
-
64
- <iframe id="search_frame"></iframe>
65
-
66
- <div id="content"><h1>Module: Stackup
67
-
68
-
69
-
70
- </h1>
71
-
72
- <dl class="box">
73
-
74
-
75
-
76
- <dt class="r1">Extended by:</dt>
77
- <dd class="r1">Forwardable</dd>
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
- <dt class="r2 last">Defined in:</dt>
86
- <dd class="r2 last">lib/stackup.rb<span class="defines">,<br />
87
- lib/stackup/stack.rb,<br /> lib/stackup/errors.rb,<br /> lib/stackup/service.rb,<br /> lib/stackup/stack_watcher.rb,<br /> lib/stackup/error_mapping_proxy.rb</span>
88
- </dd>
89
-
90
- </dl>
91
- <div class="clear"></div>
92
-
93
- <h2>Overview</h2><div class="docstring">
94
- <div class="discussion">
95
-
96
- <p>Allow use of `Stackup.stacks` rather than `Stackup().stacks`</p>
97
-
98
-
99
- </div>
100
- </div>
101
- <div class="tags">
102
-
103
-
104
- </div><h2>Defined Under Namespace</h2>
105
- <p class="children">
106
-
107
-
108
-
109
-
110
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Stackup/ErrorMappingProxy.html" title="Stackup::ErrorMappingProxy (class)">ErrorMappingProxy</a></span>, <span class='object_link'><a href="Stackup/InvalidStateError.html" title="Stackup::InvalidStateError (class)">InvalidStateError</a></span>, <span class='object_link'><a href="Stackup/NoSuchStack.html" title="Stackup::NoSuchStack (class)">NoSuchStack</a></span>, <span class='object_link'><a href="Stackup/NoUpdateRequired.html" title="Stackup::NoUpdateRequired (class)">NoUpdateRequired</a></span>, <span class='object_link'><a href="Stackup/Service.html" title="Stackup::Service (class)">Service</a></span>, <span class='object_link'><a href="Stackup/ServiceError.html" title="Stackup::ServiceError (class)">ServiceError</a></span>, <span class='object_link'><a href="Stackup/Stack.html" title="Stackup::Stack (class)">Stack</a></span>, <span class='object_link'><a href="Stackup/StackUpdateError.html" title="Stackup::StackUpdateError (class)">StackUpdateError</a></span>, <span class='object_link'><a href="Stackup/StackWatcher.html" title="Stackup::StackWatcher (class)">StackWatcher</a></span>
111
-
112
-
113
- </p>
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
- <h2>
123
- Class Method Summary
124
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
125
- </h2>
126
-
127
- <ul class="summary">
128
-
129
- <li class="public ">
130
- <span class="summary_signature">
131
-
132
- <a href="#service-class_method" title="service (class method)">+ (Object) <strong>service</strong>(client = {}) </a>
133
-
134
-
135
-
136
- </span>
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
- <span class="summary_desc"><div class='inline'></div></span>
147
-
148
- </li>
149
-
150
-
151
- </ul>
152
-
153
-
154
-
155
-
156
-
157
- <div id="class_method_details" class="method_details_list">
158
- <h2>Class Method Details</h2>
159
-
160
-
161
- <div class="method_details first">
162
- <h3 class="signature first" id="service-class_method">
163
-
164
- + (<tt>Object</tt>) <strong>service</strong>(client = {})
165
-
166
-
167
-
168
-
169
-
170
- </h3><table class="source_code">
171
- <tr>
172
- <td>
173
- <pre class="lines">
174
-
175
-
176
- 11
177
- 12
178
- 13</pre>
179
- </td>
180
- <td>
181
- <pre class="code"><span class="info file"># File 'lib/stackup.rb', line 11</span>
182
-
183
- <span class='kw'>def</span> <span class='id identifier rubyid_service'>service</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
184
- <span class='const'>Stackup</span><span class='op'>::</span><span class='const'>Service</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='rparen'>)</span>
185
- <span class='kw'>end</span></pre>
186
- </td>
187
- </tr>
188
- </table>
189
- </div>
190
-
191
- </div>
192
-
193
- </div>
194
-
195
- <div id="footer">
196
- Generated on Fri Oct 9 11:23:11 2015 by
197
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
198
- 0.8.7.6 (ruby-2.2.2).
199
- </div>
200
-
201
- </body>
202
- </html>