From e73524b09325c4aa2e45a945bb2a62fafdfda62f Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Tue, 16 Nov 2021 12:39:27 -0500 Subject: [PATCH] livecheck: Fix debug strategy info printing The `ExtractPlist` strategy doesn't return certain values (e.g., `:url`), so it's necessary to also ensure these values are present before printing related debug info. Without these changes, we end up printing info for a blank value (e.g., "URL (strategy):"). --- Library/Homebrew/livecheck/livecheck.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/livecheck/livecheck.rb b/Library/Homebrew/livecheck/livecheck.rb index c446f0a6c6..b2b1f03570 100644 --- a/Library/Homebrew/livecheck/livecheck.rb +++ b/Library/Homebrew/livecheck/livecheck.rb @@ -658,9 +658,13 @@ module Homebrew end if debug - puts "URL (strategy): #{strategy_data[:url]}" if strategy_data[:url] != url - puts "URL (final): #{strategy_data[:final_url]}" if strategy_data[:final_url] - puts "Regex (strategy): #{strategy_data[:regex].inspect}" if strategy_data[:regex] != livecheck_regex + if strategy_data[:url].present? && strategy_data[:url] != url + puts "URL (strategy): #{strategy_data[:url]}" + end + puts "URL (final): #{strategy_data[:final_url]}" if strategy_data[:final_url].present? + if strategy_data[:regex].present? && strategy_data[:regex] != livecheck_regex + puts "Regex (strategy): #{strategy_data[:regex].inspect}" + end puts "Cached?: Yes" if strategy_data[:cached] == true end