From 1d09c6bb0a950756a65b02457842933e3aa493eb Mon Sep 17 00:00:00 2001 From: vladislav doster <10052309+vladdoster@users.noreply.github.com> Date: Tue, 26 Mar 2024 03:55:16 -0500 Subject: style: remove trailing whitespace (#12303) --- plugins/chruby/chruby.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/chruby') diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh index d7a28d4e2..1210897c4 100644 --- a/plugins/chruby/chruby.plugin.zsh +++ b/plugins/chruby/chruby.plugin.zsh @@ -2,7 +2,7 @@ _source-from-omz-settings() { local _chruby_path _chruby_auto - + zstyle -s :omz:plugins:chruby path _chruby_path || return 1 zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1 @@ -23,7 +23,7 @@ _source-from-homebrew() { if [[ -h /usr/local/opt/chruby ]];then _brew_prefix="/usr/local/opt/chruby" else - # ok , it is not default prefix + # ok , it is not default prefix # this call to brew is expensive ( about 400 ms ), so at least let's make it only once _brew_prefix=$(brew --prefix chruby) fi -- cgit v1.2.3-70-g09d2 From 8074eb8b46d20a2f3ad2b99201388900a2e33450 Mon Sep 17 00:00:00 2001 From: Dennis Dashkevich Date: Wed, 12 Feb 2025 22:24:56 +0300 Subject: fix(chruby): update brew sourcing for Apple Silicon (#12941) Co-authored-by: Carlo Sala --- plugins/chruby/chruby.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins/chruby') diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh index 1210897c4..06afef189 100644 --- a/plugins/chruby/chruby.plugin.zsh +++ b/plugins/chruby/chruby.plugin.zsh @@ -22,6 +22,8 @@ _source-from-homebrew() { # check default brew prefix if [[ -h /usr/local/opt/chruby ]];then _brew_prefix="/usr/local/opt/chruby" + elif [[ -h /opt/homebrew/opt/chruby ]]; then + _brew_prefix="/opt/homebrew/opt/chruby" else # ok , it is not default prefix # this call to brew is expensive ( about 400 ms ), so at least let's make it only once -- cgit v1.2.3-70-g09d2 From 266bc17ab3587920a7a98262c78dc5a026583bf3 Mon Sep 17 00:00:00 2001 From: Dennis Dashkevich Date: Tue, 26 Aug 2025 05:51:00 +0300 Subject: fix(chruby): avoid adding PATH entries twice (#12980) --- plugins/chruby/chruby.plugin.zsh | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'plugins/chruby') 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 -- cgit v1.2.3-70-g09d2