-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathpowershell.rb
More file actions
62 lines (50 loc) · 1.98 KB
/
powershell.rb
File metadata and controls
62 lines (50 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# typed: false
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# frozen_string_literal: true
# Doc for the class.
# Class to implement Brew Formula to install PowerShell
class Powershell < Formula
desc "Formula to install PowerShell"
homepage "https://github.com/powershell/powershell"
@arm64url = "https://github.com/PowerShell/PowerShell/releases/download/v7.5.2/powershell-7.5.2-osx-arm64.tar.gz"
@x64url = "https://github.com/PowerShell/PowerShell/releases/download/v7.5.2/powershell-7.5.2-osx-x64.tar.gz"
@arm64sha256 = "A02D1D79589C71E8D35E458D90F085CFC1F0A688EBBEA4DAB8632187C057F7A1"
@x64sha256 = "905DC9EC0BB588993AACA9FFFE15DDBFFC764164B09CBDF63D5EA25E8362839C"
# We do not specify `version "..."` as 'brew audit' will complain - see https://github.com/Homebrew/legacy-homebrew/issues/32540
if Hardware::CPU.intel?
url @x64url
# must be lower-case
sha256 @x64sha256
else
url @arm64url
# must be lower-case
sha256 @arm64sha256
end
version "7.5.2"
version_scheme 1
# .NET Core 3.1 requires High Sierra - https://docs.microsoft.com/en-us/dotnet/core/install/dependencies?pivots=os-macos&tabs=netcore31
depends_on macos: :high_sierra
def install
libexec.install Dir["*"]
chmod 0555, libexec/"pwsh"
bin.install_symlink libexec/"pwsh"
end
def caveats
<<~EOS
The executable should already be on PATH so run with `pwsh`. If not, the full path to the executable is:
#{bin}/pwsh
Other application files were installed at :
#{libexec}
If you also have the Cask installed, you need to run the following to make the formula your default install:
brew link --overwrite powershell
If you would like to make PowerShell your default shell, run
sudo sh -c "echo '#{bin}/pwsh' >> /etc/shells"
chsh -s #{bin}/pwsh
EOS
end
test do
assert_equal "7.5.2",
shell_output("#{bin}/pwsh -c '$psversiontable.psversion.tostring()'").strip
end
end