Skip to content

Fixes for Ruby 3.2 #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/octocatalog-diff/catalog-diff/differ.rb
Original file line number Diff line number Diff line change
@@ -412,7 +412,7 @@ def ignore_match?(rule_in, diff_type, hsh, old_val, new_val)
end

# Special 'attributes': Ignore specific diff types (+ add, - remove, ~ and ! change)
if rule[:attr] =~ /\A[\-\+~!]+\Z/
if rule[:attr].is_a?(String) && rule[:attr] =~ /\A[\-\+~!]+\Z/
return ignore_match_true(hsh, rule) if rule[:attr].include?(diff_type)
return false
end
3 changes: 2 additions & 1 deletion lib/octocatalog-diff/catalog-diff/display/text.rb
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions lib/octocatalog-diff/catalog-diff/filter/compilation_dir.rb
Original file line number Diff line number Diff line change
@@ -66,12 +66,12 @@ def remove_compilation_dir(v, dir)
value
end

def traverse(a)
def traverse(a, &p)
case a
when Array
a.map { |v| traverse(v, &Proc.new) }
a.map { |v| traverse(v, &p) }
when Hash
traverse(a.values, &Proc.new)
traverse(a.values, &p)
else
yield a
end
2 changes: 1 addition & 1 deletion lib/octocatalog-diff/facts/yaml.rb
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ def self.fact_retriever(options = {}, node = '')
fact_file_data[0] = '---' if fact_file_data[0] =~ /^---/

# Load the parsed fact file.
parsed = YAML.load(fact_file_data.join("\n"))
parsed = YAML.load(fact_file_data.join("\n"), permitted_classes: [Time])

# This is a handler for a YAML file that has just the facts and none of the
# structure. For example if you saved the output of `facter -y` to a file and
Original file line number Diff line number Diff line change
@@ -254,7 +254,8 @@
'mode' => '0644',
'content' => 'x' * 150,
'owner' => 'root',
'group' => 'wheel'
'group' => 'wheel',
'force' => true,
}
}
]