99 lines
3.3 KiB
Ruby
99 lines
3.3 KiB
Ruby
class Minio < Formula
|
|
desc "High Performance, Kubernetes Native Object Storage"
|
|
homepage "https://min.io"
|
|
url "https://github.com/minio/minio.git",
|
|
tag: "RELEASE.2021-08-05T22-01-19Z",
|
|
revision: "6c0757eea6ec3ca4b6f4635834b967ddbf98af9e"
|
|
version "20210805220119"
|
|
license "AGPL-3.0-or-later"
|
|
head "https://github.com/minio/minio.git"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(%r{href=.*?/tag/(?:RELEASE[._-]?)?([\d\-TZ]+)["' >]}i)
|
|
strategy :github_latest do |page, regex|
|
|
page.scan(regex).map { |match| match&.first&.gsub(/\D/, "") }
|
|
end
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "2d461182fec03589d77680b78120b8ffc910ca237d88f6f0dabcb2eabc2ba90d"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "273ed5cd52600323e06fb0a5f625e413c03885fa554ad59d2d987e58f1175680"
|
|
sha256 cellar: :any_skip_relocation, catalina: "2fbd331e91cd49187fd7a8d3301ec5bba8e15c9ca02111894abcc382537286f8"
|
|
sha256 cellar: :any_skip_relocation, mojave: "5eaa35bbb31dc5d48b3e4180c6cd7da043355f85316f53aadebce75e42fb2918"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "eee0875866a3197a3ecde85376610edf0a6d961a6cc5ef7d294d5721584e7d26"
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
if build.head?
|
|
system "go", "build", *std_go_args
|
|
else
|
|
release = `git tag --points-at HEAD`.chomp
|
|
version = release.gsub(/RELEASE\./, "").chomp.gsub(/T(\d+)-(\d+)-(\d+)Z/, 'T\1:\2:\3Z')
|
|
|
|
ldflags = %W[
|
|
-s -w
|
|
-X github.com/minio/minio/cmd.Version=#{version}
|
|
-X github.com/minio/minio/cmd.ReleaseTag=#{release}
|
|
-X github.com/minio/minio/cmd.CommitID=#{Utils.git_head}
|
|
]
|
|
|
|
system "go", "build", *std_go_args(ldflags: ldflags.join(" "))
|
|
end
|
|
end
|
|
|
|
def post_install
|
|
(var/"minio").mkpath
|
|
(etc/"minio").mkpath
|
|
end
|
|
|
|
plist_options manual: "minio server"
|
|
|
|
def plist
|
|
<<~EOS
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>KeepAlive</key>
|
|
<true/>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/minio</string>
|
|
<string>server</string>
|
|
<string>--config-dir=#{etc}/minio</string>
|
|
<string>--address=:9000</string>
|
|
<string>#{var}/minio</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>KeepAlive</key>
|
|
<true/>
|
|
<key>WorkingDirectory</key>
|
|
<string>#{HOMEBREW_PREFIX}</string>
|
|
<key>StandardErrorPath</key>
|
|
<string>#{var}/log/minio.log</string>
|
|
<key>StandardOutPath</key>
|
|
<string>#{var}/log/minio.log</string>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
assert_match "minio server - start object storage server",
|
|
shell_output("#{bin}/minio server --help 2>&1")
|
|
|
|
assert_match "minio gateway - start object storage gateway",
|
|
shell_output("#{bin}/minio gateway 2>&1")
|
|
assert_match "ERROR Unable to validate credentials",
|
|
shell_output("#{bin}/minio gateway s3 2>&1", 1)
|
|
end
|
|
end
|