terraform_landscape 0.3.1 → 0.3.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
  SHA256:
3
- metadata.gz: 9d031c52891f2756e052628eac29040a6ffcd256887c7f05e06ac14ca0ae32e7
4
- data.tar.gz: c0b75e6932f9985f2434b33232bef61efb06817712ea6c1ae279483adeb556a9
3
+ metadata.gz: 71f22a7ae9d3dbbc5d2c763bf68d25f20c8e08218ae2e30452050ce20cf488c4
4
+ data.tar.gz: 4d328acc7803b44431fccdde6b8ea494d578a4325e9d02c250fe8de743b79597
5
5
  SHA512:
6
- metadata.gz: ef20a22fad2f137c0f585a8a2a5c794b9abfd71c700c94e8ee5e9c6a80af1e7f00d8f38cab5bc13c38032a0b1dbc08db4380fb9d0761bd80f996f07ad32c4e99
7
- data.tar.gz: 3a0864c1eddeaa402c056a7079fdbfb71050a35c8b31570e5a8a7ce06f4d48cf1e4335286be3b4a4f6f3d27d255f4492c4cd2ba5eb21c0c503eaff5f6905ff1a
6
+ metadata.gz: 4a6d279f8e791d657faf8efa9b8f06191b75d2ad49bc88f8321abe1eae8d61c5d2fc731e6744d761d6189c936e2a64f45a36f6ea51dcd1717382916411830dc0
7
+ data.tar.gz: 6f3be4f83a3c7f3d47617d0a74d81f78c0c38064c6b5aeec032318ddb4c7999e8b94178c96587c756605e67b142c11b80dc6f1b82acb0b42fce25a88861bc629
@@ -24,6 +24,10 @@ class TerraformLandscape::TerraformPlan # rubocop:disable Metrics/ClassLength
24
24
 
25
25
  DEFAULT_DIFF_CONTEXT_LINES = 5
26
26
 
27
+ UNICODE_ESCAPER = proc { |s|
28
+ format('\u%04X', s.codepoints[0])
29
+ }
30
+
27
31
  class ParseError < StandardError; end
28
32
 
29
33
  class << self
@@ -102,6 +106,10 @@ class TerraformLandscape::TerraformPlan # rubocop:disable Metrics/ClassLength
102
106
  longest_name_length + 8
103
107
  end
104
108
 
109
+ def undump(value)
110
+ value.encode('ASCII', fallback: UNICODE_ESCAPER).undump
111
+ end
112
+
105
113
  def json?(value)
106
114
  ['{', '['].include?(value.to_s[0]) &&
107
115
  (JSON.parse(value) rescue nil) # rubocop:disable Style/RescueModifier
@@ -178,8 +186,8 @@ class TerraformLandscape::TerraformPlan # rubocop:disable Metrics/ClassLength
178
186
  )
179
187
  # Since the attribute line is always of the form "old value" => "new value"
180
188
  attribute_value =~ /^ *(".*") *=> *(".*") *$/
181
- old = Regexp.last_match[1].undump
182
- new = Regexp.last_match[2].undump
189
+ old = undump(Regexp.last_match[1])
190
+ new = undump(Regexp.last_match[2])
183
191
 
184
192
  return if old == new && new != '<sensitive>' # Don't show unchanged attributes
185
193
 
@@ -218,7 +226,7 @@ class TerraformLandscape::TerraformPlan # rubocop:disable Metrics/ClassLength
218
226
  @out.print " #{attribute_name}:".ljust(attribute_value_indent_amount, ' ')
219
227
  .colorize(change_color)
220
228
 
221
- evaluated_string = attribute_value.undump
229
+ evaluated_string = undump(attribute_value)
222
230
  if json?(evaluated_string)
223
231
  @out.print to_pretty_json(evaluated_string).gsub("\n",
224
232
  "\n#{attribute_value_indent}")
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module TerraformLandscape
5
- VERSION = '0.3.1'.freeze
5
+ VERSION = '0.3.2'.freeze
6
6
  end
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.3.1
4
+ version: 0.3.2
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: 2019-02-07 00:00:00.000000000 Z
12
+ date: 2019-03-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
- rubygems_version: 3.0.1
108
+ rubygems_version: 3.0.3
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: Pretty-print Terraform plan output