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" revision 1 bottle do cellar :any_skip_relocation sha256 "9929fef6a7c05bbe665fe77fda405cc3e2cd3a2bb519552a7852327248e1feb3" => :catalina sha256 "371c5f58946a49b67dba0adf84f25b85ed8ce7c7495c89ab9c41f5c2eb3dd05b" => :mojave sha256 "76ff98e6db1e334d10afb01eefd090fe0e81c125e734b7d89994289a68792ec4" => :high_sierra sha256 "ec6a2a7a21cdb3a9191c226e6f7f9279863e91b394bd3871a9ddeab88fc8235d" => :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