Merge pull request #15657 from Bo98/livecheck-no-api

livecheck: fix implicit no-api handling
This commit is contained in:
Bo Anderson 2023-07-10 15:06:30 +01:00 committed by GitHub
commit 7988f2ae1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

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

View File

@ -104,7 +104,7 @@ module Homebrew
unversioned_cask_checker = if url.present? && url != cask.url.to_s unversioned_cask_checker = if url.present? && url != cask.url.to_s
# Create a copy of the `cask` that uses the `livecheck` block URL # 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.allow_reassignment = true
cask_copy.url { url } cask_copy.url { url }
UnversionedCaskChecker.new(cask_copy) UnversionedCaskChecker.new(cask_copy)