anyenv 1.0.1 (new formula)

Add anyenv

Closes #36257.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
Ryosuke IWANAGA 2019-01-19 23:02:11 -08:00 committed by FX Coudert
parent 73e71bd13f
commit 22ddde768d

34
Formula/anyenv.rb Normal file
View file

@ -0,0 +1,34 @@
class Anyenv < Formula
desc "All in one for **env"
homepage "https://anyenv.github.io/"
url "https://github.com/anyenv/anyenv/archive/v1.0.1.tar.gz"
sha256 "5d42ac8748db41b8ec0cb3ad986bb10084e55df0153366403ea458e7a958a1a7"
def install
prefix.install %w[bin completions libexec]
end
test do
Dir.mktmpdir do |dir|
profile = "#{dir}/.profile"
File.open(profile, "w") do |f|
content = <<~EOS
export ANYENV_ROOT=#{dir}/anyenv
export ANYENV_DEFINITION_ROOT=#{dir}/anyenv-install
eval "$(anyenv init -)"
EOS
f.write(content)
end
cmds = <<~EOS
anyenv install --force-init
anyenv install --list
anyenv install rbenv
rbenv install --list
EOS
cmds.split("\n").each do |cmd|
shell_output("source #{profile} && #{cmd}")
end
end
end
end