class Docker < Formula desc "Pack, ship and run any application as a lightweight container" homepage "https://www.docker.com/" url "https://github.com/docker/docker-ce.git", :tag => "v18.09.5", :revision => "e8ff056dbcfadaeca12a5f508b0cec281126c01d" bottle do cellar :any_skip_relocation sha256 "26c2fedc3f61d75d16a1e411ec9594641755083c83917a798d8245bde14c149e" => :mojave sha256 "028f8f8f433fbe0bfff8275fdf9265692085fc83e1e9e1225280ccabaad70201" => :high_sierra sha256 "e9d59c1f1e54e388ac130818e9050cf1dc7e70849925f68b218d8a9fc3566aaa" => :sierra end depends_on "go" => :build def install ENV["GOPATH"] = buildpath dir = buildpath/"src/github.com/docker/cli" dir.install (buildpath/"components/cli").children cd dir do commit = Utils.popen_read("git rev-parse --short HEAD").chomp build_time = Utils.popen_read("date -u +'%Y-%m-%dT%H:%M:%SZ' 2> /dev/null").chomp ldflags = ["-X \"github.com/docker/cli/cli.BuildTime=#{build_time}\"", "-X github.com/docker/cli/cli.GitCommit=#{commit}", "-X github.com/docker/cli/cli.Version=#{version}", "-X \"github.com/docker/cli/cli.PlatformName=Docker Engine - Community\""] system "go", "build", "-o", bin/"docker", "-ldflags", ldflags.join(" "), "github.com/docker/cli/cmd/docker" bash_completion.install "contrib/completion/bash/docker" fish_completion.install "contrib/completion/fish/docker.fish" zsh_completion.install "contrib/completion/zsh/_docker" end end test do system "#{bin}/docker", "--version" end end