-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappwrite.rb
More file actions
68 lines (56 loc) · 2.05 KB
/
appwrite.rb
File metadata and controls
68 lines (56 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
63
64
65
66
67
68
class Appwrite < Formula
desc "Command-line tool for interacting with the Appwrite API"
homepage "https://appwrite.io"
version "18.2.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 "14ea83b1fc962b7be91c7a6e8723f83369b5ce0e6b3f56f61093cd00381ac086"
else
url "https://github.com/appwrite/sdk-for-cli/releases/download/#{version}/appwrite-cli-darwin-x64"
sha256 "83703a86d2cb22966beb4afd0f88f11319ca81fbf64a91e9e0f8d6375d4506d4"
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 "d215cd4c1f0b70916436d7061797d407a7b0ce9830cfc29aa735b1405dafbd00"
else
url "https://github.com/appwrite/sdk-for-cli/releases/download/#{version}/appwrite-cli-linux-x64"
sha256 "38c127e173b5ea2e5b2f170979681156cd30060e39960cefb9a7abfda3353988"
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"
return
end
bin.install self.class.binary_name => "appwrite"
end
test do
assert_match "Usage:", shell_output("#{bin}/appwrite --help")
end
end