2016-06-09 18:55:09 +00:00
|
|
|
class Dvm < Formula
|
|
|
|
desc "Docker Version Manager"
|
2017-03-13 18:15:56 +00:00
|
|
|
homepage "https://github.com/howtowhale/dvm"
|
|
|
|
url "https://github.com/howtowhale/dvm/archive/0.8.2.tar.gz"
|
|
|
|
sha256 "b8297aaf07ea797429800a46fa76b2377edd6f6a0e67d61effee275df356575e"
|
2016-06-09 18:55:09 +00:00
|
|
|
|
2016-06-13 16:06:38 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2017-03-13 20:21:11 +00:00
|
|
|
sha256 "42e9d12aeb85afb0d50940941038c8121df70bd21b987a59632d6e65d3de6b12" => :sierra
|
|
|
|
sha256 "bcaca345cdfe48111490f78887928b70b6bf7fcd451eb6995c8ea98b07fd6ce4" => :el_capitan
|
|
|
|
sha256 "ce1b22e383fa7096561d08cef706094d485029cfbd84cf6663de97f5124b6168" => :yosemite
|
2016-06-13 16:06:38 +00:00
|
|
|
end
|
|
|
|
|
2016-10-04 14:37:54 +00:00
|
|
|
depends_on "glide" => :build
|
2016-06-09 18:55:09 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
|
|
|
def install
|
2017-02-17 18:07:42 +00:00
|
|
|
# `make` has to be deparallelized due to the following errors:
|
|
|
|
# glide install
|
|
|
|
# fatal: Not a git repository (or any of the parent directories): .git
|
|
|
|
# CGO_ENABLED=0 go build ...
|
|
|
|
# dvm-helper/dvm-helper.go:16:2: cannot find package "github.com/blang/semver"
|
|
|
|
# make: *** [local] Error 1
|
2017-03-13 18:15:56 +00:00
|
|
|
# Reported 17 Feb 2017: https://github.com/howtowhale/dvm/issues/151
|
2017-02-17 18:07:42 +00:00
|
|
|
ENV.deparallelize
|
|
|
|
|
2016-06-09 18:55:09 +00:00
|
|
|
ENV["GOPATH"] = buildpath
|
2016-10-04 14:37:54 +00:00
|
|
|
ENV["GLIDE_HOME"] = HOMEBREW_CACHE/"glide_home/#{name}"
|
2016-06-09 18:55:09 +00:00
|
|
|
|
2017-02-17 18:07:42 +00:00
|
|
|
# `depends_on "glide"` already has this covered
|
|
|
|
inreplace "Makefile", %r{^.*go get github.com/Masterminds/glide.*$\n}, ""
|
2016-06-09 18:55:09 +00:00
|
|
|
|
2017-03-13 18:15:56 +00:00
|
|
|
(buildpath/"src/github.com/howtowhale/dvm").install buildpath.children
|
2016-06-09 18:55:09 +00:00
|
|
|
|
2017-03-13 18:15:56 +00:00
|
|
|
cd "src/github.com/howtowhale/dvm" do
|
2016-10-04 14:37:54 +00:00
|
|
|
system "make", "VERSION=#{version}", "UPGRADE_DISABLED=true"
|
2016-06-09 18:55:09 +00:00
|
|
|
prefix.install "dvm.sh"
|
2016-12-08 02:51:48 +00:00
|
|
|
bash_completion.install "bash_completion" => "dvm"
|
2016-06-09 18:55:09 +00:00
|
|
|
(prefix/"dvm-helper").install "dvm-helper/dvm-helper"
|
2016-10-04 14:37:54 +00:00
|
|
|
prefix.install_metafiles
|
2016-06-09 18:55:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
dvm is a shell function, and must be sourced before it can be used.
|
|
|
|
Add the following command to your bash profile:
|
2016-12-08 02:51:48 +00:00
|
|
|
[ -f #{opt_prefix}/dvm.sh ] && . #{opt_prefix}/dvm.sh
|
2016-06-09 18:55:09 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
output = shell_output("bash -c 'source #{prefix}/dvm.sh && dvm --version'")
|
|
|
|
assert_match "Docker Version Manager version #{version}", output
|
|
|
|
end
|
|
|
|
end
|