50 lines
1.6 KiB
Ruby
50 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.2016-12-05T22-51-51Z",
|
|
:revision => "b8e732e52694e1a5ceb862485cd05ee451c31db6"
|
|
version "20161205225151"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "8c005bbfb74c0a65c28b9e0a1afe62ebb0fd57a44475edd99fb251fe6214e68d" => :sierra
|
|
sha256 "dde58e74d4965f1a037b5332350f5d4ee9adf430e74e32deecb7776f0d1cacd6" => :el_capitan
|
|
sha256 "46cae1f58393259f6b4a32b72efc21cb113fa4b140612b83435acc4d30ba8c59" => :yosemite
|
|
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.undent
|
|
-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"
|
|
end
|
|
|
|
test do
|
|
system bin/"mc", "mb", testpath/"test"
|
|
assert File.exist?(testpath/"test")
|
|
end
|
|
end
|