terraform_landscape 0.1.18 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/terraform_landscape/terraform_plan.rb +15 -1
- data/lib/terraform_landscape/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 238ce061acc60e402752059e8db87f6948db29b0c88ef4865b4f67405de76d49
|
4
|
+
data.tar.gz: 1a42681d106186e774a8a40d91eb7363b0076ee14de2b4bfe9263f28233024ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfd3f019872030754bfd6a22876af12630ec0cab498d8d1d61c10f400eee9a5904fae8e6f53d0abb7411af3510f9211791bba469cfce41bae2c868564e05c6be
|
7
|
+
data.tar.gz: 6c01e25f7987eda2c7d710a7509e1e09587f70a97cb6064f20dcbb10adabf350cedb2be6af58a58f3862d15b73a9856fbbdb890878a94192a0f149be2e4b2a09
|
@@ -111,7 +111,8 @@ class TerraformLandscape::TerraformPlan # rubocop:disable Metrics/ClassLength
|
|
111
111
|
# Can't JSON.parse an empty string, so handle it separately
|
112
112
|
return '' if value.strip.empty?
|
113
113
|
|
114
|
-
|
114
|
+
sorted = recursive_sort(JSON.parse(value))
|
115
|
+
JSON.pretty_generate(sorted,
|
115
116
|
{
|
116
117
|
indent: ' ',
|
117
118
|
space: ' ',
|
@@ -120,6 +121,19 @@ class TerraformLandscape::TerraformPlan # rubocop:disable Metrics/ClassLength
|
|
120
121
|
})
|
121
122
|
end
|
122
123
|
|
124
|
+
def recursive_sort(obj)
|
125
|
+
case obj
|
126
|
+
when Array
|
127
|
+
obj.map { |item| recursive_sort(item) }
|
128
|
+
when Hash
|
129
|
+
obj.keys.sort.each_with_object({}) do |key, hash|
|
130
|
+
hash[key] = recursive_sort(obj[key])
|
131
|
+
end
|
132
|
+
else
|
133
|
+
obj
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
123
137
|
def display_diff(old, new, indent)
|
124
138
|
@out.print Diffy::Diff.new(old, new, { context: @diff_context_lines })
|
125
139
|
.to_s(String.disable_colorization ? :text : :color)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraform_landscape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Coinbase
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|