-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappwrite.rb
More file actions
72 lines (59 loc) · 2.22 KB
/
Copy pathappwrite.rb
File metadata and controls
72 lines (59 loc) · 2.22 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
63
64
65
66
67
68
69
70
71
72
class Appwrite < Formula
desc "Command-line tool for interacting with the Appwrite API"
homepage "https://appwrite.io"
version "22.4.0"
license "BSD-3-Clause"
def self.binary_arch
Hardware::CPU.arm? ? "arm64" : "x64"
end
def self.binary_os
return "darwin" if OS.mac?
return "linux" if OS.linux?
raise "Homebrew formula is only supported on macOS and Linux"
end
def self.binary_name
"appwrite-cli-#{binary_os}-#{binary_arch}"
end
def self.build_target
return "mac-#{binary_arch}" if OS.mac?
return "linux-#{binary_arch}" if OS.linux?
raise "Homebrew formula is only supported on macOS and Linux"
end
head "https://github.com/appwrite/sdk-for-cli.git", branch: "master" do
depends_on "bun" => :build
end
# Release automation injects per-target SHA256 values when publishing binaries.
on_macos do
if Hardware::CPU.arm?
url "https://github.com/appwrite/sdk-for-cli/releases/download/#{version}/appwrite-cli-darwin-arm64"
sha256 "d4c174ccf03a236cc1037bef01bf2a2de23b972753b08d92ae1aad821011c175"
else
url "https://github.com/appwrite/sdk-for-cli/releases/download/#{version}/appwrite-cli-darwin-x64"
sha256 "73fce1e56eb6d2c0b58958ffb379f352ca3930eb736a1028cfa474a931899a49"
end
end
on_linux do
if Hardware::CPU.arm?
url "https://github.com/appwrite/sdk-for-cli/releases/download/#{version}/appwrite-cli-linux-arm64"
sha256 "3a7baa7375295022168fc0d428d09a6e1096837c42aa2ea048d7d1fc29714e98"
else
url "https://github.com/appwrite/sdk-for-cli/releases/download/#{version}/appwrite-cli-linux-x64"
sha256 "cf02692f7606cb8b07178206c90b3ff658acc09468f1030d851362e779f95d17"
end
end
def install
if build.head?
system "bun", "install", "--frozen-lockfile"
system "bun", "run", self.class.build_target
bin.install "build/#{self.class.binary_name}" => "appwrite"
else
bin.install self.class.binary_name => "appwrite"
end
(bin/"appwrite").chmod 0755
generate_completions_from_executable(bin/"appwrite", "completion")
end
test do
assert_match "Usage:", shell_output("#{bin}/appwrite --help")
assert_match "compdef", shell_output("#{bin}/appwrite completion zsh")
end
end