38 lines
1.3 KiB
Ruby
38 lines
1.3 KiB
Ruby
class Jabba < Formula
|
|
desc "Cross-platform Java Version Manager"
|
|
homepage "https://github.com/shyiko/jabba"
|
|
url "https://github.com/shyiko/jabba/archive/0.11.0.tar.gz"
|
|
sha256 "1eee1ac5a8bf74918b95e933f91037bffa320c28da2013d876888fcf19bc94f8"
|
|
head "https://github.com/shyiko/jabba.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "86c773bc4a97e432bc6491087189918e5e1abde371e4339d2241f816ce833d55" => :mojave
|
|
sha256 "cfd5d350cac91a435cb70921b5ebb69dd8705b40a48b195becea6035a6e110ed" => :high_sierra
|
|
sha256 "8b5667589047a75e48b28b3d2721980294652e71bae47ccd5f4ec61ec62da8cb" => :sierra
|
|
end
|
|
|
|
depends_on "glide" => :build
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
ENV["GLIDE_HOME"] = HOMEBREW_CACHE/"glide_home/#{name}"
|
|
dir = buildpath/"src/github.com/shyiko/jabba"
|
|
dir.install buildpath.children
|
|
cd dir do
|
|
ldflags = "-X main.version=#{version}"
|
|
system "glide", "install"
|
|
system "go", "build", "-ldflags", ldflags, "-o", bin/"jabba"
|
|
prefix.install_metafiles
|
|
end
|
|
end
|
|
|
|
test do
|
|
ENV["JABBA_HOME"] = testpath/"jabba_home"
|
|
system bin/"jabba", "install", "1.11.0"
|
|
jdk_path = Utils.popen_read("#{bin}/jabba which 1.11.0").strip
|
|
assert_match 'java version "11.0',
|
|
shell_output("#{jdk_path}/Contents/Home/bin/java -version 2>&1")
|
|
end
|
|
end
|