livecheck: fix implicit no-api handling

This commit is contained in:
Bo Anderson 2023-07-10 14:50:53 +01:00
parent 5b30de880d
commit 54a1f2005a
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
2 changed files with 7 additions and 5 deletions

View File

@ -113,10 +113,12 @@ module Homebrew
return [nil, references] if livecheck_formula.blank? && livecheck_cask.blank?
# Load the referenced formula or cask
referenced_formula_or_cask = if livecheck_formula
Formulary.factory(livecheck_formula)
elsif livecheck_cask
Cask::CaskLoader.load(livecheck_cask)
referenced_formula_or_cask = Homebrew.with_no_api_env do
if livecheck_formula
Formulary.factory(livecheck_formula)
elsif livecheck_cask
Cask::CaskLoader.load(livecheck_cask)
end
end
# Error if a `livecheck` block references a formula/cask that was already

View File

@ -104,7 +104,7 @@ module Homebrew
unversioned_cask_checker = if url.present? && url != cask.url.to_s
# Create a copy of the `cask` that uses the `livecheck` block URL
cask_copy = Cask::CaskLoader.load(cask.full_name)
cask_copy = Cask::CaskLoader.load(cask.sourcefile_path)
cask_copy.allow_reassignment = true
cask_copy.url { url }
UnversionedCaskChecker.new(cask_copy)