mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Automatically create a default of system if it's missing instead of raising an error
This commit is contained in:
parent
cd24495045
commit
9f18fe5031
3 changed files with 7 additions and 7 deletions
|
@ -51,7 +51,6 @@ if [ -z "$print" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "${HOME}/.rbenv/{shims,versions}"
|
mkdir -p "${HOME}/.rbenv/{shims,versions}"
|
||||||
[ -e "${HOME}/.rbenv/default" ] || echo system > "${HOME}/.rbenv/default"
|
|
||||||
|
|
||||||
echo 'export PATH="${HOME}/.rbenv/shims:${PATH}"'
|
echo 'export PATH="${HOME}/.rbenv/shims:${PATH}"'
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,11 @@ find_version_file() {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFAULT_PATH="${HOME}/.rbenv/default"
|
||||||
|
|
||||||
find_default_version_file() {
|
find_default_version_file() {
|
||||||
local default_path="$HOME/.rbenv/default"
|
if [ -e "$DEFAULT_PATH" ]; then
|
||||||
if [ -e "$default_path" ]; then
|
echo "$DEFAULT_PATH"
|
||||||
echo "$default_path"
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
|
@ -31,8 +32,8 @@ if [ -z "$RBENV_VERSION" ]; then
|
||||||
if [ -n "$RBENV_VERSION_FILE" ]; then
|
if [ -n "$RBENV_VERSION_FILE" ]; then
|
||||||
RBENV_VERSION="$(read_version_file "$RBENV_VERSION_FILE")"
|
RBENV_VERSION="$(read_version_file "$RBENV_VERSION_FILE")"
|
||||||
else
|
else
|
||||||
echo "rbenv: no default version specified" >&2
|
echo system > "$DEFAULT_PATH"
|
||||||
exit 1
|
RBENV_VERSION=system
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash -e
|
#!/usr/bin/env bash -e
|
||||||
|
|
||||||
RBENV_VERSION="$(rbenv-version 2>/dev/null || true)"
|
RBENV_VERSION="$(rbenv-version)"
|
||||||
|
|
||||||
hit_prefix="* "
|
hit_prefix="* "
|
||||||
miss_prefix=" "
|
miss_prefix=" "
|
||||||
|
|
Loading…
Reference in a new issue