96 lines
3.1 KiB
Ruby
96 lines
3.1 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-02-19T04-38-02Z",
|
|
revision: "2dce5d94428117367260fb8b5a94e4deb3e8fd65"
|
|
version "20210219043802"
|
|
license "Apache-2.0"
|
|
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: "085373115ef296dd660a21b2e69fada51429cf1fa063ef6a61aae7fc02dc50b6"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "fe922be599e2b3cad179fbab8f7146f99e544392a460280cbc217d744d3fc5e3"
|
|
sha256 cellar: :any_skip_relocation, catalina: "7ff5321be88baca5eb40a0976b9bc7c0d8e64ff51dbb1c02e6f8235f190ece61"
|
|
sha256 cellar: :any_skip_relocation, mojave: "6e86f416959bd778869df8437d2f86ffbdcaee019975d798c2db593eda2fdbc3"
|
|
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')
|
|
proj = "github.com/minio/minio"
|
|
|
|
system "go", "build", *std_go_args, "-ldflags", <<~EOS
|
|
-X #{proj}/cmd.Version=#{version}
|
|
-X #{proj}/cmd.ReleaseTag=#{release}
|
|
-X #{proj}/cmd.CommitID=#{Utils.git_head}
|
|
EOS
|
|
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
|