cask "praat" do version "6.3.17,6317" sha256 "15e0f4e4fd0474ec171e5be8e0d78b8f10bab9bfe2e0be22ee09cfd92300b47f" url "https://github.com/praat/praat/releases/download/v#{version.csv.first}/praat#{version.csv.second}_mac.dmg", verified: "github.com/praat/praat/" name "Praat" desc "Doing phonetics by computer" homepage "https://www.fon.hum.uva.nl/praat/" livecheck do url "https://github.com/praat/praat/releases/latest" regex(%r{href=.*?(\d+(?:\.\d+)+)/praat(\d+)[._-]mac\.dmg}i) strategy :header_match do |headers, regex| next if headers["location"].blank? # Identify the latest tag from the response's `location` header latest_tag = File.basename(headers["location"]) next if latest_tag.blank? # Fetch the assets list HTML for the latest tag and match within it assets_page = Homebrew::Livecheck::Strategy.page_content( @url.sub(%r{/releases/?.+}, "/releases/expanded_assets/#{latest_tag}"), ) assets_page[:content]&.scan(regex)&.map { |match| "#{match[0]},#{match[1]}" } end end app "Praat.app" binary "#{appdir}/Praat.app/Contents/MacOS/Praat", target: "praat" zap trash: [ "~/Library/Preferences/Praat Prefs", "~/Library/Saved Application State/org.praat.Praat.savedState", ] end