51 lines
1.6 KiB
Ruby
51 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.2018-12-27T00-37-49Z",
|
|
:revision => "4e7eeb0725abcd36b54a37636ff89f29c3238fd8"
|
|
version "20181227003749"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "673760cf56b6a32bb5c5bd7968de6a1042488a159f6e8fd71ee6cf34b18d03ee" => :mojave
|
|
sha256 "15b001b666af143b9dc4dbb3b868ad8df5d035f167d138040a4e2d79475b6e4c" => :high_sierra
|
|
sha256 "339fc99df5171042fa5fb9e88ca1305b1df903e491b560dab7c8ea76cd40bfcb" => :sierra
|
|
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
|