Skip to content

Commit 1082612

Browse files
committed
anyenv: build all bottle, update test
1 parent f663170 commit 1082612

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

Formula/a/anyenv.rb

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,26 @@ class Anyenv < Formula
2020
end
2121

2222
def install
23+
inreplace "libexec/anyenv", "/usr/local", HOMEBREW_PREFIX
2324
prefix.install %w[bin completions libexec]
2425
end
2526

2627
test do
27-
Dir.mktmpdir do |dir|
28-
profile = "#{dir}/.profile"
29-
File.open(profile, "w") do |f|
30-
content = <<~SHELL
31-
export ANYENV_ROOT=#{dir}/anyenv
32-
export ANYENV_DEFINITION_ROOT=#{dir}/anyenv-install
33-
eval "$(anyenv init -)"
34-
SHELL
35-
f.write(content)
36-
end
28+
anyenv_root = testpath/"anyenv"
29+
profile = testpath/".profile"
30+
profile.write <<~SHELL
31+
export ANYENV_ROOT=#{anyenv_root}
32+
export ANYENV_DEFINITION_ROOT=#{testpath}/anyenv-install
33+
eval "$(#{bin}/anyenv init -)"
34+
SHELL
3735

38-
cmds = <<~SHELL
39-
anyenv install --force-init
40-
anyenv install --list
41-
anyenv install rbenv
42-
rbenv install --list
43-
SHELL
44-
cmds.split("\n").each do |cmd|
45-
shell_output(". #{profile} && #{cmd}")
46-
end
47-
end
36+
anyenv_install = ". #{profile} && #{bin}/anyenv install"
37+
assert_match "Completed!", shell_output("#{anyenv_install} --force-init")
38+
assert_match(/^\s*rbenv$/, shell_output("#{anyenv_install} --list"))
39+
assert_match "succeeded!", shell_output("#{anyenv_install} rbenv")
40+
41+
anyenv_rbenv_path = "#{anyenv_root}/envs/rbenv/bin/rbenv"
42+
assert_equal anyenv_rbenv_path, shell_output(". #{profile} && which rbenv").chomp
43+
assert_match(/^\d+\.\d+\.\d+$/, shell_output(". #{profile} && rbenv install --list"))
4844
end
4945
end

0 commit comments

Comments
 (0)