From ada26ab92e52b87f978be8b4744355a3c8821444 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Wed, 28 Sep 2011 10:48:04 -0500 Subject: [PATCH] Document `rbenv which` and `rbenv whence` --- README.md | 34 +++++++++++++++++++++++++++------- doc/README.mdtoc | 32 +++++++++++++++++++++++++------- libexec/rbenv-help | 13 ++++++++++++- 3 files changed, 64 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 31c2647..a72c14f 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ tools that do one thing well. * [3.4 rbenv versions](#section_3.4) * [3.5 rbenv version](#section_3.5) * [3.6 rbenv rehash](#section_3.6) + * [3.7 rbenv which](#section_3.7) + * [3.8 rbenv whence](#section_3.8) * [4 Contributing](#section_4) * [4.1 License](#section_4.1) @@ -56,11 +58,11 @@ tools that do one thing well. rbenv operates on the per-user directory `~/.rbenv`. Version names in rbenv correspond to subdirectories of `~/.rbenv/versions`. For example, you might have `~/.rbenv/versions/1.8.7-p354` and -`~/.rbenv/versions/1.9.3-preview1`. +`~/.rbenv/versions/1.9.3-rc1`. Each version is a working tree with its own binaries, like `~/.rbenv/versions/1.8.7-p354/bin/ruby` and -`~/.rbenv/versions/1.9.3-preview1/irb`. rbenv makes _shim binaries_ +`~/.rbenv/versions/1.9.3-rc1/bin/irb`. rbenv makes _shim binaries_ for every such binary across all installed versions of Ruby. These shims are simple wrapper scripts that live in `~/.rbenv/shims` @@ -104,7 +106,8 @@ zsh users should add this line to `.zshrc` instead: $ echo 'eval "$(rbenv init -)"' >> .zshrc -4. Restart your shell. You can now begin using rbenv. +4. Restart your shell so the path changes take effect. You can now +begin using rbenv. $ exec $SHELL @@ -168,7 +171,7 @@ Sets a shell-specific Ruby version by setting the `RBENV_VERSION` environment variable in your shell. This version overrides both project-specific versions and the global version. - $ rbenv shell jruby-1.6.3 + $ rbenv shell jruby-1.6.4 When run without a version number, `rbenv shell` reports the current value of `RBENV_VERSION`. You can also unset the shell version: @@ -180,7 +183,7 @@ the installation instructions) in order to use this command. If you prefer not to use shell integration, you may simply set the `RBENV_VERSION` variable yourself: - $ export RBENV_VERSION=jruby-1.6.3 + $ export RBENV_VERSION=jruby-1.6.4 ### 3.4 rbenv versions @@ -190,8 +193,8 @@ the currently active version. $ rbenv versions 1.8.7-p352 1.9.2-p290 - * 1.9.3-preview1 (set by /Users/sam/.rbenv/global) - jruby-1.6.3 + * 1.9.3-rc1 (set by /Users/sam/.rbenv/global) + jruby-1.6.4 rbx-1.2.4 ree-1.8.7-2011.03 @@ -211,6 +214,23 @@ version of Ruby, or install a gem that provides binaries. $ rbenv rehash +### 3.7 rbenv which + +Displays the full path to the binary that rbenv will execute when you +run the given command. + + $ rbenv which irb + /Users/sam/.rbenv/versions/1.9.2-p290/bin/irb + +### 3.8 rbenv whence + +Lists all Ruby versions with the given command installed. + + $ rbenv whence rackup + 1.9.3-rc1 + jruby-1.6.4 + ree-1.8.7-2011.03 + ## 4 Contributing The rbenv source code is [hosted on diff --git a/doc/README.mdtoc b/doc/README.mdtoc index d75bdd1..956e314 100644 --- a/doc/README.mdtoc +++ b/doc/README.mdtoc @@ -44,11 +44,11 @@ tools that do one thing well. rbenv operates on the per-user directory `~/.rbenv`. Version names in rbenv correspond to subdirectories of `~/.rbenv/versions`. For example, you might have `~/.rbenv/versions/1.8.7-p354` and -`~/.rbenv/versions/1.9.3-preview1`. +`~/.rbenv/versions/1.9.3-rc1`. Each version is a working tree with its own binaries, like `~/.rbenv/versions/1.8.7-p354/bin/ruby` and -`~/.rbenv/versions/1.9.3-preview1/irb`. rbenv makes _shim binaries_ +`~/.rbenv/versions/1.9.3-rc1/bin/irb`. rbenv makes _shim binaries_ for every such binary across all installed versions of Ruby. These shims are simple wrapper scripts that live in `~/.rbenv/shims` @@ -92,7 +92,8 @@ zsh users should add this line to `.zshrc` instead: $ echo 'eval "$(rbenv init -)"' >> .zshrc -4. Restart your shell. You can now begin using rbenv. +4. Restart your shell so the path changes take effect. You can now +begin using rbenv. $ exec $SHELL @@ -156,7 +157,7 @@ Sets a shell-specific Ruby version by setting the `RBENV_VERSION` environment variable in your shell. This version overrides both project-specific versions and the global version. - $ rbenv shell jruby-1.6.3 + $ rbenv shell jruby-1.6.4 When run without a version number, `rbenv shell` reports the current value of `RBENV_VERSION`. You can also unset the shell version: @@ -168,7 +169,7 @@ the installation instructions) in order to use this command. If you prefer not to use shell integration, you may simply set the `RBENV_VERSION` variable yourself: - $ export RBENV_VERSION=jruby-1.6.3 + $ export RBENV_VERSION=jruby-1.6.4 ### rbenv versions ### @@ -178,8 +179,8 @@ the currently active version. $ rbenv versions 1.8.7-p352 1.9.2-p290 - * 1.9.3-preview1 (set by /Users/sam/.rbenv/global) - jruby-1.6.3 + * 1.9.3-rc1 (set by /Users/sam/.rbenv/global) + jruby-1.6.4 rbx-1.2.4 ree-1.8.7-2011.03 @@ -199,6 +200,23 @@ version of Ruby, or install a gem that provides binaries. $ rbenv rehash +### rbenv which ### + +Displays the full path to the binary that rbenv will execute when you +run the given command. + + $ rbenv which irb + /Users/sam/.rbenv/versions/1.9.2-p290/bin/irb + +### rbenv whence ### + +Lists all Ruby versions with the given command installed. + + $ rbenv whence rackup + 1.9.3-rc1 + jruby-1.6.4 + ree-1.8.7-2011.03 + ## Contributing ## The rbenv source code is [hosted on diff --git a/libexec/rbenv-help b/libexec/rbenv-help index d0ead2c..ff0a1d7 100755 --- a/libexec/rbenv-help +++ b/libexec/rbenv-help @@ -21,13 +21,15 @@ case "$1" in "") echo "usage: rbenv [] Some useful rbenv commands are: - commands List all commands + commands List all rbenv commands rehash Rehash rbenv shims (run this after installing binaries) global Set or show the global Ruby version local Set or show the local directory-specific Ruby version shell Set or show the shell-specific Ruby version version Show the current Ruby version versions List all Ruby versions known by rbenv + which Show the full path for the given Ruby command + whence List all Ruby versions with the given command See 'rbenv help ' for more information on a specific command. For more information, see: https://github.com/sstephenson/rbenv#readme" @@ -63,5 +65,14 @@ project-specific versions and the global version. $(print_set_version)" ;; +which) echo "usage: rbenv which + +Displays the full path to the binary that rbenv will execute when you +run the given command." +;; +whence) echo "usage: rbenv whence + +Lists all Ruby versions with the given command installed." +;; *) echo "No command arguments needed or invalid/undocumented command." esac