homebrew-core/Formula/docker.rb
2017-08-22 12:08:43 -07:00

48 lines
1.7 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 => "v17.06.1-ce",
:revision => "874a7374f31c77aca693d025101b2de1b20b96c2"
bottle do
cellar :any_skip_relocation
sha256 "24b01e4c1a89aa7518a7a4a304a6b0a890cda82c9c136b78fa85d823fea57974" => :sierra
sha256 "e73f8baedf64a89d83e4a0ce26ddc464e29cc5967488f0d5f83072f84de85e78" => :el_capitan
sha256 "19ddddd87cc54e4b5d8190439d867589014a1e52dc65d3b6f48f200d2ffcf2ee" => :yosemite
end
option "with-experimental", "Enable experimental features"
option "without-completions", "Disable bash/zsh completions"
depends_on "go" => :build
if build.with? "experimental"
depends_on "libtool" => :run
depends_on "yubico-piv-tool" => :recommended
end
def install
ENV["DOCKER_EXPERIMENTAL"] = "1" if build.with? "experimental"
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
ldflags = ["-X github.com/docker/cli/cli.GitCommit=#{commit}",
"-X github.com/docker/cli/cli.Version=#{version}-ce"]
system "go", "build", "-o", bin/"docker", "-ldflags", ldflags.join(" "),
"github.com/docker/cli/cmd/docker"
if build.with? "completions"
bash_completion.install "contrib/completion/bash/docker"
fish_completion.install "contrib/completion/fish/docker.fish"
zsh_completion.install "contrib/completion/zsh/_docker"
end
end
end
test do
system "#{bin}/docker", "--version"
end
end