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-01-30T19-57-22Z", :revision => "75a36b4831c35ebf7cb15ca9e617f057c7729b6f" version "20190130195722" bottle do cellar :any_skip_relocation sha256 "334c096317f9b18e8291a6635faf9c0651e0228c547aefd887702b4c99d7f91e" => :mojave sha256 "a41098f22187d1325367d0da600b93c1a05cd633f527dac58f1013ac0212712d" => :high_sierra sha256 "98c31f9c0a15c12c5adc5601230bd59cb6bb576affdf087eb86ba864e521965c" => :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