Files
2023-11-13 04:40:45 +08:00

47 lines
1.6 KiB
Ruby

cask "obs" do
arch arm: "apple", intel: "intel"
livecheck_folder = on_arch_conditional arm: "arm64", intel: "x86_64"
version "30.0.0"
sha256 arm: "a4bd98bc5bf224ef545f264188969a3d39a3e5e275686b8447e8ad7cc704aafc",
intel: "367b12299a7c226b8017108bd251093af50dfe2d86a6b0aaa54180a1da63f657"
url "https://cdn-fastly.obsproject.com/downloads/obs-studio-#{version}-macos-#{arch}.dmg"
name "OBS"
desc "Open-source software for live streaming and screen recording"
homepage "https://obsproject.com/"
livecheck do
url "https://obsproject.com/osx_update/updates_#{livecheck_folder}_v2.xml"
regex(/obs[._-]studio[._-]v?(\d+(?:\.\d+)+)[._-]macos[._-]#{arch}\.dmg/i)
strategy :sparkle do |items, regex|
items.find { |item| item.channel == "stable" }&.url&.scan(regex)&.flatten
end
end
auto_updates true
conflicts_with cask: "homebrew/cask-versions/obs-beta"
depends_on macos: ">= :big_sur"
app "OBS.app"
# shim script (https://github.com/Homebrew/homebrew-cask/issues/18809)
shimscript = "#{staged_path}/obs.wrapper.sh"
binary shimscript, target: "obs"
preflight do
File.write shimscript, <<~EOS
#!/bin/bash
exec '#{appdir}/OBS.app/Contents/MacOS/OBS' "$@"
EOS
end
uninstall delete: "/Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin"
zap trash: [
"~/Library/Application Support/obs-studio",
"~/Library/HTTPStorages/com.obsproject.obs-studio",
"~/Library/Preferences/com.obsproject.obs-studio.plist",
"~/Library/Saved Application State/com.obsproject.obs-studio.savedState",
]
end