cask "rubymine" do arch arm: "-aarch64" version "2023.2.5,232.10227.6" sha256 arm: "6ea322efc386ddfc5c55f0edb13a4ddf9c7b6179f1d61050e5d29005437d6c2b", intel: "fffb76d5eb545ccf95146d2435deaaab978dec4e564e099058116df5decc232b" url "https://download.jetbrains.com/ruby/RubyMine-#{version.csv.first}#{arch}.dmg" name "RubyMine" desc "Ruby on Rails IDE" homepage "https://www.jetbrains.com/ruby/" livecheck do url "https://data.services.jetbrains.com/products/releases?code=RM&latest=true&type=release" strategy :json do |json| json["RM"].map do |release| "#{release["version"]},#{release["build"]}" end end end auto_updates true depends_on macos: ">= :high_sierra" app "RubyMine.app" uninstall_postflight do ENV["PATH"].split(File::PATH_SEPARATOR).map { |path| File.join(path, "mine") }.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/RubyMine#{version.major_minor}", "~/Library/Caches/RubyMine#{version.major_minor}", "~/Library/Logs/RubyMine#{version.major_minor}", "~/Library/Preferences/RubyMine#{version.major_minor}", ] end