stackup 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8add9be3778b3deaf928effd033d335ee3b3f183
4
- data.tar.gz: 99e392f73dd644e4a857d8df667bbaba69ab3123
3
+ metadata.gz: a685003b83032534f9b6c8201d658d72b97ba984
4
+ data.tar.gz: 29337a550911b7a812693206cca7b6a7e3a9933f
5
5
  SHA512:
6
- metadata.gz: 2220e80312bb824b45c4a851a02e6cfca1bfe0b0c6edddba9a59ea17f66c9383a18d7b718a95f70dd1d48896b280fc2f6d5737bd127d140c63b80345e1ab0699
7
- data.tar.gz: b692c66ac627adbfae34d70b7996769a90fc00ec91c79904b1d6f3279a9b39ddc144cfd270760d05880c8a0cd8d957a36314be40c7f34ff1b0caf5a63aa00274
6
+ metadata.gz: 9ef3c38343086e98db0a29d8ed8e4362502a3428a6dfd81dfb68a285c01278e75f7660fe6f3706e810d98c70f4b47dd5a11b9f06e191342981c30c20fde91302
7
+ data.tar.gz: 33176851b2506904a937a3fbe391c9316fba67ca3b7a6b0c9e11243a7ab65ba99271adea564fb3fc73b07f329e20e45fb33d0623da48c123cae3269a2e7147ac
data/CHANGES.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.8.2 (2016-05-31)
2
+
3
+ * CLI catches and reports any `Aws::Errors::ServiceError`.
4
+ * Add `--retry-limit` option.
5
+ * Normalize templates (sort by key) before diff-ing them.
6
+
7
+ ## 0.8.1 (2016-04-13)
8
+
9
+ * Add "outputs" rake task.
10
+
1
11
  ## 0.8.0 (2016-03-15)
2
12
 
3
13
  * Add support for stack tags.
data/bin/stackup CHANGED
@@ -30,6 +30,13 @@ Clamp do
30
30
  arg
31
31
  end
32
32
 
33
+ option ["--retry-limit"], "N", "maximum number of retries for API calls",
34
+ :environment_variable => "AWS_API_RETRY_LIMIT" do |arg|
35
+ Integer(arg).tap do |value|
36
+ Aws.config.update(:retry_limit => value)
37
+ end
38
+ end
39
+
33
40
  option "--debug", :flag, "enable debugging"
34
41
 
35
42
  option ["--version"], :flag, "display version" do
@@ -45,7 +52,7 @@ Clamp do
45
52
  signal_error e.message
46
53
  rescue Aws::Errors::MissingCredentialsError
47
54
  signal_error "no credentials provided"
48
- rescue Aws::CloudFormation::Errors::ExpiredToken => e
55
+ rescue Aws::Errors::ServiceError => e
49
56
  signal_error e.message
50
57
  end
51
58
 
@@ -1,4 +1,5 @@
1
1
  require "diffy"
2
+ require "stackup/utils"
2
3
  require "yaml"
3
4
 
4
5
  module Stackup
@@ -14,9 +15,11 @@ module Stackup
14
15
 
15
16
  attr_reader :diff_style
16
17
 
18
+ include Utils
19
+
17
20
  def diff(existing_data, pending_data)
18
- existing = format(existing_data) + "\n"
19
- pending = format(pending_data) + "\n"
21
+ existing = format(normalize_data(existing_data)) + "\n"
22
+ pending = format(normalize_data(pending_data)) + "\n"
20
23
  diff = Diffy::Diff.new(existing, pending).to_s(diff_style)
21
24
  diff unless diff =~ /\A\s*\Z/
22
25
  end
@@ -0,0 +1,21 @@
1
+ module Stackup
2
+
3
+ # Generates diffs of data.
4
+ #
5
+ module Utils
6
+
7
+ def normalize_data(data)
8
+ case data
9
+ when Hash
10
+ pairs = data.sort.map { |k,v| [k, normalize_data(v)] }
11
+ Hash[pairs]
12
+ when Array
13
+ pairs = data.map { |x| normalize_data(x) }
14
+ else
15
+ data
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Stackup
2
2
 
3
- VERSION = "0.8.1"
3
+ VERSION = "0.8.2"
4
4
 
5
5
  end
@@ -0,0 +1,76 @@
1
+ require "spec_helper"
2
+
3
+ require "stackup/utils"
4
+
5
+ describe Stackup::Utils do
6
+
7
+ include Stackup::Utils
8
+
9
+ describe ".normalize_data" do
10
+
11
+ context "with a scalar" do
12
+
13
+ it "returns the input" do
14
+ expect(normalize_data(123)).to eql(123)
15
+ end
16
+
17
+ end
18
+
19
+ context "with a Hash" do
20
+
21
+ it "sorts the Hash" do
22
+ input = {
23
+ "foo" => 1,
24
+ "bar" => 2
25
+ }
26
+ expected_output = {
27
+ "bar" => 2,
28
+ "foo" => 1
29
+ }
30
+ expect(normalize_data(input)).to eql(expected_output)
31
+ end
32
+
33
+ end
34
+
35
+ context "with a nested Hash" do
36
+
37
+ it "sorts the Hash" do
38
+ input = {
39
+ "stuff" => {
40
+ "foo" => 1,
41
+ "bar" => 2
42
+ }
43
+ }
44
+ expected_output = {
45
+ "stuff" => {
46
+ "bar" => 2,
47
+ "foo" => 1
48
+ }
49
+ }
50
+ expect(normalize_data(input)).to eql(expected_output)
51
+ end
52
+
53
+ end
54
+
55
+ context "with an array of Hashes" do
56
+
57
+ it "sorts the all" do
58
+ input = [
59
+ {
60
+ "foo" => 1,
61
+ "bar" => 2
62
+ }
63
+ ]
64
+ expected_output = [
65
+ {
66
+ "bar" => 2,
67
+ "foo" => 1
68
+ }
69
+ ]
70
+ expect(normalize_data(input)).to eql(expected_output)
71
+ end
72
+
73
+ end
74
+
75
+ end
76
+ 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.8.1
4
+ version: 0.8.2
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: 2016-04-13 00:00:00.000000000 Z
12
+ date: 2016-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-resources
@@ -102,11 +102,13 @@ files:
102
102
  - lib/stackup/service.rb
103
103
  - lib/stackup/stack.rb
104
104
  - lib/stackup/stack_watcher.rb
105
+ - lib/stackup/utils.rb
105
106
  - lib/stackup/version.rb
106
107
  - spec/spec_helper.rb
107
108
  - spec/stackup/parameters_spec.rb
108
109
  - spec/stackup/stack_spec.rb
109
110
  - spec/stackup/stack_watcher_spec.rb
111
+ - spec/stackup/utils_spec.rb
110
112
  homepage: https://github.com/realestate-com-au/stackup
111
113
  licenses:
112
114
  - MIT
@@ -136,3 +138,4 @@ test_files:
136
138
  - spec/stackup/parameters_spec.rb
137
139
  - spec/stackup/stack_spec.rb
138
140
  - spec/stackup/stack_watcher_spec.rb
141
+ - spec/stackup/utils_spec.rb