homebrew-core/Formula/docker.rb
2019-02-11 10:55:19 -08:00

40 lines
1.6 KiB
Ruby

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.09.2",
:revision => "62479626f213818ba5b4565105a05277308587d5"
bottle do
cellar :any_skip_relocation
sha256 "94426a9ce238bafecbfbe02ae00772653f42dc56cef73a0d7b65f74e4b8ee7c0" => :mojave
sha256 "4748b7fcbfa8901b2a91ff88b8728b916fa27dce632e59c66b99a7e8d5eb7342" => :high_sierra
sha256 "4ee05a793c58311dcf02cd20d049eb77dd47650f6638ecb58229707a4ac9b08b" => :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.BuildTime=#{build_time}\"",
"-X github.com/docker/cli/cli.GitCommit=#{commit}",
"-X github.com/docker/cli/cli.Version=#{version}",
"-X \"github.com/docker/cli/cli.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
system "#{bin}/docker", "--version"
end
end