-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathpowershell-lts.rb
More file actions
62 lines (50 loc) · 2.05 KB
/
powershell-lts.rb
File metadata and controls
62 lines (50 loc) · 2.05 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 PowershellLts < Formula
desc "Formula to install PowerShell Long Term Stable Channel"
homepage "https://github.com/powershell/powershell"
@arm64url = "https://github.com/PowerShell/PowerShell/releases/download/v7.4.11/powershell-7.4.11-osx-arm64.tar.gz"
@x64url = "https://github.com/PowerShell/PowerShell/releases/download/v7.4.11/powershell-7.4.11-osx-x64.tar.gz"
@arm64sha256 = "18F03E99BAA6B7BC7EC346AAA97CF7CA70782BBF746C9FF3D17CD45CF625DA04"
@x64sha256 = "53D00760D41B0A2B2E849C803C36E4C94707BA1808992AF96A2B0416D90F2BD5"
# 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.4.11"
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" => "pwsh-lts"
end
def caveats
<<~EOS
The executable should already be on PATH so run with `pwsh-lts`. If not, the full path to the executable is:
#{bin}/pwsh-lts
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 LTS your default shell, run
sudo echo '#{bin}/pwsh-lts' >> /etc/shells
chsh -s #{bin}/pwsh-lts
EOS
end
test do
assert_equal "7.4.11",
shell_output("#{bin}/pwsh-lts -c '$psversiontable.psversion.tostring()'").strip
end
end