diff --git a/libexec/rbenv-init b/libexec/rbenv-init index 9569e93f..f9de2858 100755 --- a/libexec/rbenv-init +++ b/libexec/rbenv-init @@ -51,7 +51,6 @@ if [ -z "$print" ]; then fi mkdir -p "${HOME}/.rbenv/{shims,versions}" -[ -e "${HOME}/.rbenv/default" ] || echo system > "${HOME}/.rbenv/default" echo 'export PATH="${HOME}/.rbenv/shims:${PATH}"' diff --git a/libexec/rbenv-version b/libexec/rbenv-version index 2c9cae13..5e7e9940 100755 --- a/libexec/rbenv-version +++ b/libexec/rbenv-version @@ -16,10 +16,11 @@ find_version_file() { return 1 } +DEFAULT_PATH="${HOME}/.rbenv/default" + find_default_version_file() { - local default_path="$HOME/.rbenv/default" - if [ -e "$default_path" ]; then - echo "$default_path" + if [ -e "$DEFAULT_PATH" ]; then + echo "$DEFAULT_PATH" return 0 fi return 1 @@ -31,8 +32,8 @@ if [ -z "$RBENV_VERSION" ]; then if [ -n "$RBENV_VERSION_FILE" ]; then RBENV_VERSION="$(read_version_file "$RBENV_VERSION_FILE")" else - echo "rbenv: no default version specified" >&2 - exit 1 + echo system > "$DEFAULT_PATH" + RBENV_VERSION=system fi fi diff --git a/libexec/rbenv-versions b/libexec/rbenv-versions index 94b878ea..e69c751f 100755 --- a/libexec/rbenv-versions +++ b/libexec/rbenv-versions @@ -1,6 +1,6 @@ #!/usr/bin/env bash -e -RBENV_VERSION="$(rbenv-version 2>/dev/null || true)" +RBENV_VERSION="$(rbenv-version)" hit_prefix="* " miss_prefix=" "