From 5014a0e01d2c123a27730c6178a2684577097e29 Mon Sep 17 00:00:00 2001 From: Seivan Date: Mon, 15 Mar 2021 05:34:57 +0100 Subject: [PATCH 01/19] Update asdf.rb Install a libexec under bin to maintain relative paths for sourcing scripts. This will target `bin/asdf` that will source other shell scripts, like `source "$(dirname "$(dirname "$0")")/lib/utils.bash"` Probably need approval and eyes from maintainer(s) Fix: https://github.com/asdf-vm/asdf/issues/891 --- Formula/asdf.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 7543ed1a5d5b8..5146f3c211ba9 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -4,7 +4,7 @@ class Asdf < Formula url "https://github.com/asdf-vm/asdf/archive/v0.8.0.tar.gz" sha256 "9b667ca135c194f38d823c62cc0dc3dbe00d7a9f60caa0c06ecb3047944eadfa" license "MIT" - revision 1 + revision 2 head "https://github.com/asdf-vm/asdf.git" bottle :unneeded @@ -25,8 +25,8 @@ def install bash_completion.install "completions/asdf.bash" fish_completion.install "completions/asdf.fish" zsh_completion.install "completions/_asdf" - libexec.install "bin/private" - prefix.install Dir["*"] + libexec.install Dir["*"] + bin.write_exec_script (libexec/"bin/asdf") touch prefix/"asdf_updates_disabled" end From 4b6418ab49c686d56f00ad2cc95fee345d56c573 Mon Sep 17 00:00:00 2001 From: Seivan Date: Mon, 15 Mar 2021 05:53:45 +0100 Subject: [PATCH 02/19] Update asdf.rb Remove dependencies unrelated to this formula. It doesn't fall on this formula to require those since it works without them. --- Formula/asdf.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 5146f3c211ba9..87805399f46df 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -9,15 +9,6 @@ class Asdf < Formula bottle :unneeded - depends_on "autoconf" - depends_on "automake" - depends_on "coreutils" - depends_on "libtool" - depends_on "libyaml" - depends_on "openssl@1.1" - depends_on "readline" - depends_on "unixodbc" - conflicts_with "homeshick", because: "asdf and homeshick both install files in lib/commands" From b517eb00222262961583460e96f3379bb01c8d57 Mon Sep 17 00:00:00 2001 From: Seivan Date: Mon, 15 Mar 2021 06:15:23 +0100 Subject: [PATCH 03/19] Update asdf.rb No longer conflicting with `homeshick` as we're not polluting `/usr/local/lib` with commands or whatever it claimed. --- Formula/asdf.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 87805399f46df..c492af2c4dcd2 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -9,9 +9,6 @@ class Asdf < Formula bottle :unneeded - conflicts_with "homeshick", - because: "asdf and homeshick both install files in lib/commands" - def install bash_completion.install "completions/asdf.bash" fish_completion.install "completions/asdf.fish" From 731290a282efe841e33f2b05d121b5761155529e Mon Sep 17 00:00:00 2001 From: Seivan Date: Mon, 15 Mar 2021 14:20:38 +0100 Subject: [PATCH 04/19] Update asdf.rb asdf uses both the presence of a file OR git to check if updates are possible or not. No need to add a file, since git will fail on the fact that it's not a repo. Fix: https://github.com/Homebrew/homebrew-core/pull/73173#discussion_r594323591 --- Formula/asdf.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index c492af2c4dcd2..8eb0521dd399e 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -15,7 +15,6 @@ def install zsh_completion.install "completions/_asdf" libexec.install Dir["*"] bin.write_exec_script (libexec/"bin/asdf") - touch prefix/"asdf_updates_disabled" end test do From 5b99c71127606efcb3b7bf3d21753c8702430016 Mon Sep 17 00:00:00 2001 From: Seivan Date: Mon, 15 Mar 2021 21:00:27 +0100 Subject: [PATCH 05/19] Update asdf.rb Switch to `opt_libexec` which translates to `opt_prefix/"libexec`, this means that there will be no migration steps for shims. However till adding a `$ asdf reshim` `post_install` hook incase there is an update that needs to be done on the shims when `asdf` itself updates to a new version or formula revision. There are changes pending on [`asdf-vm`](https://github.com/asdf-vm/asdf/pull/893) that would allow regenerating the shims in case they need to be. --- Formula/asdf.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 8eb0521dd399e..81a2d75bad606 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -13,8 +13,12 @@ def install bash_completion.install "completions/asdf.bash" fish_completion.install "completions/asdf.fish" zsh_completion.install "completions/_asdf" - libexec.install Dir["*"] - bin.write_exec_script (libexec/"bin/asdf") + bin.write_exec_script (opt_libexec/"bin/asdf") + prefix.install_metafiles + end + + def post_install + system bin/"asdf", "reshim" end test do From bc44890c483102f801bee30241e0d7d32c7db287 Mon Sep 17 00:00:00 2001 From: Seivan Date: Mon, 15 Mar 2021 21:06:44 +0100 Subject: [PATCH 06/19] Update Formula/asdf.rb Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> --- Formula/asdf.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 81a2d75bad606..45eed0a75341e 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -14,7 +14,6 @@ def install fish_completion.install "completions/asdf.fish" zsh_completion.install "completions/_asdf" bin.write_exec_script (opt_libexec/"bin/asdf") - prefix.install_metafiles end def post_install From 9435946c1345d4e733eaed0f7fae8ffc659f5465 Mon Sep 17 00:00:00 2001 From: Seivan Date: Tue, 16 Mar 2021 00:16:10 +0100 Subject: [PATCH 07/19] Update asdf.rb Fix lint issues. --- Formula/asdf.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 45eed0a75341e..bfa3acfe1ffdf 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -17,7 +17,7 @@ def install end def post_install - system bin/"asdf", "reshim" + system bin/"asdf", "reshim" end test do From aae56ab3cdc62478a1fae14a169f8a42b1face1b Mon Sep 17 00:00:00 2001 From: Seivan Date: Tue, 16 Mar 2021 14:54:22 +0100 Subject: [PATCH 08/19] Update asdf.rb Adding adding "asdf_updates_disabled" file to libexec, to disallow updates since it might be a git repo on m1/arm. Fix: https://github.com/Homebrew/homebrew-core/pull/73173/files/b517eb00222262961583460e96f3379bb01c8d57#r594787883 --- Formula/asdf.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index bfa3acfe1ffdf..5b64bbf56c590 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -13,6 +13,8 @@ def install bash_completion.install "completions/asdf.bash" fish_completion.install "completions/asdf.fish" zsh_completion.install "completions/_asdf" + libexec.install Dir["*"] + touch libexec/"asdf_updates_disabled" bin.write_exec_script (opt_libexec/"bin/asdf") end From 6b9f33bb8cfa7bbabf3fda362b4a990d3b2f5547 Mon Sep 17 00:00:00 2001 From: Seivan Date: Tue, 16 Mar 2021 16:20:06 +0100 Subject: [PATCH 09/19] Update asdf.rb Add `git` and `coreutils` as dependencies because `asdf` needs to be written as cross platform this will help maintainers not to worry about platforms. --- Formula/asdf.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 5b64bbf56c590..2e900ac51f671 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -8,6 +8,9 @@ class Asdf < Formula head "https://github.com/asdf-vm/asdf.git" bottle :unneeded + + depends_on "git" + depends_on "coreutils" def install bash_completion.install "completions/asdf.bash" From 7ec5a42f3424f2da40e9040ddd9c3a4b53c1bcb5 Mon Sep 17 00:00:00 2001 From: Seivan Date: Tue, 16 Mar 2021 17:08:38 +0100 Subject: [PATCH 10/19] Update asdf.rb Fix CI lint issues. --- Formula/asdf.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 2e900ac51f671..47a88ddc89c16 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -8,9 +8,9 @@ class Asdf < Formula head "https://github.com/asdf-vm/asdf.git" bottle :unneeded - - depends_on "git" depends_on "coreutils" + depends_on "git" + def install bash_completion.install "completions/asdf.bash" From b67ca062673bd9d9f9e749d37654d33914a33257 Mon Sep 17 00:00:00 2001 From: Seivan Date: Tue, 16 Mar 2021 19:29:14 +0100 Subject: [PATCH 11/19] Update asdf.rb More linting crap. --- Formula/asdf.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 47a88ddc89c16..316306e8506f7 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -11,7 +11,6 @@ class Asdf < Formula depends_on "coreutils" depends_on "git" - def install bash_completion.install "completions/asdf.bash" fish_completion.install "completions/asdf.fish" From 9290bfb24c17093dfb3918d2bbe261074284be86 Mon Sep 17 00:00:00 2001 From: Seivan Date: Fri, 19 Mar 2021 02:03:36 +0100 Subject: [PATCH 12/19] Add migration code for existing users. This should technically make it work for existing users who are migrating. Per https://github.com/Homebrew/homebrew-core/pull/73173#pullrequestreview-615766212 Co-authored-by: Michael Cho --- Formula/asdf.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 316306e8506f7..0f15b175cc36a 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -18,6 +18,8 @@ def install libexec.install Dir["*"] touch libexec/"asdf_updates_disabled" bin.write_exec_script (opt_libexec/"bin/asdf") + (prefix/"asdf.sh").write "source #{opt_libexec}/asdf.sh\n" + (prefix/"asdf.fish").write "source #{opt_libexec}/asdf.fish\n" end def post_install From 6baf05865cf0cc9657c52b87bd26b4ad240b6b9d Mon Sep 17 00:00:00 2001 From: Seivan Date: Fri, 19 Mar 2021 02:13:41 +0100 Subject: [PATCH 13/19] Update asdf.rb Add caveat for migrating. --- Formula/asdf.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 0f15b175cc36a..94a2d83509489 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -18,14 +18,28 @@ def install libexec.install Dir["*"] touch libexec/"asdf_updates_disabled" bin.write_exec_script (opt_libexec/"bin/asdf") - (prefix/"asdf.sh").write "source #{opt_libexec}/asdf.sh\n" - (prefix/"asdf.fish").write "source #{opt_libexec}/asdf.fish\n" + (prefix/"asdf.sh").write ". #{opt_libexec}/asdf.sh\n" + (prefix/"asdf.fish").write ". #{opt_libexec}/asdf.fish\n" end def post_install system bin/"asdf", "reshim" end + def caveats + <<~EOS + Add shims in $PATH by having the following line your ~/.zshenv or ~/bash_profile: + export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims" + + To support package version per session using asdf shell + Add the following line to your ~/.bash_profile or ~/.zshrc file: + . #{opt_libexec}/lib/asdf.sh + If you use Fish shell then add the following line to your ~/.config/fish/config.fish: + . #{opt_libexec}/lib/asdf.fish + Restart your terminal for the settings to take effect. + EOS + end + test do output = shell_output("#{bin}/asdf plugin-list 2>&1", 1) assert_match "Oohes nooes ~! No plugins installed", output From 0d8ddaf0bed5aa71999a9815f388a4581ef96f57 Mon Sep 17 00:00:00 2001 From: Seivan Date: Fri, 19 Mar 2021 02:27:38 +0100 Subject: [PATCH 14/19] Create asdf.rb Add caveat for new settings. --- Formula/asdf.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 94a2d83509489..bdd5aa69fccd8 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -28,11 +28,11 @@ def post_install def caveats <<~EOS - Add shims in $PATH by having the following line your ~/.zshenv or ~/bash_profile: - export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims" + Add shims in $PATH by having the following line your ~/.zshenv or #{shell_profile}: + export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH" To support package version per session using asdf shell - Add the following line to your ~/.bash_profile or ~/.zshrc file: + Add the following line to your #{shell_profile} file: . #{opt_libexec}/lib/asdf.sh If you use Fish shell then add the following line to your ~/.config/fish/config.fish: . #{opt_libexec}/lib/asdf.fish From 51e2e38ad60b7dd1849ca0114fad2fff7b28235d Mon Sep 17 00:00:00 2001 From: Seivan Date: Fri, 19 Mar 2021 02:29:21 +0100 Subject: [PATCH 15/19] Update asdf.rb Fix trailing whitespace for CI. --- Formula/asdf.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index bdd5aa69fccd8..92795a0739b94 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -28,7 +28,7 @@ def post_install def caveats <<~EOS - Add shims in $PATH by having the following line your ~/.zshenv or #{shell_profile}: + Add shims in $PATH by having the following line your #{shell_profile} or ~/.zshenv: export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH" To support package version per session using asdf shell @@ -39,7 +39,7 @@ def caveats Restart your terminal for the settings to take effect. EOS end - + test do output = shell_output("#{bin}/asdf plugin-list 2>&1", 1) assert_match "Oohes nooes ~! No plugins installed", output From 10aca50a0e7511fe77f9ee8f8ba68360837e57c5 Mon Sep 17 00:00:00 2001 From: Seivan Date: Fri, 19 Mar 2021 02:49:31 +0100 Subject: [PATCH 16/19] Update asdf.rb Fish is not posix. --- Formula/asdf.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 92795a0739b94..98392fbf910ca 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -19,7 +19,7 @@ def install touch libexec/"asdf_updates_disabled" bin.write_exec_script (opt_libexec/"bin/asdf") (prefix/"asdf.sh").write ". #{opt_libexec}/asdf.sh\n" - (prefix/"asdf.fish").write ". #{opt_libexec}/asdf.fish\n" + (prefix/"asdf.fish").write "source #{opt_libexec}/asdf.fish\n" end def post_install @@ -28,14 +28,14 @@ def post_install def caveats <<~EOS - Add shims in $PATH by having the following line your #{shell_profile} or ~/.zshenv: + Add shims in $PATH by having the following line your ~/.zshenv or #{shell_profile}: export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH" To support package version per session using asdf shell Add the following line to your #{shell_profile} file: . #{opt_libexec}/lib/asdf.sh If you use Fish shell then add the following line to your ~/.config/fish/config.fish: - . #{opt_libexec}/lib/asdf.fish + source #{opt_libexec}/lib/asdf.fish Restart your terminal for the settings to take effect. EOS end From 198430fcffae3d91758618a15a9df335edaf309b Mon Sep 17 00:00:00 2001 From: Seivan Date: Fri, 19 Mar 2021 04:14:01 +0100 Subject: [PATCH 17/19] Update asdf.rb Should be support for this, since I've seen $PATH updates for various python packages and chruby. --- Formula/asdf.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 98392fbf910ca..bc102e1768727 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -30,12 +30,20 @@ def caveats <<~EOS Add shims in $PATH by having the following line your ~/.zshenv or #{shell_profile}: export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH" + If you use Fish shell add the following line to your ~/.config/fish/config.fish: + set PATH ( + if test -n "$ASDF_DATA_DIR" + echo $ASDF_DATA_DIR/shims + else + echo $HOME/.asdf/shims + end + ) $PATH To support package version per session using asdf shell - Add the following line to your #{shell_profile} file: - . #{opt_libexec}/lib/asdf.sh - If you use Fish shell then add the following line to your ~/.config/fish/config.fish: - source #{opt_libexec}/lib/asdf.fish + Add the following line to your #{shell_profile} file: + . #{opt_libexec}/lib/asdf.sh + If you use Fish shell add the following line to your ~/.config/fish/config.fish: + source #{opt_libexec}/lib/asdf.fish Restart your terminal for the settings to take effect. EOS end From c6dbcad013838672517d8039e69f554e22f7444f Mon Sep 17 00:00:00 2001 From: Seivan Date: Fri, 19 Mar 2021 07:12:28 +0100 Subject: [PATCH 18/19] Update asdf.rb Fix indentation, using spaces. --- Formula/asdf.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index bc102e1768727..78e484ebe7014 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -31,19 +31,19 @@ def caveats Add shims in $PATH by having the following line your ~/.zshenv or #{shell_profile}: export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH" If you use Fish shell add the following line to your ~/.config/fish/config.fish: - set PATH ( - if test -n "$ASDF_DATA_DIR" - echo $ASDF_DATA_DIR/shims - else - echo $HOME/.asdf/shims - end - ) $PATH + set PATH ( + if test -n "$ASDF_DATA_DIR" + echo $ASDF_DATA_DIR/shims + else + echo $HOME/.asdf/shims + end + ) $PATH To support package version per session using asdf shell - Add the following line to your #{shell_profile} file: - . #{opt_libexec}/lib/asdf.sh - If you use Fish shell add the following line to your ~/.config/fish/config.fish: - source #{opt_libexec}/lib/asdf.fish + Add the following line to your #{shell_profile} file: + . #{opt_libexec}/lib/asdf.sh + If you use Fish shell add the following line to your ~/.config/fish/config.fish: + source #{opt_libexec}/lib/asdf.fish Restart your terminal for the settings to take effect. EOS end From c243d9f52a84625415d18b25fea7d83b75c7d446 Mon Sep 17 00:00:00 2001 From: Seivan Date: Fri, 26 Mar 2021 00:04:48 +0100 Subject: [PATCH 19/19] Update asdf.rb Taking into account that macOS `path_helper` might trip some people up. --- Formula/asdf.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Formula/asdf.rb b/Formula/asdf.rb index 78e484ebe7014..52e32907a5057 100644 --- a/Formula/asdf.rb +++ b/Formula/asdf.rb @@ -28,7 +28,7 @@ def post_install def caveats <<~EOS - Add shims in $PATH by having the following line your ~/.zshenv or #{shell_profile}: + Add shims in $PATH by having the following line your #{shell_profile}: export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH" If you use Fish shell add the following line to your ~/.config/fish/config.fish: set PATH (