Document rbenv which and rbenv whence

This commit is contained in:
Sam Stephenson 2011-09-28 10:48:04 -05:00
parent 058e2cb7a6
commit ada26ab92e
3 changed files with 64 additions and 15 deletions

View file

@ -48,6 +48,8 @@ tools that do one thing well.
* [3.4 rbenv versions](#section_3.4) * [3.4 rbenv versions](#section_3.4)
* [3.5 rbenv version](#section_3.5) * [3.5 rbenv version](#section_3.5)
* [3.6 rbenv rehash](#section_3.6) * [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 Contributing](#section_4)
* [4.1 License](#section_4.1) * [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 operates on the per-user directory `~/.rbenv`. Version names in
rbenv correspond to subdirectories of `~/.rbenv/versions`. For rbenv correspond to subdirectories of `~/.rbenv/versions`. For
example, you might have `~/.rbenv/versions/1.8.7-p354` and 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 Each version is a working tree with its own binaries, like
`~/.rbenv/versions/1.8.7-p354/bin/ruby` and `~/.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. for every such binary across all installed versions of Ruby.
These shims are simple wrapper scripts that live in `~/.rbenv/shims` 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 $ 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 $ 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 environment variable in your shell. This version overrides both
project-specific versions and the global version. 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 When run without a version number, `rbenv shell` reports the current
value of `RBENV_VERSION`. You can also unset the shell version: 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 prefer not to use shell integration, you may simply set the
`RBENV_VERSION` variable yourself: `RBENV_VERSION` variable yourself:
$ export RBENV_VERSION=jruby-1.6.3 $ export RBENV_VERSION=jruby-1.6.4
### <a name="section_3.4"></a> 3.4 rbenv versions ### <a name="section_3.4"></a> 3.4 rbenv versions
@ -190,8 +193,8 @@ the currently active version.
$ rbenv versions $ rbenv versions
1.8.7-p352 1.8.7-p352
1.9.2-p290 1.9.2-p290
* 1.9.3-preview1 (set by /Users/sam/.rbenv/global) * 1.9.3-rc1 (set by /Users/sam/.rbenv/global)
jruby-1.6.3 jruby-1.6.4
rbx-1.2.4 rbx-1.2.4
ree-1.8.7-2011.03 ree-1.8.7-2011.03
@ -211,6 +214,23 @@ version of Ruby, or install a gem that provides binaries.
$ rbenv rehash $ rbenv rehash
### <a name="section_3.7"></a> 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
### <a name="section_3.8"></a> 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
## <a name="section_4"></a> 4 Contributing ## <a name="section_4"></a> 4 Contributing
The rbenv source code is [hosted on The rbenv source code is [hosted on

View file

@ -44,11 +44,11 @@ tools that do one thing well.
rbenv operates on the per-user directory `~/.rbenv`. Version names in rbenv operates on the per-user directory `~/.rbenv`. Version names in
rbenv correspond to subdirectories of `~/.rbenv/versions`. For rbenv correspond to subdirectories of `~/.rbenv/versions`. For
example, you might have `~/.rbenv/versions/1.8.7-p354` and 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 Each version is a working tree with its own binaries, like
`~/.rbenv/versions/1.8.7-p354/bin/ruby` and `~/.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. for every such binary across all installed versions of Ruby.
These shims are simple wrapper scripts that live in `~/.rbenv/shims` 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 $ 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 $ 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 environment variable in your shell. This version overrides both
project-specific versions and the global version. 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 When run without a version number, `rbenv shell` reports the current
value of `RBENV_VERSION`. You can also unset the shell version: 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 prefer not to use shell integration, you may simply set the
`RBENV_VERSION` variable yourself: `RBENV_VERSION` variable yourself:
$ export RBENV_VERSION=jruby-1.6.3 $ export RBENV_VERSION=jruby-1.6.4
### rbenv versions ### ### rbenv versions ###
@ -178,8 +179,8 @@ the currently active version.
$ rbenv versions $ rbenv versions
1.8.7-p352 1.8.7-p352
1.9.2-p290 1.9.2-p290
* 1.9.3-preview1 (set by /Users/sam/.rbenv/global) * 1.9.3-rc1 (set by /Users/sam/.rbenv/global)
jruby-1.6.3 jruby-1.6.4
rbx-1.2.4 rbx-1.2.4
ree-1.8.7-2011.03 ree-1.8.7-2011.03
@ -199,6 +200,23 @@ version of Ruby, or install a gem that provides binaries.
$ rbenv rehash $ 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 ## ## Contributing ##
The rbenv source code is [hosted on The rbenv source code is [hosted on

View file

@ -21,13 +21,15 @@ case "$1" in
"") echo "usage: rbenv <command> [<args>] "") echo "usage: rbenv <command> [<args>]
Some useful rbenv commands are: Some useful rbenv commands are:
commands List all commands commands List all rbenv commands
rehash Rehash rbenv shims (run this after installing binaries) rehash Rehash rbenv shims (run this after installing binaries)
global Set or show the global Ruby version global Set or show the global Ruby version
local Set or show the local directory-specific Ruby version local Set or show the local directory-specific Ruby version
shell Set or show the shell-specific Ruby version shell Set or show the shell-specific Ruby version
version Show the current Ruby version version Show the current Ruby version
versions List all Ruby versions known by rbenv 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 <command>' for more information on a specific command. See 'rbenv help <command>' for more information on a specific command.
For more information, see: https://github.com/sstephenson/rbenv#readme" For more information, see: https://github.com/sstephenson/rbenv#readme"
@ -63,5 +65,14 @@ project-specific versions and the global version.
$(print_set_version)" $(print_set_version)"
;; ;;
which) echo "usage: rbenv which <command>
Displays the full path to the binary that rbenv will execute when you
run the given command."
;;
whence) echo "usage: rbenv whence <command>
Lists all Ruby versions with the given command installed."
;;
*) echo "No command arguments needed or invalid/undocumented command." *) echo "No command arguments needed or invalid/undocumented command."
esac esac