1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-12 21:33:54 -05:00

Split rbenv-version into rbenv-version-name and rbenv-version-origin, update versions, prefix, and which appropriately

This commit is contained in:
Ryan Baumann
2011-08-09 16:41:35 -04:00
parent 2a495dc9ac
commit bd0e1a73f9
6 changed files with 72 additions and 58 deletions

29
libexec/rbenv-version-origin Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash -e
find_version_file() {
local root="$(pwd)"
while [ -n "$root" ]; do
if [ -e "${root}/.rbenv-version" ]; then
echo "${root}/.rbenv-version"
return 0
fi
root="${root%/*}"
done
return 1
}
DEFAULT_PATH="${HOME}/.rbenv/default"
find_default_version_file() {
if [ -e "$DEFAULT_PATH" ]; then
echo "$DEFAULT_PATH"
return 0
fi
return 1
}
if [ -z "$RBENV_VERSION" ]; then
find_version_file || find_default_version_file || true
else
echo "RBENV_VERSION environment variable"
fi