cask "bitfocus-buttons" do arch arm: "arm", intel: "x64" livecheck_arch = on_arch_conditional arm: "arm", intel: "intel" version "1.6.9,5647,8ab35c7c" sha256 arm: "c2ab3d1e012e0d8e071c34ff0a6061fb9fd2068c12970b4baf25cbb22ef47e78", intel: "835c1f7d3222093fa4fe56e41e976a12cc60c04a8c4970713431763827a5b6b9" url "https://s4.bitfocus.io/builds/buttons/bitfocus-buttons-mac-#{arch}-#{version.csv.second}-#{version.csv.third}.pkg" name "Bitfocus Buttons" desc "Unified control and monitoring software" homepage "https://bitfocus.io/buttons" livecheck do url "https://api.bitfocus.io/v1/product/buttons/packages?branch=stable&limit=150" regex(/buttons[._-]mac[._-]#{arch}[._-]v?(\d+(?:\.\d+)*)[._-](\h+)\.pkg/i) strategy :json do |json, regex| json["packages"]&.map do |package| next if package["target"] != "mac-#{livecheck_arch}" match = package["uri"]&.match(regex) next if match.blank? "#{package["version"]&.tr("v", "")},#{match[1]},#{match[2]}" end end end depends_on :macos pkg "bitfocus-buttons-mac-#{arch}-#{version.csv.second}-#{version.csv.third}.pkg" uninstall pkgutil: "io.bitfocus.buttons.pkg" zap trash: [ "~/Library/Application Support/Bitfocus Buttons", "~/Library/Caches/io.bitfocus.buttons", "~/Library/Preferences/io.bitfocus.buttons.plist", "~/Library/WebKit/io.bitfocus.buttons", ] end