-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrustfs.rb
More file actions
118 lines (99 loc) · 3.81 KB
/
rustfs.rb
File metadata and controls
118 lines (99 loc) · 3.81 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Copyright 2024 RustFS Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
class Rustfs < Formula
VERSION = "1.0.0-alpha.85".freeze
GITHUB_REPO = "rustfs/rustfs".freeze
BINARIES = {
"macos-aarch64" => "6a0d97e5abde54256285c133890e42c3cc600b66537bb6965b7270147412e82f",
"macos-x86_64" => "62626200861f14a35b47577f955afcce97c4400b4d17bf66391b71c0b1c43764",
"linux-aarch64-musl" => "38fb0bef9df78610119b456f7fdbc417f35a07a77ac194598415a2dff380fee8",
"linux-x86_64-musl" => "7354b44549d95bb11f564f65bc0df5f9dbb9edc97b6d009dd25306c3a26ab6c9",
}.freeze
desc "High-performance distributed object storage written in Rust"
homepage "https://rustfs.com"
url "https://github.com/#{GITHUB_REPO}/archive/refs/tags/#{VERSION}.tar.gz"
sha256 "75db11c3c970f4819a00a02813467d850a4bfaa16d71c03e0c7bd9186a423e83"
license "Apache-2.0"
def install
url, sha = binary_url_and_sha
odie "This formula has no pre-compiled binary for your platform: #{system_target}" unless url
ohai "Installing from pre-compiled binary..."
resource "binary" do
url url
sha256 sha
end
resource("binary").stage do
bin.install "rustfs"
end
end
def caveats
<<~EOS
Thank you for installing rustfs!
=== Quick Start ===
# View all available commands and help information:
rustfs --help
# Check the version:
rustfs --version
=== Developer Guide ===
If you want to build from source manually:
1. Clone the repository:
git clone https://github.com/#{GITHUB_REPO}.git
cd rustfs
2. Install dependencies:
brew install rust protobuf flatbuffers pkg-config zstd openssl@3
3. Compile the project:
cargo build --release
4. The binary will be located at:
./target/release/rustfs
=== Additional Notes ===
If you encounter issues with missing dependencies, ensure the following are installed:
- Rust: brew install rust
- Protobuf: brew install protobuf
- Flatbuffers: brew install flatbuffers
- OpenSSL: brew install openssl@3
- Zstd: brew install zstd
EOS
end
def test
version_output = shell_output("#{bin}/rustfs -V")
assert_match "rustfs #{VERSION}", version_output
end
private
def system_target
@system_target ||= begin
os = OS.mac? ? "macos" : "linux"
arch = case Hardware::CPU.arch
when :arm, :arm64, :aarch64 then "aarch64"
else "x86_64"
end
suffix = OS.mac? ? "" : "-musl"
"#{os}-#{arch}#{suffix}"
end
end
def binary_url_and_sha
target = system_target
sha256 = BINARIES[target]
return [nil, nil] unless sha256
url = "https://github.com/#{GITHUB_REPO}/releases/download/#{VERSION}/rustfs-#{target}-v#{VERSION}.zip"
[url, sha256]
end
# Note: Homebrew formulas must be reproducible and cannot hit the network
# to determine versions at install time. This livecheck tells `brew livecheck`
# to use GitHub releases to find new versions. We also provide a workflow in
# this tap to automatically bump this formula when a new release appears.
livecheck do
url :stable
strategy :github_latest
end
end