cask "webstorm" do arch arm: "-aarch64" version "2023.2.5,232.10227.9" sha256 arm: "00dc50805e6685ae63f4fe54dcc0289f94ccfa81daead374f8fec1b1303b746a", intel: "d22523f30776b357098c62e296c8b6a5a3bdbcf86a62246f510792c4cd090189" url "https://download.jetbrains.com/webstorm/WebStorm-#{version.csv.first}#{arch}.dmg" name "WebStorm" desc "JavaScript IDE" homepage "https://www.jetbrains.com/webstorm/" livecheck do url "https://data.services.jetbrains.com/products/releases?code=WS&latest=true&type=release" strategy :json do |json| json["WS"].map do |release| "#{release["version"]},#{release["build"]}" end end end auto_updates true depends_on macos: ">= :high_sierra" app "WebStorm.app" uninstall_postflight do ENV["PATH"].split(File::PATH_SEPARATOR).map { |path| File.join(path, "wstorm") }.each do |path| if File.readable?(path) && File.readlines(path).grep(/# see com.intellij.idea.SocketLock for the server side of this interface/).any? File.delete(path) end end end zap trash: [ "~/Library/Application Support/JetBrains/WebStorm#{version.major_minor}", "~/Library/Caches/JetBrains/WebStorm#{version.major_minor}", "~/Library/Logs/JetBrains/WebStorm#{version.major_minor}", "~/Library/Preferences/com.jetbrains.WebStorm.plist", "~/Library/Preferences/jetbrains.webstorm.*.plist", "~/Library/Preferences/WebStorm#{version.major_minor}", "~/Library/Saved Application State/com.jetbrains.WebStorm.savedState", ] end