homebrew-cask/Casks/pycharm-ce.rb

54 lines
1.8 KiB
Ruby

cask "pycharm-ce" do
arch = Hardware::CPU.intel? ? "" : "-aarch64"
version "2021.3.2,213.6777.50"
if Hardware::CPU.intel?
sha256 "b8f41f5dddeda0ed5f5c81ba57d2560ccc6e227987882fb6bf305b5d1d8c6909"
else
sha256 "407bf395cfb6d61f1c0861c7679b197238780e82a019e10162b8cd7130edb15a"
end
url "https://download.jetbrains.com/python/pycharm-community-#{version.csv.first}#{arch}.dmg"
name "Jetbrains PyCharm Community Edition"
name "PyCharm CE"
desc "IDE for Python programming - Community Edition"
homepage "https://www.jetbrains.com/pycharm/"
livecheck do
url "https://data.services.jetbrains.com/products/releases?code=PCC&latest=true&type=release"
strategy :page_match do |page|
JSON.parse(page)["PCC"].map do |release|
"#{release["version"]},#{release["build"]}"
end
end
end
auto_updates true
depends_on macos: ">= :high_sierra"
app "PyCharm CE.app"
uninstall_postflight do
ENV["PATH"].split(File::PATH_SEPARATOR).map { |path| File.join(path, "charm") }.each do |path|
if File.exist?(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/PyCharm#{version.major_minor}",
"~/Library/Caches/JetBrains/PyCharmCE#{version.major_minor}",
"~/Library/Caches/PyCharm#{version.major_minor}",
"~/Library/Caches/PyCharmCE#{version.major_minor}",
"~/Library/Logs/JetBrains/PyCharmCE#{version.major_minor}",
"~/Library/Logs/PyCharm#{version.major_minor}",
"~/Library/Logs/PyCharmCE#{version.major_minor}",
"~/Library/Preferences/PyCharm#{version.major_minor}",
"~/Library/Preferences/PyCharmCE#{version.major_minor}",
"~/Library/Saved Application State/com.jetbrains.pycharm.savedState",
]
end