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-10-09T22-54-57Z", :revision => "f93fe1330a3647b1afaff0ed8c188d2897bf391e" version "20191009225457" bottle do cellar :any_skip_relocation rebuild 1 sha256 "141426787ed74684d6d5e69eeebf0dd889dc7462385d74018e73973df73d205e" => :mojave sha256 "e0042ebd5089f3385e12ad175292419d9ff797ef7b62b8c9101532e0faf807e1" => :high_sierra end depends_on "go" => :build conflicts_with "midnight-commander", :because => "Both install a `mc` binary" def install if build.head? system "go", "build", "-trimpath", "-o", bin/"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", "-trimpath", "-o", bin/"mc", "-ldflags", <<~EOS -X #{proj}/cmd.Version=#{minio_version} -X #{proj}/cmd.ReleaseTag=#{minio_release} -X #{proj}/cmd.CommitID=#{minio_commit} EOS end prefix.install_metafiles end test do system bin/"mc", "mb", testpath/"test" assert_predicate testpath/"test", :exist? end end