-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathfunc.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.17.0
require "fileutils"
class Func < Formula
homepage "/~https://github.com/knative/func"
v = "knative-v1.17.0"
version v
if OS.mac? && Hardware::CPU.intel?
url "/~https://github.com/knative/func/releases/download/#{v}/func_darwin_amd64"
sha256 "37bbea24c0df94566b1100d9be8749417b0bf056445abe38ad73139bc8ca9dc1"
elsif OS.mac? && Hardware::CPU.arm?
url "/~https://github.com/knative/func/releases/download/#{v}/func_darwin_arm64"
sha256 "7d13a65c33e60239b5b429666ff41604fe6e6ddeaa005c75b9db84e6dabfc476"
elsif OS.linux? && Hardware::CPU.arm?
url "/~https://github.com/knative/func/releases/download/#{v}/func_linux_arm64"
sha256 "b30e3e31c14cfde553d3209c48f5434842a382374ecbf14d6bb90c686460c45b"
else
url "/~https://github.com/knative/func/releases/download/#{v}/func_linux_amd64"
sha256 "4f0682edc5bab7bed89fb83145ab66fd2c39f420e621442aee87b21b4647a9d9"
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