Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion share/chruby/auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,26 @@ function chruby_auto() {
done

if [[ -n "$RUBY_AUTO_VERSION" ]]; then
chruby_reset
unset RUBY_AUTO_VERSION
if [[ -z "$RUBY_DEFAULT_VERSION" ]]; then
chruby_reset
else
chruby_use_default
fi
fi
}

function chruby_default() {
RUBY_DEFAULT_VERSION="$1"
if [[ -z "$RUBY_AUTO_VERSION" ]]; then
chruby_use_default
fi
}

function chruby_use_default() {
chruby "$RUBY_DEFAULT_VERSION"
}

if [[ -n "$ZSH_VERSION" ]]; then
if [[ ! "$preexec_functions" == *chruby_auto* ]]; then
preexec_functions+=("chruby_auto")
Expand Down