cask "google-cloud-sdk" do arch arm: "arm", intel: "x86_64" version "529.0.0" sha256 arm: "289abdd0d241bff268b89366c4e52257f7cb5ff49626a6de2974d83239580a7e", intel: "d81c1740edd039004839e6eae4921c4fec0b5ff5fa104959c50e667c76a1a4b6" url "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-#{version}-darwin-#{arch}.tar.gz" name "Google Cloud SDK" desc "Set of tools to manage resources and applications hosted on Google Cloud" homepage "https://cloud.google.com/sdk/" livecheck do url "https://cloud.google.com/sdk/docs/install-sdk" regex(/latest\s*gcloud\s*CLI\s*version\s*\(v?(\d+(?:\.\d+)+)\)/i) end auto_updates true depends_on formula: "python@3.12" google_cloud_sdk_root = "#{HOMEBREW_PREFIX}/share/google-cloud-sdk" installer script: { executable: "google-cloud-sdk/install.sh", args: [ "--quiet", "--usage-reporting", "false", "--bash-completion", "false", "--path-update", "false", "--rc-path", "false", "--install-python", "false" ], } binary "google-cloud-sdk/bin/bq" binary "google-cloud-sdk/bin/docker-credential-gcloud" binary "google-cloud-sdk/bin/gcloud" binary "google-cloud-sdk/bin/git-credential-gcloud.sh", target: "git-credential-gcloud" binary "google-cloud-sdk/bin/gsutil" bash_completion "google-cloud-sdk/completion.bash.inc", target: "google-cloud-sdk" zsh_completion "google-cloud-sdk/completion.zsh.inc", target: "_google_cloud_sdk" preflight do FileUtils.cp_r staged_path/"google-cloud-sdk/.", google_cloud_sdk_root, remove_destination: true FileUtils.rm_r(staged_path/"google-cloud-sdk") FileUtils.ln_s google_cloud_sdk_root, (staged_path/"google-cloud-sdk") end postflight do # HACK: Allow existing shell profiles to work by linking the current version to the `latest` directory. unless (latest_path = staged_path.dirname/"latest").directory? FileUtils.ln_s staged_path, latest_path, force: true end end uninstall trash: staged_path.dirname/"latest" zap trash: [ "#{google_cloud_sdk_root}.staging", google_cloud_sdk_root, ] end