homebrew-core/Formula/minio-mc.rb
2018-01-19 04:48:45 -08:00

51 lines
1.6 KiB
Ruby

class MinioMc < Formula
desc "ls, cp, mkdir, diff and rsync for filesystems and object storage"
homepage "https://github.com/minio/mc"
url "https://github.com/minio/mc.git",
:tag => "RELEASE.2018-01-18T21-18-56Z",
:revision => "d9663e5d96d5f32725867167de2a0403704ae537"
version "20180118211856"
bottle do
cellar :any_skip_relocation
sha256 "139a46ea450c92a41b7f97300f50cc1cd65b7854e5ab7b597bab91e59703cee4" => :high_sierra
sha256 "a216b0967cd445e3483d0200dedf7d32f573359ccf00d57d9866725e4915ed4d" => :sierra
sha256 "b8a941b270a7f19592046e8e56fb83626d7d68471375dc5438ba0b08b1f08927" => :el_capitan
end
depends_on "go" => :build
conflicts_with "midnight-commander", :because => "Both install a `mc` binary"
def install
ENV["GOPATH"] = buildpath
clipath = buildpath/"src/github.com/minio/mc"
clipath.install Dir["*"]
cd clipath 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