homebrew-core/Formula/sbtenv.rb

35 lines
1.0 KiB
Ruby

class Sbtenv < Formula
desc "Command-line tool for managing sbt environments"
homepage "https://github.com/mazgi/sbtenv"
url "https://github.com/mazgi/sbtenv/archive/version/0.0.12.tar.gz"
sha256 "12b0fe7d66717ccd849ae51cb05a3b12e0080b6c1f9f5b7455a732fa2e5e28a9"
head "https://github.com/mazgi/sbtenv.git"
bottle :unneeded
def install
inreplace "libexec/sbtenv", "/usr/local", HOMEBREW_PREFIX
prefix.install "bin", "completions", "libexec"
prefix.install "plugins" => "default-plugins"
%w[sbtenv-install].each do |cmd|
bin.install_symlink "#{prefix}/default-plugins/sbt-install/bin/#{cmd}"
end
end
def post_install
var_lib = HOMEBREW_PREFIX/"var/lib/sbtenv"
%w[plugins versions].each do |dir|
var_dir = "#{var_lib}/#{dir}"
mkdir_p var_dir
ln_sf var_dir, "#{prefix}/#{dir}"
end
(var_lib/"plugins").install_symlink "#{prefix}/default-plugins/sbt-install"
end
test do
shell_output("eval \"$(#{bin}/sbtenv init -)\" && sbtenv versions")
end
end