mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-22 06:41:13 +00:00
Rename rbenv-default to rbenv-global
This commit is contained in:
parent
53d55eb08c
commit
5be66da9f4
9 changed files with 44 additions and 37 deletions
20
README.md
20
README.md
|
@ -8,7 +8,7 @@ tools that do one thing well.
|
|||
|
||||
### rbenv _does…_
|
||||
|
||||
* Let you **change the default Ruby version** on a per-user basis.
|
||||
* Let you **change the global Ruby version** on a per-user basis.
|
||||
* Provide support for **per-project Ruby versions**.
|
||||
* Allow you to **override the Ruby version** with an environment
|
||||
variable.
|
||||
|
@ -42,7 +42,7 @@ tools that do one thing well.
|
|||
* [1 How It Works](#section_1)
|
||||
* [2 Installation](#section_2)
|
||||
* [3 Usage](#section_3)
|
||||
* [3.1 default](#section_3.1)
|
||||
* [3.1 global](#section_3.1)
|
||||
* [3.2 local](#section_3.2)
|
||||
* [3.3 versions](#section_3.3)
|
||||
* [3.4 version](#section_3.4)
|
||||
|
@ -122,26 +122,26 @@ when installing a gem that provides a binary).
|
|||
Like `git`, the `rbenv` command delegates to subcommands based on its
|
||||
first argument. The most common subcommands are:
|
||||
|
||||
### <a name="section_3.1"></a> 3.1 default
|
||||
### <a name="section_3.1"></a> 3.1 global
|
||||
|
||||
Sets the default version of Ruby to be used in all shells by writing
|
||||
the version name to the `~/.rbenv/default` file. This version can be
|
||||
Sets the global version of Ruby to be used in all shells by writing
|
||||
the version name to the `~/.rbenv/global` file. This version can be
|
||||
overridden by a per-project `.rbenv-version` file, or by setting the
|
||||
`RBENV_VERSION` environment variable.
|
||||
|
||||
$ rbenv default 1.9.2-p290
|
||||
$ rbenv global 1.9.2-p290
|
||||
|
||||
The special version name `system` tells rbenv to use the system Ruby
|
||||
(detected by searching your `$PATH`).
|
||||
|
||||
When run without a version number, `rbenv default` reports the
|
||||
currently configured default version.
|
||||
When run without a version number, `rbenv global` reports the
|
||||
currently configured global version.
|
||||
|
||||
### <a name="section_3.2"></a> 3.2 local
|
||||
|
||||
Sets a local per-project Ruby version by writing the version name to
|
||||
an `.rbenv-version` file in the current directory. This version
|
||||
overrides the default, and can be overridden itself by setting the
|
||||
overrides the global, and can be overridden itself by setting the
|
||||
`RBENV_VERSION` environment variable.
|
||||
|
||||
$ rbenv local rbx-1.2.4
|
||||
|
@ -157,7 +157,7 @@ the currently active version.
|
|||
$ rbenv versions
|
||||
1.8.7-p352
|
||||
1.9.2-p290
|
||||
* 1.9.3-preview1 (set by /Users/sam/.rbenv/default)
|
||||
* 1.9.3-preview1 (set by /Users/sam/.rbenv/global)
|
||||
jruby-1.6.3
|
||||
rbx-1.2.4
|
||||
ree-1.8.7-2011.03
|
||||
|
|
|
@ -17,7 +17,7 @@ _rbenv() {
|
|||
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
case "$prev" in
|
||||
set-* | default | local | prefix )
|
||||
set-* | global | local | prefix )
|
||||
_rbenv_versions
|
||||
;;
|
||||
* )
|
||||
|
|
|
@ -14,7 +14,7 @@ _rbenv_versions() {
|
|||
|
||||
_rbenv() {
|
||||
case "$words[2]" in
|
||||
set-* | default | local | prefix ) _rbenv_versions ;;
|
||||
set-* | global | local | prefix ) _rbenv_versions ;;
|
||||
* ) _rbenv_commands ;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
RBENV_VERSION="$1"
|
||||
RBENV_VERSION_FILE="${HOME}/.rbenv/default"
|
||||
|
||||
if [ -n "$RBENV_VERSION" ]; then
|
||||
rbenv-version-file-write "$RBENV_VERSION_FILE" "$RBENV_VERSION"
|
||||
else
|
||||
rbenv-version-file-read "$RBENV_VERSION_FILE" || echo system
|
||||
fi
|
13
libexec/rbenv-global
Executable file
13
libexec/rbenv-global
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
RBENV_VERSION="$1"
|
||||
RBENV_VERSION_FILE="${HOME}/.rbenv/global"
|
||||
|
||||
if [ -n "$RBENV_VERSION" ]; then
|
||||
rbenv-version-file-write "$RBENV_VERSION_FILE" "$RBENV_VERSION"
|
||||
else
|
||||
rbenv-version-file-read "$RBENV_VERSION_FILE" ||
|
||||
rbenv-version-file-read "${HOME}/.rbenv/default" ||
|
||||
echo system
|
||||
fi
|
|
@ -22,7 +22,7 @@ case "$1" in
|
|||
Some useful rbenv commands are:
|
||||
commands List all commands
|
||||
rehash Rehash rbenv shims (run this after installing binaries)
|
||||
default Set or show the default Ruby version
|
||||
global Set or show the global Ruby version
|
||||
local Set or show the local directory-specific Ruby version
|
||||
version Show the current Ruby version
|
||||
versions List all Ruby versions known by rbenv
|
||||
|
@ -30,11 +30,11 @@ Some useful rbenv commands are:
|
|||
See 'rbenv help <command>' for more information on a specific command.
|
||||
For more information, see: https://github.com/sstephenson/rbenv#readme"
|
||||
;;
|
||||
default) echo "usage: rbenv default <version>
|
||||
global) echo "usage: rbenv global <version>
|
||||
|
||||
Sets the default Ruby version. You can override the default at any time
|
||||
by setting a directory-specific version with \`rbenv local' or by
|
||||
setting the RBENV_VERSION environment variable.
|
||||
Sets the global Ruby version. You can override the global version at
|
||||
any time by setting a directory-specific version with \`rbenv local'
|
||||
or by setting the RBENV_VERSION environment variable.
|
||||
|
||||
$(print_set_version)"
|
||||
;;
|
||||
|
@ -45,8 +45,8 @@ name to a file named '.rbenv-version'.
|
|||
|
||||
When you run a Ruby command, rbenv will look for an '.rbenv-version'
|
||||
file in the current directory and each parent directory. If no such
|
||||
file is found in the tree, rbenv will use the default Ruby version
|
||||
specified with \`rbenv default', or the version specified in the
|
||||
file is found in the tree, rbenv will use the global Ruby version
|
||||
specified with \`rbenv global', or the version specified in the
|
||||
RBENV_VERSION environment variable.
|
||||
|
||||
$(print_set_version)"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
{ echo "rbenv: warning: \`set-default' has been renamed to \`default'"
|
||||
{ echo "rbenv: warning: \`set-default' has been renamed to \`global'"
|
||||
echo " and will be removed in v0.3.0"
|
||||
echo
|
||||
} >&2
|
||||
|
||||
exec rbenv-default "$@"
|
||||
exec rbenv-global "$@"
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DEFAULT_PATH="${HOME}/.rbenv/default"
|
||||
|
||||
root="$(pwd)"
|
||||
while [ -n "$root" ]; do
|
||||
if [ -e "${root}/.rbenv-version" ]; then
|
||||
|
@ -12,4 +10,13 @@ while [ -n "$root" ]; do
|
|||
root="${root%/*}"
|
||||
done
|
||||
|
||||
echo "$DEFAULT_PATH"
|
||||
GLOBAL_PATH="${HOME}/.rbenv/global"
|
||||
DEFAULT_PATH="${HOME}/.rbenv/default"
|
||||
|
||||
if [ -e "$GLOBAL_PATH" ]; then
|
||||
echo "$GLOBAL_PATH"
|
||||
elif [ -e "$DEFAULT_PATH" ]; then
|
||||
echo "$DEFAULT_PATH"
|
||||
else
|
||||
echo "$GLOBAL_PATH"
|
||||
fi
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DEFAULT_PATH="${HOME}/.rbenv/default"
|
||||
|
||||
if [ -z "$RBENV_VERSION" ]; then
|
||||
RBENV_VERSION_FILE="$(rbenv-version-file)"
|
||||
RBENV_VERSION="$(rbenv-version-file-read "$RBENV_VERSION_FILE" || true)"
|
||||
|
|
Loading…
Reference in a new issue