-
Notifications
You must be signed in to change notification settings - Fork 21
/
func.rb
43 lines (38 loc) · 1.48 KB
/
func.rb
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
# Generated through hack/update-codegen.sh. Don't edit manually.
# Next line is used to identify version of the file.
# func_version:1.16.0
require "fileutils"
class Func < Formula
homepage "https://github.com/knative/func"
v = "knative-v1.16.0"
version v
if OS.mac? && Hardware::CPU.intel?
url "https://github.com/knative/func/releases/download/#{v}/func_darwin_amd64"
sha256 "462c08adaebc3f81a25ae7c8c3224fb57732c67c0a1bc0e620ff01a9cf2dc5c8"
elsif OS.mac? && Hardware::CPU.arm?
url "https://github.com/knative/func/releases/download/#{v}/func_darwin_arm64"
sha256 "35165b428d9ff22a895d3ddb63970f501acc5a4285cbb023477a4df201dbd504"
elsif OS.linux? && Hardware::CPU.arm?
url "https://github.com/knative/func/releases/download/#{v}/func_linux_arm64"
sha256 "fe21c864970caf61948bd92d5ab81ef130782e4bd09f38187aa94b6232d2b043"
else
url "https://github.com/knative/func/releases/download/#{v}/func_linux_amd64"
sha256 "b30950f4bbe5933236347aaf77848e3a7a9bfb8ed1d5294ee65b38baeed2ee22"
end
def install
if OS.mac? && Hardware::CPU.intel?
FileUtils.mv("func_darwin_amd64", "kn-func")
elsif OS.mac? && Hardware::CPU.arm?
FileUtils.mv("func_darwin_arm64", "kn-func")
elsif OS.linux? && Hardware::CPU.arm?
FileUtils.mv("func_linux_arm64", "kn-func")
else
FileUtils.mv("func_linux_amd64", "kn-func")
end
bin.install "kn-func"
ln_s "kn-func", bin/"func"
end
test do
system "#{bin}/kn-func", "version"
end
end