Merge pull request #198799 from Homebrew/bump-huly-0.6.411
[Homebrew/homebrew-cask.git] / Casks / s / snes9x.rb
blobcf7b5a87a9d937c6d1d601ca689fd995f672db19
1 cask "snes9x" do
2   version "1.63"
3   sha256 "dce88223b0b373357249bfb604415a379dcba6a996ca254bdeca5b16a8564c69"
5   url "https://github.com/snes9xgit/snes9x/releases/download/#{version}/snes9x-#{version}-Mac.zip",
6       verified: "github.com/snes9xgit/snes9x/"
7   name "Snes9x"
8   desc "Video game console emulator"
9   homepage "https://www.snes9x.com/"
11   # Releases sometimes don't have a macOS build, so we check multiple
12   # recent releases instead of only the "latest" release. NOTE: We should be
13   # able to use `strategy :github_latest` or drop livecheck altogether
14   # when subsequent releases provide files for macOS again.
15   livecheck do
16     url :url
17     regex(/^snes9x[._-]v?(\d+(?:\.\d+)+)[._-]Mac\.zip$/i)
18     strategy :github_releases do |json, regex|
19       json.map do |release|
20         next if release["draft"] || release["prerelease"]
22         release["assets"]&.map do |asset|
23           match = asset["name"]&.match(regex)
24           next if match.blank?
26           match[1]
27         end
28       end.flatten
29     end
30   end
32   depends_on macos: ">= :sierra"
34   app "Snes9x.app"
36   zap trash: [
37     "~/Library/Application Support/Snes9x",
38     "~/Library/Preferences/com.snes9x.macos.snes9x.plist",
39     "~/Library/Saved Application State/com.snes9x.macos.snes9x.savedState",
40   ]
41 end