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):").
This commit is contained in:
Sam Ford 2021-11-16 12:39:27 -05:00
parent 9e8900fb6e
commit e73524b093
No known key found for this signature in database
GPG Key ID: 95209E46C7FFDEFE

View File

@ -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