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.3", :revision => "a872fc2f86c042e6992e17db6cdd9826c9c4232b" bottle do cellar :any_skip_relocation sha256 "190fd3d6fa2c2b5738e99e6d54cf7e2eff0584b716f38e776b884958494f0f4c" => :catalina sha256 "83a356cccb0f194f91811560a44f2cdd87192d338f6d4efacb4aacc504283e78" => :mojave sha256 "65ce78e2ce696471ce206b41255ac6ec8647806f45497534b9023fd3ae72ead6" => :high_sierra end depends_on "go" => :build depends_on "go-md2man" => :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" Pathname.glob("man/*.[1-8].md") do |md| section = md.to_s[/\.(\d+)\.md\Z/, 1] (man/"man#{section}").mkpath system "go-md2man", "-in=#{md}", "-out=#{man/"man#{section}"/md.stem}" end 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