phinze/homebrew-cask

View on GitHub
Casks/p/powershell@preview.rb

Summary

Maintainability
A
0 mins
Test Coverage
cask "powershell@preview" do
  arch arm: "arm64", intel: "x64"

  version "7.5.0-preview.4"
  sha256 arm:   "294510dab4e3f1f62c56c6dd2c2ce459e3077064484d461bb10613fef35c9595",
         intel: "b897c201f41e63430f40ea87a830eacda9ff5f46a694d322dd0773042f604f6d"

  url "https://github.com/PowerShell/PowerShell/releases/download/v#{version}/powershell-#{version}-osx-#{arch}.pkg"
  name "PowerShell"
  desc "Command-line shell and scripting language"
  homepage "https://github.com/PowerShell/PowerShell"

  livecheck do
    url :url
    regex(/^v?(\d+(?:\.\d+)+[_-](?:preview|rc)(?:\.\d+)?)$/i)
  end

  depends_on formula: "openssl"
  depends_on macos: ">= :mojave"

  pkg "powershell-#{version}-osx-#{arch}.pkg"

  uninstall pkgutil: "com.microsoft.powershell-preview"

  zap trash: [
        "~/.cache/powershell",
        "~/.config/PowerShell",
        "~/.local/share/powershell",
      ],
      rmdir: [
        "~/.cache",
        "~/.config",
        "~/.local",
        "~/.local/share",
      ]

  caveats <<~EOS
    To use Homebrew in PowerShell, set:
      Add-Content -Path $PROFILE.CurrentUserAllHosts -Value '$(#{HOMEBREW_PREFIX}/bin/brew shellenv) | Invoke-Expression'
  EOS
end