mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Merge pull request #850 from jasonkarns/remove-legacy-global-version-file
Remove support for legacy global version files
This commit is contained in:
commit
e199a3d8f7
4 changed files with 9 additions and 34 deletions
|
@ -27,8 +27,5 @@ RBENV_VERSION_FILE="${RBENV_ROOT}/version"
|
||||||
if [ -n "$RBENV_VERSION" ]; then
|
if [ -n "$RBENV_VERSION" ]; then
|
||||||
rbenv-version-file-write "$RBENV_VERSION_FILE" "$RBENV_VERSION"
|
rbenv-version-file-write "$RBENV_VERSION_FILE" "$RBENV_VERSION"
|
||||||
else
|
else
|
||||||
rbenv-version-file-read "$RBENV_VERSION_FILE" ||
|
rbenv-version-file-read "$RBENV_VERSION_FILE" || echo system
|
||||||
rbenv-version-file-read "${RBENV_ROOT}/global" ||
|
|
||||||
rbenv-version-file-read "${RBENV_ROOT}/default" ||
|
|
||||||
echo system
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -22,15 +22,7 @@ find_local_version_file() {
|
||||||
find_global_version_file() {
|
find_global_version_file() {
|
||||||
local global_version_file="${RBENV_ROOT}/version"
|
local global_version_file="${RBENV_ROOT}/version"
|
||||||
|
|
||||||
if [ -e "$global_version_file" ]; then
|
echo "$global_version_file"
|
||||||
echo "$global_version_file"
|
|
||||||
elif [ -e "${RBENV_ROOT}/global" ]; then
|
|
||||||
echo "${RBENV_ROOT}/global"
|
|
||||||
elif [ -e "${RBENV_ROOT}/default" ]; then
|
|
||||||
echo "${RBENV_ROOT}/default"
|
|
||||||
else
|
|
||||||
echo "$global_version_file"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -n "$target_dir" ]; then
|
if [ -n "$target_dir" ]; then
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
load test_helper
|
load test_helper
|
||||||
|
|
||||||
@test "default" {
|
@test "default" {
|
||||||
run rbenv global
|
run rbenv-global
|
||||||
assert_success
|
assert_success
|
||||||
assert_output "system"
|
assert_output "system"
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ load test_helper
|
||||||
mkdir -p "$RBENV_ROOT/versions/1.2.3"
|
mkdir -p "$RBENV_ROOT/versions/1.2.3"
|
||||||
run rbenv-global "1.2.3"
|
run rbenv-global "1.2.3"
|
||||||
assert_success
|
assert_success
|
||||||
run rbenv global
|
run rbenv-global
|
||||||
assert_success "1.2.3"
|
assert_success "1.2.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,29 +12,15 @@ create_file() {
|
||||||
touch "$1"
|
touch "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "prints global file if no version files exist" {
|
@test "detects global 'version' file" {
|
||||||
assert [ ! -e "${RBENV_ROOT}/version" ]
|
create_file "${RBENV_ROOT}/version"
|
||||||
assert [ ! -e ".ruby-version" ]
|
|
||||||
run rbenv-version-file
|
run rbenv-version-file
|
||||||
assert_success "${RBENV_ROOT}/version"
|
assert_success "${RBENV_ROOT}/version"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "detects 'global' file" {
|
@test "prints global file if no version files exist" {
|
||||||
create_file "${RBENV_ROOT}/global"
|
assert [ ! -e "${RBENV_ROOT}/version" ]
|
||||||
run rbenv-version-file
|
assert [ ! -e ".ruby-version" ]
|
||||||
assert_success "${RBENV_ROOT}/global"
|
|
||||||
}
|
|
||||||
|
|
||||||
@test "detects 'default' file" {
|
|
||||||
create_file "${RBENV_ROOT}/default"
|
|
||||||
run rbenv-version-file
|
|
||||||
assert_success "${RBENV_ROOT}/default"
|
|
||||||
}
|
|
||||||
|
|
||||||
@test "'version' has precedence over 'global' and 'default'" {
|
|
||||||
create_file "${RBENV_ROOT}/version"
|
|
||||||
create_file "${RBENV_ROOT}/global"
|
|
||||||
create_file "${RBENV_ROOT}/default"
|
|
||||||
run rbenv-version-file
|
run rbenv-version-file
|
||||||
assert_success "${RBENV_ROOT}/version"
|
assert_success "${RBENV_ROOT}/version"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue