formula_installer: refactor pour_bottle?

Use a better keyword argument rather than passing a hash.
This commit is contained in:
Mike McQuaid 2020-12-15 12:54:03 +00:00
parent 6b3555eb90
commit fc9ad05ad5
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -152,8 +152,8 @@ class FormulaInstaller
!formula.bottle_disabled?
end
sig { params(install_bottle_options: { warn: T::Boolean }).returns(T::Boolean) }
def pour_bottle?(install_bottle_options = { warn: false })
sig { params(output_warning: T::Boolean).returns(T::Boolean) }
def pour_bottle?(output_warning: false)
return false if @pour_failed
return false if !formula.bottle_tag? && !formula.local_bottle_path
@ -164,7 +164,7 @@ class FormulaInstaller
return false if formula.bottle_disabled?
unless formula.pour_bottle?
if install_bottle_options[:warn] && formula.pour_bottle_check_unsatisfied_reason
if output_warning && formula.pour_bottle_check_unsatisfied_reason
opoo <<~EOS
Building #{formula.full_name} from source:
#{formula.pour_bottle_check_unsatisfied_reason}
@ -175,7 +175,7 @@ class FormulaInstaller
bottle = formula.bottle_specification
unless bottle.compatible_locations?
if install_bottle_options[:warn]
if output_warning
opoo <<~EOS
Building #{formula.full_name} from source as the bottle needs:
- HOMEBREW_CELLAR: #{bottle.cellar} (yours is #{HOMEBREW_CELLAR})
@ -1094,7 +1094,7 @@ class FormulaInstaller
return if only_deps?
if pour_bottle?(warn: true)
if pour_bottle?(output_warning: true)
begin
downloader.fetch
rescue Exception => e # rubocop:disable Lint/RescueException