-
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.16.1
require "fileutils"
class Func < Formula
homepage "https://github.com/knative/func"
v = "knative-v1.16.1"
version v
if OS.mac? && Hardware::CPU.intel?
url "https://github.com/knative/func/releases/download/#{v}/func_darwin_amd64"
sha256 "536eb790640fe192c158b90d6e3421f60a5e56a46fbbb20756748054a515143b"
elsif OS.mac? && Hardware::CPU.arm?
url "https://github.com/knative/func/releases/download/#{v}/func_darwin_arm64"
sha256 "1742fdc293ec429dc4af04d9c1e9092682a420d726d6632a00ffcf94b9b8af84"
elsif OS.linux? && Hardware::CPU.arm?
url "https://github.com/knative/func/releases/download/#{v}/func_linux_arm64"
sha256 "5a514751a630d6322dc0ec57b1f367567137bd1a5bd3e224cdb7a30584eaa10c"
else
url "https://github.com/knative/func/releases/download/#{v}/func_linux_amd64"
sha256 "685e67f85c33807ac55be67c36b7c6bfc8b797aa1c4fc4d7793450360e72ed92"
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