From ef4ecc3c3945d2fddf95b11ca4c245f1cb76b8c2 Mon Sep 17 00:00:00 2001 From: Dennis Dashkevich Date: Sun, 16 Feb 2025 12:55:41 +0300 Subject: [PATCH] fix(chruby): fix the `rubies` command output --- plugins/chruby/chruby.plugin.zsh | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh index 06afef189..1bcc6c6d9 100644 --- a/plugins/chruby/chruby.plugin.zsh +++ b/plugins/chruby/chruby.plugin.zsh @@ -15,6 +15,13 @@ _source-from-omz-settings() { fi } +_source-from-default-location() { + [[ -r /usr/local/share/chruby/chruby.sh ]] || return 1 + + source /usr/local/share/chruby/chruby.sh + source /usr/local/share/chruby/auto.sh +} + _source-from-homebrew() { (( $+commands[brew] )) || return 1 @@ -36,27 +43,14 @@ _source-from-homebrew() { source $_brew_prefix/share/chruby/auto.sh } -_load-chruby-dirs() { - local dir - for dir in "$HOME/.rubies" "$PREFIX/opt/rubies"; do - if [[ -d "$dir" ]]; then - RUBIES+=("$dir") - fi - done -} - # Load chruby -if _source-from-omz-settings; then - _load-chruby-dirs -elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then - source /usr/local/share/chruby/chruby.sh - source /usr/local/share/chruby/auto.sh - _load-chruby-dirs -elif _source-from-homebrew; then - _load-chruby-dirs -fi +_source-from-omz-settings || \ + _source-from-default-location || \ + _source-from-homebrew -unfunction _source-from-homebrew _source-from-omz-settings _load-chruby-dirs +unfunction _source-from-homebrew \ + _source-from-default-location \ + _source-from-omz-settings ## chruby utility functions and aliases