Merge pull request #198803 from Homebrew/bump-wizcli-0.69.0
[Homebrew/homebrew-cask.git] / Casks / v / vlc@nightly.rb
blob9aa54d0f87bb5ee6b7d63b535a93c7ec7801f379
1 cask "vlc@nightly" do
2   arch arm: "arm64", intel: "x86_64"
3   livecheck_arch = on_arch_conditional arm: "arm64", intel: "intel64"
5   on_arm do
6     version "4.0.0,20250119-0413,656953f5"
7     sha256 "4648a73554c7857ceb215e66a1a0f2b54be3e49968fe49b35da621c0c5593c01"
8   end
9   on_intel do
10     version "4.0.0,20250119-0415,656953f5"
11     sha256 "32c2cae6252f5a9e164c680f29abfa4a0b7aff52750bc88be80455ddeeda14ba"
12   end
14   url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{version.csv.second}/vlc-#{version.csv.first}-dev-#{livecheck_arch}-#{version.csv.third}.dmg"
15   name "VLC media player"
16   desc "Open-source cross-platform multimedia player"
17   homepage "https://www.videolan.org/vlc/"
19   livecheck do
20     url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/"
21     regex(/href=.*?vlc[._-]v?(\d+(?:\.\d+)+)[._-]dev[._-]#{livecheck_arch}[._-](\h+)\.dmg/i)
22     strategy :page_match do |page, regex|
23       directory = page.scan(%r{href=["']?v?(\d+(?:[.-]\d+)+)/?["' >]}i)
24                       .flatten
25                       .uniq
26                       .max
27       next if directory.blank?
29       # Fetch the directory listing page for newest build
30       build_response = Homebrew::Livecheck::Strategy.page_content(
31         "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{directory}/",
32       )
33       next if (build_page = build_response[:content]).blank?
35       match = build_page.match(regex)
36       next if match.blank?
38       "#{match[1]},#{directory},#{match[2]}"
39     end
40   end
42   conflicts_with cask: "vlc"
44   app "VLC.app"
45   # shim script (https://github.com/Homebrew/homebrew-cask/issues/18809)
46   shimscript = "#{staged_path}/vlc.wrapper.sh"
47   binary shimscript, target: "vlc"
49   preflight do
50     File.write shimscript, <<~EOS
51       #!/bin/sh
52       exec '#{appdir}/VLC.app/Contents/MacOS/VLC' "$@"
53     EOS
54   end
56   zap trash: [
57     "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.videolan.vlc.sfl*",
58     "~/Library/Application Support/org.videolan.vlc",
59     "~/Library/Application Support/VLC",
60     "~/Library/Caches/org.videolan.vlc",
61     "~/Library/Preferences/org.videolan.vlc",
62     "~/Library/Preferences/org.videolan.vlc.plist",
63     "~/Library/Saved Application State/org.videolan.vlc.savedState",
64   ]
65 end