cask "kdiff3" do # NOTE: "3" is not a version number, but an intrinsic part of the product name arch arm: "arm64", intel: "x86_64" on_arm do version "1.12.0" sha256 "88629976cd52ecded01afe35c2ad16375565033009df256097cb92cd76f94cb4" end on_intel do version "1.12.0" sha256 "ef82fd651c4f23f29bad66682dc65f2a729bb8b12f41e160cdac9468c8e1f677" end url "https://download.kde.org/stable/kdiff3/kdiff3-#{version}-macos-#{arch}.dmg" name "KDiff3" desc "Utility for comparing and merging files and directories" homepage "https://invent.kde.org/sdk/kdiff3" livecheck do url "https://download.kde.org/stable/kdiff3/" regex(/href=["']?kdiff3[._-]v?(\d+(?:\.\d+)+)[._-]macos[._-]#{arch}\.dmg/i) end depends_on macos: ">= :catalina" app "kdiff3.app" shimscript = "#{staged_path}/kdiff3.wrapper.sh" binary shimscript, target: "kdiff3" preflight do File.write shimscript, <<~EOS #!/bin/bash '#{appdir}/kdiff3.app/Contents/MacOS/kdiff3' "$@" EOS end zap trash: [ "~/.kdiff3rc", "~/Library/Application Support/kdiff3", "~/Library/Preferences/kdiff3rc", ] end