From eca703406341a4585b0f3e1343fafb43dc870208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ga=C3=9F?= Date: Mon, 15 Jul 2024 11:59:36 +0200 Subject: [PATCH] fix "undefined method `=~' for false:FalseClass" on Ruby >= 3.2 see https://bugs.ruby-lang.org/issues/15231 --- lib/octocatalog-diff/catalog-diff/display/text.rb | 3 ++- spec/octocatalog-diff/tests/catalog-diff/display/text_spec.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/octocatalog-diff/catalog-diff/display/text.rb b/lib/octocatalog-diff/catalog-diff/display/text.rb index 17e4aadd..c4cc13c5 100644 --- a/lib/octocatalog-diff/catalog-diff/display/text.rb +++ b/lib/octocatalog-diff/catalog-diff/display/text.rb @@ -367,12 +367,13 @@ def self.addition_only_no_truncation(depth, hash) # Single line strings hash.keys.sort.map do |key| - next if hash[key] =~ /\n/ + next if hash[key].kind_of?(String) && hash[key] =~ /\n/ result << left_pad(2 * depth + 4, [key.inspect, ': ', hash[key].inspect].join('')).green end # Multi-line strings hash.keys.sort.map do |key| + next if !hash[key].kind_of?(String) next if hash[key] !~ /\n/ result << left_pad(2 * depth + 4, [key.inspect, ': >>>'].join('')).green result.concat hash[key].split(/\n/).map(&:green) diff --git a/spec/octocatalog-diff/tests/catalog-diff/display/text_spec.rb b/spec/octocatalog-diff/tests/catalog-diff/display/text_spec.rb index f05f491c..9d9069d4 100644 --- a/spec/octocatalog-diff/tests/catalog-diff/display/text_spec.rb +++ b/spec/octocatalog-diff/tests/catalog-diff/display/text_spec.rb @@ -254,7 +254,8 @@ 'mode' => '0644', 'content' => 'x' * 150, 'owner' => 'root', - 'group' => 'wheel' + 'group' => 'wheel', + 'force' => true, } } ]