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 => "v19.03.2", :revision => "6a30dfca03664a0b6bf0646a7d389ee7d0318e6e" bottle do cellar :any_skip_relocation sha256 "dbdb1baac89c7d805a9e2b16f953e4061532d47ca799c92c56ab8ea875243223" => :mojave sha256 "ced62153aa5eb2286bf549714c1d1d566073d2be263cc57215fb8c612b50c3ad" => :high_sierra sha256 "2515073942282f7ce158e415925d68ca39dbded266ca21cff9333ad3ea83ed1b" => :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/version.BuildTime=#{build_time}\"", "-X github.com/docker/cli/cli/version.GitCommit=#{commit}", "-X github.com/docker/cli/cli/version.Version=#{version}", "-X \"github.com/docker/cli/cli/version.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 assert_match "Docker version #{version}", shell_output("#{bin}/docker --version") assert_match "ERROR: Cannot connect to the Docker daemon", shell_output("#{bin}/docker info", 1) end end