diff --git a/Library/Homebrew/test/livecheck/strategy/extract_plist_spec.rb b/Library/Homebrew/test/livecheck/strategy/extract_plist_spec.rb index 5e7e03f669..2d0436d392 100644 --- a/Library/Homebrew/test/livecheck/strategy/extract_plist_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/extract_plist_spec.rb @@ -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 diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/livecheck/installer-manual-livecheck.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/livecheck/installer-manual-livecheck.rb new file mode 100644 index 0000000000..98f1b06901 --- /dev/null +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/livecheck/installer-manual-livecheck.rb @@ -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 diff --git a/Library/Homebrew/unversioned_cask_checker.rb b/Library/Homebrew/unversioned_cask_checker.rb index af6a659573..6b465d10f7 100644 --- a/Library/Homebrew/unversioned_cask_checker.rb +++ b/Library/Homebrew/unversioned_cask_checker.rb @@ -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)