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.06.0-ce", :revision => "0ffa8257ec673ed6849b73b03fb01b0cac90fdb3" bottle do cellar :any_skip_relocation sha256 "1a3991834c66511c6d8da9bbdcffe54d5d10de9df26792481e1761dd45ee4a88" => :high_sierra sha256 "145e5145e54495086c1d48e1cb6836aa27f0a4dbb411ee54e31cab7e44e56d36" => :sierra sha256 "2f2aa289dae63b32bed8e43d1d1f80757b49e0a54c41bbde34d44adf5e3c1f92" => :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" 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