Преглед на файлове

Fix https://github.com/rbenv/rbenv/issues/1065

Command `rbenv version-name > .ruby-version` will create an empty `.ruby-version` file
before running `rbenv-version-file`. This causes `rbenv-version-file` to return empty
string which in turn causes `rbenv-version-name` to return `system`.

Ensure size of `.ruby-version` is non-zero as a workaround.
pull/1133/head
Victor Lim преди 8 години
родител
ревизия
9daf81f16e
променени са 3 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. +1
    -1
      libexec/rbenv-version-file
  2. +1
    -1
      test/version-file.bats
  3. +1
    -1
      test/version-origin.bats

+ 1
- 1
libexec/rbenv-version-file Целия файл

@ -9,7 +9,7 @@ target_dir="$1"
find_local_version_file() {
local root="$1"
while ! [[ "$root" =~ ^//[^/]*$ ]]; do
if [ -f "${root}/.ruby-version" ]; then
if [ -s "${root}/.ruby-version" ]; then
echo "${root}/.ruby-version"
return 0
fi

+ 1
- 1
test/version-file.bats Целия файл

@ -9,7 +9,7 @@ setup() {
create_file() {
mkdir -p "$(dirname "$1")"
touch "$1"
echo "system" > "$1"
}
@test "detects global 'version' file" {

+ 1
- 1
test/version-origin.bats Целия файл

@ -26,7 +26,7 @@ setup() {
}
@test "detects local file" {
touch .ruby-version
echo "system" > .ruby-version
run rbenv-version-origin
assert_success "${PWD}/.ruby-version"
}

Зареждане…
Отказ
Запис