homebrew-core/Formula/minio-mc.rb
2019-07-13 14:32:42 +02:00

50 lines
1.6 KiB
Ruby

class MinioMc < Formula
desc "Replacement for ls, cp and other commands for object storage"
homepage "https://github.com/minio/mc"
url "https://github.com/minio/mc.git",
:tag => "RELEASE.2019-07-11T19-31-28Z",
:revision => "31e5ac02bdbdbaf20a87683925041f406307cfb9"
version "20190711193128"
bottle do
cellar :any_skip_relocation
sha256 "b35fc1f816c3eb4ad3bbf0da09bbaccabe7f3b06cbd49ff9cae27314ee1314ec" => :mojave
sha256 "6018ce14434a0cb4863f6a39eefeb79e3bdd7d573aba6c0ff2d8a9f8e9d28feb" => :high_sierra
sha256 "08bc40ba7b2688830f1815b9d2da02e37f59b8111ba0b7e668849f4c579adcfe" => :sierra
end
depends_on "go" => :build
conflicts_with "midnight-commander", :because => "Both install a `mc` binary"
def install
ENV["GOPATH"] = buildpath
ENV["GO111MODULE"] = "on"
src = buildpath/"src/github.com/minio/mc"
src.install buildpath.children
src.cd do
if build.head?
system "go", "build", "-o", buildpath/"mc"
else
minio_release = `git tag --points-at HEAD`.chomp
minio_version = minio_release.gsub(/RELEASE\./, "").chomp.gsub(/T(\d+)\-(\d+)\-(\d+)Z/, 'T\1:\2:\3Z')
minio_commit = `git rev-parse HEAD`.chomp
proj = "github.com/minio/mc"
system "go", "build", "-o", buildpath/"mc", "-ldflags", <<~EOS
-X #{proj}/cmd.Version=#{minio_version}
-X #{proj}/cmd.ReleaseTag=#{minio_release}
-X #{proj}/cmd.CommitID=#{minio_commit}
EOS
end
end
bin.install buildpath/"mc"
prefix.install_metafiles
end
test do
system bin/"mc", "mb", testpath/"test"
assert_predicate testpath/"test", :exist?
end
end