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.1", :revision => "74b1e89e8ac68948be88fe0aa1e2767ae28659fe" bottle do cellar :any_skip_relocation sha256 "ed32c0a9455ff5f193f6f6f8d1754a02534f6419f5d36af5c5c7adeb5a10f51d" => :mojave sha256 "bb3c3929bb7c1897442638ed57d0d8eb84b863b68d33122a5e6b39283e06453f" => :high_sierra sha256 "ceee85312a0a8fc94afa85060743486fa127893c8fd1f09f4edc65a2db526d55" => :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