@@ -6,44 +6,31 @@ class Anyenv < Formula
66 license "MIT"
77
88 bottle do
9- sha256 cellar : :any_skip_relocation , arm64_sequoia : "f0c5c9923085a2a772fa142aa3d1ddb3e02015553306c6f3ce7747a9bc4d9e64"
10- sha256 cellar : :any_skip_relocation , arm64_sonoma : "e462542223d5607086423b094fc86298425826c8f82c8d9566e9e1598ec3017d"
11- sha256 cellar : :any_skip_relocation , arm64_ventura : "6fcafa1cbde4f24bb3e88597312c279ad4ad34e5ab80b51a2e1e96afb8b97157"
12- sha256 cellar : :any_skip_relocation , arm64_monterey : "6fcafa1cbde4f24bb3e88597312c279ad4ad34e5ab80b51a2e1e96afb8b97157"
13- sha256 cellar : :any_skip_relocation , arm64_big_sur : "6fcafa1cbde4f24bb3e88597312c279ad4ad34e5ab80b51a2e1e96afb8b97157"
14- sha256 cellar : :any_skip_relocation , sonoma : "73879c37bbfdac38f5f3057182da253d44732fa54c77cb483c8a2cbae9897bdd"
15- sha256 cellar : :any_skip_relocation , ventura : "e7a9bd58702840c6aee47e42ff2691681721a494a47cceac00cf10e1b1748879"
16- sha256 cellar : :any_skip_relocation , monterey : "e7a9bd58702840c6aee47e42ff2691681721a494a47cceac00cf10e1b1748879"
17- sha256 cellar : :any_skip_relocation , big_sur : "e7a9bd58702840c6aee47e42ff2691681721a494a47cceac00cf10e1b1748879"
18- sha256 cellar : :any_skip_relocation , catalina : "e7a9bd58702840c6aee47e42ff2691681721a494a47cceac00cf10e1b1748879"
19- sha256 cellar : :any_skip_relocation , x86_64_linux : "6fcafa1cbde4f24bb3e88597312c279ad4ad34e5ab80b51a2e1e96afb8b97157"
9+ rebuild 1
10+ sha256 cellar : :any_skip_relocation , all : "be1c3998ca482ca2cf3377f5db6690f1c74877e5cdfc4266d62c5cc1627caacd"
2011 end
2112
2213 def install
14+ inreplace "libexec/anyenv" , "/usr/local" , HOMEBREW_PREFIX
2315 prefix . install %w[ bin completions libexec ]
2416 end
2517
2618 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
19+ anyenv_root = testpath /"anyenv"
20+ profile = testpath /".profile"
21+ profile . write <<~SHELL
22+ export ANYENV_ROOT=#{ anyenv_root }
23+ export ANYENV_DEFINITION_ROOT=#{ testpath } /anyenv-install
24+ eval "$(#{ bin } /anyenv init -)"
25+ SHELL
3726
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
27+ anyenv_install = ". #{ profile } && #{ bin } /anyenv install"
28+ assert_match "Completed!" , shell_output ( "#{ anyenv_install } --force-init" )
29+ assert_match ( /^\s *rbenv$/ , shell_output ( "#{ anyenv_install } --list" ) )
30+ assert_match "succeeded!" , shell_output ( "#{ anyenv_install } rbenv" )
31+
32+ anyenv_rbenv_path = "#{ anyenv_root } /envs/rbenv/bin/rbenv"
33+ assert_equal anyenv_rbenv_path , shell_output ( ". #{ profile } && which rbenv" ) . chomp
34+ assert_match ( /^\d +\. \d +\. \d +$/ , shell_output ( ". #{ profile } && rbenv install --list" ) )
4835 end
4936end
0 commit comments