diff --git a/.gitignore b/.gitignore index 84639e79..00f2f052 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /libexec/*.dylib /src/Makefile /src/*.o +/gems diff --git a/README.md b/README.md index 7cad9055..7b023676 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ bulletproof deployments. **Rock-solid in production.** Your application's executables are its interface with ops. With rbenv and [Bundler - binstubs](https://github.com/sstephenson/rbenv/wiki/Understanding-binstubs) + binstubs](https://github.com/rbenv/rbenv/wiki/Understanding-binstubs) you'll never again need to `cd` in a cron job or Chef recipe to ensure you've selected the right runtime. The Ruby version dependency lives in one place—your app—so upgrades and rollbacks are @@ -24,12 +24,12 @@ bulletproof deployments. you tailor it to suit your needs. Compile your own Ruby versions, or use the [ruby-build][] plugin to automate the process. Specify per-application environment - variables with [rbenv-vars](https://github.com/sstephenson/rbenv-vars). + variables with [rbenv-vars](https://github.com/rbenv/rbenv-vars). See more [plugins on the - wiki](https://github.com/sstephenson/rbenv/wiki/Plugins). + wiki](https://github.com/rbenv/rbenv/wiki/Plugins). [**Why choose rbenv over -RVM?**](https://github.com/sstephenson/rbenv/wiki/Why-rbenv%3F) +RVM?**](https://github.com/rbenv/rbenv/wiki/Why-rbenv%3F) ## Table of Contents @@ -45,6 +45,7 @@ RVM?**](https://github.com/sstephenson/rbenv/wiki/Why-rbenv%3F) * [How rbenv hooks into your shell](#how-rbenv-hooks-into-your-shell) * [Installing Ruby Versions](#installing-ruby-versions) * [Uninstalling Ruby Versions](#uninstalling-ruby-versions) + * [Uninstalling rbenv](#uninstalling-rbenv) * [Command Reference](#command-reference) * [rbenv local](#rbenv-local) * [rbenv global](#rbenv-global) @@ -157,7 +158,7 @@ easy to fork and contribute any changes back upstream. 1. Check out rbenv into `~/.rbenv`. ~~~ sh - $ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv + $ git clone https://github.com/rbenv/rbenv.git ~/.rbenv ~~~ 2. Add `~/.rbenv/bin` to your `$PATH` for access to the `rbenv` @@ -298,6 +299,30 @@ Ruby version with the `rbenv prefix` command, e.g. `rbenv prefix The [ruby-build][] plugin provides an `rbenv uninstall` command to automate the removal process. +### Uninstalling rbenv + +The simplicity of rbenv makes it easy to temporarily disable it, or +uninstall from the system. + +1. To **disable** rbenv managing your Ruby versions, simply remove the + `rbenv init` line from your shell startup configuration. This will + remove rbenv shims directory from PATH, and future invocations like + `ruby` will execute the system Ruby version, as before rbenv. + + `rbenv` will still be accessible on the command line, but your Ruby + apps won't be affected by version switching. + +2. To completely **uninstall** rbenv, perform step (1) and then remove + its root directory. This will **delete all Ruby versions** that were + installed under `` `rbenv root`/versions/ `` directory: + + rm -rf `rbenv root` + + If you've installed rbenv using a package manager, as a final step + perform the rbenv package removal. For instance, for Homebrew: + + brew uninstall rbenv + ## Command Reference Like `git`, the `rbenv` command delegates to subcommands based on its @@ -419,7 +444,7 @@ name | default | description ## Development The rbenv source code is [hosted on -GitHub](https://github.com/sstephenson/rbenv). It's clean, modular, +GitHub](https://github.com/rbenv/rbenv). It's clean, modular, and easy to understand, even if you're not a shell hacker. Tests are executed using [Bats](https://github.com/sstephenson/bats): @@ -428,8 +453,8 @@ Tests are executed using [Bats](https://github.com/sstephenson/bats): $ bats test/.bats Please feel free to submit pull requests and file bugs on the [issue -tracker](https://github.com/sstephenson/rbenv/issues). +tracker](https://github.com/rbenv/rbenv/issues). - [ruby-build]: https://github.com/sstephenson/ruby-build#readme - [hooks]: https://github.com/sstephenson/rbenv/wiki/Authoring-plugins#rbenv-hooks + [ruby-build]: https://github.com/rbenv/ruby-build#readme + [hooks]: https://github.com/rbenv/rbenv/wiki/Authoring-plugins#rbenv-hooks diff --git a/bin/ruby-local-exec b/bin/ruby-local-exec index 97d0a3df..de57897c 100755 --- a/bin/ruby-local-exec +++ b/bin/ruby-local-exec @@ -16,7 +16,7 @@ export RBENV_DIR="${1%/*}" [ -n "$RBENV_SILENCE_WARNINGS" ] || { echo "rbenv: \`ruby-local-exec' is deprecated and will be removed in the next release." - echo " To upgrade: https://github.com/sstephenson/rbenv/wiki/ruby-local-exec" + echo " To upgrade: https://github.com/rbenv/rbenv/wiki/ruby-local-exec" echo } >&2 diff --git a/libexec/rbenv b/libexec/rbenv index de7ea692..795a2e9a 100755 --- a/libexec/rbenv +++ b/libexec/rbenv @@ -12,39 +12,42 @@ if [ -n "$RBENV_DEBUG" ]; then set -x fi -if enable -f "${0%/*}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; then +abort() { + { if [ "$#" -eq 0 ]; then cat - + else echo "rbenv: $*" + fi + } >&2 + exit 1 +} + +if enable -f "${BASH_SOURCE%/*}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; then abs_dirname() { local path="$(realpath "$1")" echo "${path%/*}" } else - if [ -n "$RBENV_NATIVE_EXT" ]; then - echo "rbenv: failed to load \`realpath' builtin" >&2 - exit 1 - fi -READLINK=$(type -p greadlink readlink | head -1) -if [ -z "$READLINK" ]; then - echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2 - exit 1 -fi + [ -z "$RBENV_NATIVE_EXT" ] || abort "failed to load \`realpath' builtin" -resolve_link() { - $READLINK "$1" -} + READLINK=$(type -p greadlink readlink | head -1) + [ -n "$READLINK" ] || abort "cannot find readlink - are you missing GNU coreutils?" -abs_dirname() { - local cwd="$(pwd)" - local path="$1" + resolve_link() { + $READLINK "$1" + } - while [ -n "$path" ]; do - cd "${path%/*}" - local name="${path##*/}" - path="$(resolve_link "$name" || true)" - done + abs_dirname() { + local cwd="$PWD" + local path="$1" - pwd - cd "$cwd" -} + while [ -n "$path" ]; do + cd "${path%/*}" + local name="${path##*/}" + path="$(resolve_link "$name" || true)" + done + + pwd + cd "$cwd" + } fi if [ -z "${RBENV_ROOT}" ]; then @@ -55,13 +58,10 @@ fi export RBENV_ROOT if [ -z "${RBENV_DIR}" ]; then - RBENV_DIR="$(pwd)" + RBENV_DIR="$PWD" else - cd "$RBENV_DIR" 2>/dev/null || { - echo "rbenv: cannot change working directory to \`$RBENV_DIR'" - exit 1 - } >&2 - RBENV_DIR="$(pwd)" + cd "$RBENV_DIR" 2>/dev/null || abort "cannot change working directory to \`$RBENV_DIR'" + RBENV_DIR="$PWD" cd "$OLDPWD" fi export RBENV_DIR @@ -91,20 +91,26 @@ shopt -u nullglob command="$1" case "$command" in -"" | "-h" | "--help" ) - echo -e "$(rbenv---version)\n$(rbenv-help)" >&2 +"" ) + { rbenv---version + rbenv-help + } | abort ;; -"-v" ) +-v | --version ) exec rbenv---version ;; +-h | --help ) + exec rbenv-help + ;; * ) command_path="$(command -v "rbenv-$command" || true)" - if [ -z "$command_path" ]; then - echo "rbenv: no such command \`$command'" >&2 - exit 1 - fi + [ -n "$command_path" ] || abort "no such command \`$command'" shift 1 - exec "$command_path" "$@" + if [ "$1" = --help ]; then + exec rbenv-help "$command" + else + exec "$command_path" "$@" + fi ;; esac diff --git a/libexec/rbenv---version b/libexec/rbenv---version index 79cb64d8..1254a2fd 100755 --- a/libexec/rbenv---version +++ b/libexec/rbenv---version @@ -13,10 +13,14 @@ set -e [ -n "$RBENV_DEBUG" ] && set -x version="0.4.0" +git_revision="" -if cd "$RBENV_ROOT" 2>/dev/null; then - git_revision="$(git describe --tags HEAD 2>/dev/null || true)" - git_revision="${git_revision#v}" -fi +for source_dir in "${BASH_SOURCE%/*}" "$RBENV_ROOT"; do + if cd "$source_dir" 2>/dev/null && git remote -v 2>/dev/null | grep -q rbenv; then + git_revision="$(git describe --tags HEAD 2>/dev/null || true)" + git_revision="${git_revision#v}" + [ -z "$git_revision" ] || break + fi +done echo "rbenv ${git_revision:-$version}" diff --git a/libexec/rbenv-completions b/libexec/rbenv-completions index 196212e4..19551c2e 100755 --- a/libexec/rbenv-completions +++ b/libexec/rbenv-completions @@ -10,7 +10,16 @@ if [ -z "$COMMAND" ]; then exit 1 fi +# Provide rbenv completions +if [ "$COMMAND" = "--complete" ]; then + exec rbenv-commands +fi + COMMAND_PATH="$(command -v "rbenv-$COMMAND" || command -v "rbenv-sh-$COMMAND")" + +# --help is provided automatically +echo --help + if grep -iE "^([#%]|--|//) provide rbenv completions" "$COMMAND_PATH" >/dev/null; then shift exec "$COMMAND_PATH" --complete "$@" diff --git a/libexec/rbenv-help b/libexec/rbenv-help index 9a3049aa..e5013d3d 100755 --- a/libexec/rbenv-help +++ b/libexec/rbenv-help @@ -15,6 +15,12 @@ set -e [ -n "$RBENV_DEBUG" ] && set -x +# Provide rbenv completions +if [ "$1" = "--complete" ]; then + echo --usage + exec rbenv-commands +fi + command_path() { local command="$1" command -v rbenv-"$command" || command -v rbenv-sh-"$command" || true @@ -146,7 +152,7 @@ if [ -z "$1" ] || [ "$1" == "rbenv" ]; then print_summaries commands local global shell install uninstall rehash version versions which whence echo echo "See \`rbenv help ' for information on a specific command." - echo "For full documentation, see: https://github.com/sstephenson/rbenv#readme" + echo "For full documentation, see: https://github.com/rbenv/rbenv#readme" else command="$1" if [ -n "$(command_path "$command")" ]; then diff --git a/libexec/rbenv-hooks b/libexec/rbenv-hooks index df0a6f60..010c7058 100755 --- a/libexec/rbenv-hooks +++ b/libexec/rbenv-hooks @@ -37,16 +37,17 @@ resolve_link() { } realpath() { - local cwd="$(pwd)" + local cwd="$PWD" local path="$1" + local name while [ -n "$path" ]; do - cd "${path%/*}" - local name="${path##*/}" + name="${path##*/}" + [ "$name" = "$path" ] || cd "${path%/*}" path="$(resolve_link "$name" || true)" done - echo "$(pwd)/$name" + echo "${PWD}/$name" cd "$cwd" } fi diff --git a/libexec/rbenv-init b/libexec/rbenv-init index 0b2c13aa..8e6ee3d8 100755 --- a/libexec/rbenv-init +++ b/libexec/rbenv-init @@ -5,6 +5,17 @@ set -e [ -n "$RBENV_DEBUG" ] && set -x +# Provide rbenv completions +if [ "$1" = "--complete" ]; then + echo - + echo --no-rehash + echo bash + echo fish + echo ksh + echo zsh + exit +fi + print="" no_rehash="" for args in "$@" @@ -25,7 +36,8 @@ if [ -z "$shell" ]; then shell="$(ps c -p "$PPID" -o 'ucomm=' 2>/dev/null || true)" shell="${shell##-}" shell="${shell%% *}" - shell="$(basename "${shell:-$SHELL}")" + shell="${shell:-$SHELL}" + shell="${shell##*/}" fi root="${0%/*}/.." @@ -33,7 +45,11 @@ root="${0%/*}/.." if [ -z "$print" ]; then case "$shell" in bash ) - profile='~/.bash_profile' + if [ -f "${HOME}/.bashrc" ] && [ ! -f "${HOME}/.bash_profile" ]; then + profile='~/.bashrc' + else + profile='~/.bash_profile' + fi ;; zsh ) profile='~/.zshrc' @@ -49,7 +65,7 @@ if [ -z "$print" ]; then ;; esac - { echo "# Load rbenv automatically by adding" + { echo "# Load rbenv automatically by appending" echo "# the following to ${profile}:" echo case "$shell" in @@ -88,7 +104,7 @@ if [ -r "$completion" ]; then fi if [ -z "$no_rehash" ]; then - echo 'rbenv rehash 2>/dev/null' + echo 'command rbenv rehash 2>/dev/null' fi commands=(`rbenv-commands --sh`) @@ -101,7 +117,7 @@ function rbenv switch "\$command" case ${commands[*]} - eval (rbenv "sh-\$command" \$argv) + . (rbenv "sh-\$command" \$argv|psub) case '*' command rbenv "\$command" \$argv end @@ -132,7 +148,7 @@ cat <&2 + echo "rbenv: version \`$RBENV_VERSION' is not installed (set by $(rbenv-version-origin))" >&2 exit 1 fi diff --git a/libexec/rbenv-versions b/libexec/rbenv-versions index b35cef48..b646cb54 100755 --- a/libexec/rbenv-versions +++ b/libexec/rbenv-versions @@ -1,13 +1,69 @@ #!/usr/bin/env bash # Summary: List all Ruby versions available to rbenv -# Usage: rbenv versions [--bare] +# Usage: rbenv versions [--bare] [--skip-aliases] # # Lists all Ruby versions found in `$RBENV_ROOT/versions/*'. set -e [ -n "$RBENV_DEBUG" ] && set -x -if [ "$1" = "--bare" ]; then +unset bare +unset skip_aliases +# Provide rbenv completions +for arg; do + case "$arg" in + --complete ) + echo --bare + echo --skip-aliases + exit ;; + --bare ) bare=1 ;; + --skip-aliases ) skip_aliases=1 ;; + * ) + rbenv-help --usage versions >&2 + exit 1 + ;; + esac +done + +versions_dir="${RBENV_ROOT}/versions" + +if ! enable -f "${BASH_SOURCE%/*}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; then + if [ -n "$RBENV_NATIVE_EXT" ]; then + echo "rbenv: failed to load \`realpath' builtin" >&2 + exit 1 + fi + + READLINK=$(type -p greadlink readlink | head -1) + if [ -z "$READLINK" ]; then + echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2 + exit 1 + fi + + resolve_link() { + $READLINK "$1" + } + + realpath() { + local cwd="$PWD" + local path="$1" + local name + + while [ -n "$path" ]; do + name="${path##*/}" + [ "$name" = "$path" ] || cd "${path%/*}" + path="$(resolve_link "$name" || true)" + done + + echo "${PWD}/$name" + cd "$cwd" + } +fi + +if [ -d "$versions_dir" ]; then + versions_dir="$(realpath "$versions_dir")" +fi + +if [ -n "$bare" ]; then hit_prefix="" miss_prefix="" current_version="" @@ -36,8 +92,12 @@ if [ -n "$include_system" ] && RBENV_VERSION=system rbenv-which ruby >/dev/null fi shopt -s nullglob -for path in "${RBENV_ROOT}/versions/"*; do +for path in "$versions_dir"/*; do if [ -d "$path" ]; then + if [ -n "$skip_aliases" ] && [ -L "$path" ]; then + target="$(realpath "$path")" + [ "${target%/*}" != "$versions_dir" ] || continue + fi print_version "${path##*/}" fi done diff --git a/libexec/rbenv-which b/libexec/rbenv-which index 3cf91de7..c7c0301a 100755 --- a/libexec/rbenv-which +++ b/libexec/rbenv-which @@ -23,7 +23,8 @@ remove_from_path() { path_before="$result" result="${result//:$path_to_remove:/:}" done - echo "${result%:}" + result="${result%:}" + echo "${result#:}" } RBENV_COMMAND="$1" @@ -51,8 +52,8 @@ done if [ -x "$RBENV_COMMAND_PATH" ]; then echo "$RBENV_COMMAND_PATH" -elif ! [ -d "${RBENV_ROOT}/versions/${RBENV_VERSION}" ]; then - echo "rbenv: version \`$RBENV_VERSION' is not installed" >&2 +elif [ "$RBENV_VERSION" != "system" ] && [ ! -d "${RBENV_ROOT}/versions/${RBENV_VERSION}" ]; then + echo "rbenv: version \`$RBENV_VERSION' is not installed (set by $(rbenv-version-origin))" >&2 exit 1 else echo "rbenv: $RBENV_COMMAND: command not found" >&2 diff --git a/rbenv.d/exec/gem-rehash/rubygems_plugin.rb b/rbenv.d/exec/gem-rehash/rubygems_plugin.rb index 21d5ad9a..7ced31a9 100644 --- a/rbenv.d/exec/gem-rehash/rubygems_plugin.rb +++ b/rbenv.d/exec/gem-rehash/rubygems_plugin.rb @@ -6,13 +6,38 @@ hook = lambda do |installer| `rbenv rehash` end rescue - warn "rbenv: error in gem-rehash (#{$!})" + warn "rbenv: error in gem-rehash (#{$!.class.name}: #{$!.message})" end end -begin - Gem.post_install(&hook) - Gem.post_uninstall(&hook) -rescue - warn "rbenv: error installing gem-rehash hooks (#{$!})" +if defined?(Bundler::Installer) && Bundler::Installer.respond_to?(:install) && !Bundler::Installer.respond_to?(:install_without_rbenv_rehash) + Bundler::Installer.class_eval do + class << self + alias install_without_rbenv_rehash install + def install(root, definition, options = {}) + begin + if Gem.default_path.include?(Bundler.bundle_path.to_s) + bin_dir = Gem.bindir(Bundler.bundle_path.to_s) + bins_before = File.exist?(bin_dir) ? Dir.entries(bin_dir).size : 2 + end + rescue + warn "rbenv: error in Bundler post-install hook (#{$!.class.name}: #{$!.message})" + end + + result = install_without_rbenv_rehash(root, definition, options) + + if bin_dir && File.exist?(bin_dir) && Dir.entries(bin_dir).size > bins_before + `rbenv rehash` + end + result + end + end + end +else + begin + Gem.post_install(&hook) + Gem.post_uninstall(&hook) + rescue + warn "rbenv: error installing gem-rehash hooks (#{$!.class.name}: #{$!.message})" + end end diff --git a/test/--version.bats b/test/--version.bats index 4e0e452d..3d7ad5c7 100644 --- a/test/--version.bats +++ b/test/--version.bats @@ -6,6 +6,18 @@ setup() { mkdir -p "$HOME" git config --global user.name "Tester" git config --global user.email "tester@test.local" + + mkdir -p "${RBENV_TEST_DIR}/bin" + cat > "${RBENV_TEST_DIR}/bin/git" <&2 + exit 1 +else + exec $(which git) "\$@" +fi +CMD + chmod +x "${RBENV_TEST_DIR}/bin/git" } git_commit() { @@ -19,10 +31,25 @@ git_commit() { [[ $output == "rbenv 0."* ]] } +@test "doesn't read version from non-rbenv repo" { + mkdir -p "$RBENV_ROOT" + cd "$RBENV_ROOT" + git init + git remote add origin https://github.com/homebrew/homebrew.git + git_commit + git tag v1.0 + + cd "$RBENV_TEST_DIR" + run rbenv---version + assert_success + [[ $output == "rbenv 0."* ]] +} + @test "reads version from git repo" { mkdir -p "$RBENV_ROOT" cd "$RBENV_ROOT" git init + git remote add origin https://github.com/rbenv/rbenv.git git_commit git tag v0.4.1 git_commit @@ -38,6 +65,7 @@ git_commit() { mkdir -p "$RBENV_ROOT" cd "$RBENV_ROOT" git init + git remote add origin https://github.com/rbenv/rbenv.git git_commit cd "$RBENV_TEST_DIR" diff --git a/test/completions.bats b/test/completions.bats index 9091f082..6871cf5e 100644 --- a/test/completions.bats +++ b/test/completions.bats @@ -13,7 +13,7 @@ create_command() { create_command "rbenv-hello" "#!$BASH echo hello" run rbenv-completions hello - assert_success "" + assert_success "--help" } @test "command with completion support" { @@ -25,7 +25,11 @@ else exit 1 fi" run rbenv-completions hello - assert_success "hello" + assert_success + assert_output < .ruby-version + run rbenv-exec rspec + assert_failure "rbenv: version \`1.9' is not installed (set by $PWD/.ruby-version)" } @test "completes with names of executables" { @@ -29,6 +37,7 @@ create_executable() { run rbenv-completions exec assert_success assert_output </dev/null" + assert_line "command rbenv rehash 2>/dev/null" } @test "setup shell completions" { diff --git a/test/rbenv.bats b/test/rbenv.bats index 5b52adc1..4e6b32b0 100644 --- a/test/rbenv.bats +++ b/test/rbenv.bats @@ -4,8 +4,8 @@ load test_helper @test "blank invocation" { run rbenv - assert_success - assert [ "${lines[0]}" = "rbenv 0.4.0" ] + assert_failure + assert_line 0 "$(rbenv---version)" } @test "invalid command" { diff --git a/test/test_helper.bash b/test/test_helper.bash index 461bb085..b62cdc15 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -1,18 +1,20 @@ unset RBENV_VERSION unset RBENV_DIR -if enable -f "${BATS_TEST_DIRNAME}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; then - RBENV_TEST_DIR="$(realpath "$BATS_TMPDIR")/rbenv" -else - if [ -n "$RBENV_NATIVE_EXT" ]; then - echo "rbenv: failed to load \`realpath' builtin" >&2 - exit 1 - fi - RBENV_TEST_DIR="${BATS_TMPDIR}/rbenv" -fi - # guard against executing this block twice due to bats internals -if [ "$RBENV_ROOT" != "${RBENV_TEST_DIR}/root" ]; then +if [ -z "$RBENV_TEST_DIR" ]; then + RBENV_TEST_DIR="${BATS_TMPDIR}/rbenv" + export RBENV_TEST_DIR="$(mktemp -d "${RBENV_TEST_DIR}.XXX" 2>/dev/null || echo "$RBENV_TEST_DIR")" + + if enable -f "${BATS_TEST_DIRNAME}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; then + export RBENV_TEST_DIR="$(realpath "$RBENV_TEST_DIR")" + else + if [ -n "$RBENV_NATIVE_EXT" ]; then + echo "rbenv: failed to load \`realpath' builtin" >&2 + exit 1 + fi + fi + export RBENV_ROOT="${RBENV_TEST_DIR}/root" export HOME="${RBENV_TEST_DIR}/home" @@ -22,6 +24,9 @@ if [ "$RBENV_ROOT" != "${RBENV_TEST_DIR}/root" ]; then PATH="${BATS_TEST_DIRNAME}/libexec:$PATH" PATH="${RBENV_ROOT}/shims:$PATH" export PATH + + for xdg_var in `env 2>/dev/null | grep ^XDG_ | cut -d= -f1`; do unset "$xdg_var"; done + unset xdg_var fi teardown() { @@ -106,7 +111,7 @@ assert() { # but in which system utils necessary for rbenv operation are still available. path_without() { local exe="$1" - local path="${PATH}:" + local path=":${PATH}:" local found alt util for found in $(which -a "$exe"); do found="${found%/*}" @@ -118,8 +123,9 @@ path_without() { ln -s "${found}/$util" "${alt}/$util" fi done - path="${path/${found}:/${alt}:}" + path="${path/:${found}:/:${alt}:}" fi done + path="${path#:}" echo "${path%:}" } diff --git a/test/version-name.bats b/test/version-name.bats index bc633121..ef283283 100644 --- a/test/version-name.bats +++ b/test/version-name.bats @@ -68,7 +68,7 @@ setup() { @test "missing version" { RBENV_VERSION=1.2 run rbenv-version-name - assert_failure "rbenv: version \`1.2' is not installed" + assert_failure "rbenv: version \`1.2' is not installed (set by RBENV_VERSION environment variable)" } @test "version with prefix in name" { diff --git a/test/versions.bats b/test/versions.bats index 5d79ed5a..3273b375 100644 --- a/test/versions.bats +++ b/test/versions.bats @@ -139,3 +139,18 @@ OUT 1.8.7 OUT } + +@test "doesn't list symlink aliases when --skip-aliases" { + create_version "1.8.7" + ln -s "1.8.7" "${RBENV_ROOT}/versions/1.8" + mkdir moo + ln -s "${PWD}/moo" "${RBENV_ROOT}/versions/1.9" + + run rbenv-versions --bare --skip-aliases + assert_success + + assert_output <