From d5155256ce34595a72676d0ced9fa866d778b96c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 23 Apr 2017 18:56:22 +0100 Subject: Fix audit version_scheme and revision checks. Another attempt at fixing `brew audit` issues around detecting `revision` and `version_scheme` changes correctly. First done in #1754 and #2086 (reverted in #2099 and #2100). To ease future debugging a `ph` helper has been added to print a hash and a series of RSpec tests to verify that the `revision`, `version_scheme` and `version` formula version audits behave as expected. Fixes #1731. --- Library/Homebrew/utils.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Library/Homebrew/utils.rb') diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 0ecc06d2a..82bc38895 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -517,3 +517,19 @@ def migrate_legacy_keg_symlinks_if_necessary end FileUtils.rm_rf legacy_pinned_kegs end + +def puts_hash(hash, indent: 0) + return hash unless hash.is_a? Hash + hash.each do |key, value| + indent_spaces = " " * (indent * 2) + printf "#{indent_spaces}#{key}:" + if value.is_a? Hash + puts + puts_hash(value, indent: indent+1) + else + puts " #{value}" + end + end + hash +end +alias ph puts_hash -- cgit v1.2.3