1
0
mirror of https://github.com/meineerde/dotfiles.git synced 2025-10-17 19:41:01 +00:00

Set the chruby_auto Ruby version in PS1 to show the right version on initial load

This commit is contained in:
Holger Just 2019-03-25 12:12:58 +01:00
parent ef3a6f2644
commit 7e1bf02e2d

View File

@ -171,7 +171,13 @@ __prompt_ruby_version() {
return $?
fi
if [[ -n "$RUBY_ROOT" ]]; then
if type chruby_auto >/dev/null 2>&1; then
chruby_auto
fi
if [[ -n "$RUBY_VERSION" ]]; then
local ruby_version="$RUBY_VERSION"
elif [[ -n "$RUBY_ROOT" ]]; then
local ruby_version="$(basename "$RUBY_ROOT")"
elif type ruby > /dev/null 2>&1; then
local ruby_version="$(ruby -e "puts defined?(RUBY_ENGINE_VERSION) ? \"#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}\" : \"ruby-#{RUBY_VERSION}\"")"