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-02-09T23-07-36Z", :revision => "3987f1405aa7a0faaff019cc3b55da4ded9ebbe5" version "20180209230736" bottle do cellar :any_skip_relocation sha256 "0b64fe23aeba096e83e205d42380161223bb11cab73b62cd16eda4f40177df9c" => :high_sierra sha256 "dd2d1b50d1790bf537269d364526062715652b10b07164433deaf425a4ae908e" => :sierra sha256 "afe2f636e9c1b7b1f2c7c25cc07032edcde2f68c3c5d57887a6830e48fd58117" => :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