Autodetect chruby better

This commit is contained in:
Loic Nageleisen 2020-04-14 15:48:20 +02:00
parent d2dd80d9f0
commit 271d7eedca
2 changed files with 9 additions and 1 deletions

View file

@ -1,7 +1,15 @@
if [[ -f $HOME/.nix-profile/share/chruby/chruby.sh ]]; then if [[ -f $HOME/.nix-profile/share/chruby/chruby.sh ]]; then
source $HOME/.nix-profile/share/chruby/chruby.sh source $HOME/.nix-profile/share/chruby/chruby.sh
elif [[ -f /opt/arch/share/chruby/chruby.sh ]]; then
source /opt/arch/share/chruby/chruby.sh
elif [[ -f /usr/local/share/chruby/chruby.sh ]]; then
source /usr/local/share/chruby/chruby.sh
fi fi
_has-chruby() {
type -f chruby >/dev/null 2>&1
}
_ruby-version() { _ruby-version() {
local check_dir=$PWD local check_dir=$PWD
local next_check_dir=${check_dir%/*} local next_check_dir=${check_dir%/*}

2
zsh/rc
View file

@ -36,7 +36,7 @@ preexec() {
chpwd() { chpwd() {
__git_ps1_gitdir __git_ps1_gitdir
_gopath _gopath
_auto-chruby if _has-chruby; then _auto-chruby; fi
} }
chpwd chpwd