From 3c9674453fe51b40acef22141ad477d8da86dc7e Mon Sep 17 00:00:00 2001 From: Jason Karns Date: Mon, 28 Dec 2015 21:33:50 -0500 Subject: [PATCH 1/2] fix local --unset test --- test/local.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/local.bats b/test/local.bats index a84833eb..368a8c0d 100644 --- a/test/local.bats +++ b/test/local.bats @@ -92,7 +92,7 @@ OUT touch .ruby-version run rbenv-local --unset assert_success "" - assert [ ! -e .rbenv-version ] + assert [ ! -e .ruby-version ] } @test "unsets alternate version file" { From f880dc6d6f65f2793f5f70fcb26e76f00033ec8b Mon Sep 17 00:00:00 2001 From: Jason Karns Date: Mon, 28 Dec 2015 21:34:05 -0500 Subject: [PATCH 2/2] Remove support for legacy version file --- README.md | 5 ----- libexec/rbenv-local | 13 +---------- libexec/rbenv-version-file | 3 --- test/local.bats | 44 -------------------------------------- test/version-file.bats | 21 ------------------ test/version-origin.bats | 6 ------ 6 files changed, 1 insertion(+), 91 deletions(-) diff --git a/README.md b/README.md index b007759a..64e8a3c1 100644 --- a/README.md +++ b/README.md @@ -374,11 +374,6 @@ configured local version. You can also unset the local version: $ rbenv local --unset -Previous versions of rbenv stored local version specifications in a -file named `.rbenv-version`. For backwards compatibility, rbenv will -read a local version specified in an `.rbenv-version` file, but a -`.ruby-version` file in the same directory will take precedence. - ### rbenv global Sets the global version of Ruby to be used in all shells by writing diff --git a/libexec/rbenv-local b/libexec/rbenv-local index d5c5f11c..70c3751d 100755 --- a/libexec/rbenv-local +++ b/libexec/rbenv-local @@ -15,10 +15,6 @@ # `RBENV_VERSION' environment variable takes precedence over local # and global versions. # -# For backwards compatibility, rbenv will also read version -# specifications from `.rbenv-version' files, but a `.ruby-version' -# file in the same directory takes precedence. -# # should be a string matching a Ruby version known to rbenv. # The special version string `system' will use your default system Ruby. # Run `rbenv versions' for a list of available Ruby versions. @@ -36,16 +32,9 @@ fi RBENV_VERSION="$1" if [ "$RBENV_VERSION" = "--unset" ]; then - rm -f .ruby-version .rbenv-version + rm -f .ruby-version elif [ -n "$RBENV_VERSION" ]; then - previous_file="$(RBENV_VERSION= rbenv-version-origin || true)" rbenv-version-file-write .ruby-version "$RBENV_VERSION" - if [ "$previous_file" -ef .rbenv-version ]; then - rm -f .rbenv-version - { echo "rbenv: removed existing \`.rbenv-version' file and migrated" - echo " local version specification to \`.ruby-version' file" - } >&2 - fi else if version_file="$(rbenv-version-file "$PWD")"; then rbenv-version-file-read "$version_file" diff --git a/libexec/rbenv-version-file b/libexec/rbenv-version-file index 1e70539f..0e0c1484 100755 --- a/libexec/rbenv-version-file +++ b/libexec/rbenv-version-file @@ -12,9 +12,6 @@ find_local_version_file() { if [ -e "${root}/.ruby-version" ]; then echo "${root}/.ruby-version" return 0 - elif [ -e "${root}/.rbenv-version" ]; then - echo "${root}/.rbenv-version" - return 0 fi [ -n "$root" ] || break root="${root%/*}" diff --git a/test/local.bats b/test/local.bats index 368a8c0d..2d378c70 100644 --- a/test/local.bats +++ b/test/local.bats @@ -19,19 +19,6 @@ setup() { assert_success "1.2.3" } -@test "supports legacy .rbenv-version file" { - echo "1.2.3" > .rbenv-version - run rbenv-local - assert_success "1.2.3" -} - -@test "local .ruby-version has precedence over .rbenv-version" { - echo "1.8" > .rbenv-version - echo "2.0" > .ruby-version - run rbenv-local - assert_success "2.0" -} - @test "discovers version file in parent directory" { echo "1.2.3" > .ruby-version mkdir -p "subdir" && cd "subdir" @@ -64,40 +51,9 @@ setup() { assert [ "$(cat .ruby-version)" = "1.2.3" ] } -@test "renames .rbenv-version to .ruby-version" { - echo "1.8.7" > .rbenv-version - mkdir -p "${RBENV_ROOT}/versions/1.9.3" - run rbenv-local - assert_success "1.8.7" - run rbenv-local "1.9.3" - assert_success - assert_output < .rbenv-version - assert [ ! -e "${RBENV_ROOT}/versions/1.9.3" ] - run rbenv-local "1.9.3" - assert_failure "rbenv: version \`1.9.3' not installed" - assert [ ! -e .ruby-version ] - assert [ "$(cat .rbenv-version)" = "1.8.7" ] -} - @test "unsets local version" { touch .ruby-version run rbenv-local --unset assert_success "" assert [ ! -e .ruby-version ] } - -@test "unsets alternate version file" { - touch .rbenv-version - run rbenv-local --unset - assert_success "" - assert [ ! -e .rbenv-version ] -} diff --git a/test/version-file.bats b/test/version-file.bats index ef7901f4..f5c544cc 100644 --- a/test/version-file.bats +++ b/test/version-file.bats @@ -45,19 +45,6 @@ create_file() { assert_success "${RBENV_TEST_DIR}/.ruby-version" } -@test "legacy file in current directory" { - create_file ".rbenv-version" - run rbenv-version-file - assert_success "${RBENV_TEST_DIR}/.rbenv-version" -} - -@test ".ruby-version has precedence over legacy file" { - create_file ".ruby-version" - create_file ".rbenv-version" - run rbenv-version-file - assert_success "${RBENV_TEST_DIR}/.ruby-version" -} - @test "in parent directory" { create_file ".ruby-version" mkdir -p project @@ -74,14 +61,6 @@ create_file() { assert_success "${RBENV_TEST_DIR}/project/.ruby-version" } -@test "legacy file has precedence if higher" { - create_file ".ruby-version" - create_file "project/.rbenv-version" - cd project - run rbenv-version-file - assert_success "${RBENV_TEST_DIR}/project/.rbenv-version" -} - @test "RBENV_DIR has precedence over PWD" { create_file "widget/.ruby-version" create_file "project/.ruby-version" diff --git a/test/version-origin.bats b/test/version-origin.bats index 61e1dfe8..12da6be9 100644 --- a/test/version-origin.bats +++ b/test/version-origin.bats @@ -31,12 +31,6 @@ setup() { assert_success "${PWD}/.ruby-version" } -@test "detects alternate version file" { - touch .rbenv-version - run rbenv-version-origin - assert_success "${PWD}/.rbenv-version" -} - @test "reports from hook" { mkdir -p "${RBENV_ROOT}/rbenv.d/version-origin" cat > "${RBENV_ROOT}/rbenv.d/version-origin/test.bash" <