Merge pull request #13658 from bevanjkay/extract-plist-installerpath

unversioned_cask_checker: check installer artifacts
This commit is contained in:
Mike McQuaid 2022-12-28 15:05:26 +00:00 committed by GitHub
commit 1a21c7e7ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 2 deletions

View File

@ -106,4 +106,14 @@ describe Homebrew::Livecheck::Strategy::ExtractPlist do
.to raise_error(TypeError, Homebrew::Livecheck::Strategy::INVALID_BLOCK_RETURN_VALUE_MSG)
end
end
describe "::find_versions" do
it "returns a for an installer artifact" do
cask = Cask::CaskLoader.load(cask_path("livecheck/installer-manual-livecheck"))
installer_artifact = cask.artifacts.first
expect(installer_artifact).to be_a(Cask::Artifact::Installer)
expect(installer_artifact.path).to be_a(Pathname)
end
end
end

View File

@ -0,0 +1,16 @@
cask "installer-manual-livecheck" do
version "1.2.3"
sha256 "78c670559a609f5d89a5d75eee49e2a2dab48aa3ea36906d14d5f7104e483bb9"
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine-incl-plist.zip"
name "With Installer Manual"
desc "Cask with a manual installer"
homepage "https://brew.sh/"
livecheck do
url :url
strategy :extract_plist
end
installer manual: "Caffeine.app"
end

View File

@ -36,6 +36,11 @@ module Homebrew
@qlplugins ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::Qlplugin) }
end
sig { returns(T::Array[Cask::Artifact::Installer]) }
def installers
@installers ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::Installer) }
end
sig { returns(T::Array[Cask::Artifact::Pkg]) }
def pkgs
@pkgs ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::Pkg) }
@ -88,8 +93,9 @@ module Homebrew
installer.extract_primary_container(to: dir)
info_plist_paths = apps.concat(qlplugins).flat_map do |artifact|
top_level_info_plists(Pathname.glob(dir/"**"/artifact.source.basename/"Contents"/"Info.plist")).sort
info_plist_paths = apps.concat(qlplugins, installers).flat_map do |artifact|
source = artifact.is_a?(Cask::Artifact::Installer) ? artifact.path : artifact.source.basename
top_level_info_plists(Pathname.glob(dir/"**"/source/"Contents"/"Info.plist")).sort
end
info_plist_paths.each(&parse_info_plist)