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.02.0-ce", :revision => "fc4de447b563498eb4da89f56fb858bbe761d91b" bottle do cellar :any_skip_relocation sha256 "bffb3b5e1cc8293fdfe22346eadc0f4550aa0b80f3112a328906a663d47467cd" => :high_sierra sha256 "f6714ac9b9031397332e9a45559e6a4161fe00d906324415f5e4b77fdb825533" => :sierra sha256 "1bf8f7d1293155560ee2861f2580eef8bc861a20d4e112f88cb8ec489706a1dc" => :el_capitan end option "with-experimental", "Enable experimental features" option "without-completions", "Disable bash/zsh completions" depends_on "go" => :build if build.with? "experimental" depends_on "libtool" => :run depends_on "yubico-piv-tool" => :recommended end def install ENV["DOCKER_EXPERIMENTAL"] = "1" if build.with? "experimental" 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 ldflags = ["-X github.com/docker/cli/cli.GitCommit=#{commit}", "-X github.com/docker/cli/cli.Version=#{version}-ce"] system "go", "build", "-o", bin/"docker", "-ldflags", ldflags.join(" "), "github.com/docker/cli/cmd/docker" if build.with? "completions" bash_completion.install "contrib/completion/bash/docker" fish_completion.install "contrib/completion/fish/docker.fish" zsh_completion.install "contrib/completion/zsh/_docker" end end end test do system "#{bin}/docker", "--version" end end