1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-16 15:23:53 -05:00

Rename rbenv-default to rbenv-global

This commit is contained in:
Sam Stephenson
2011-08-18 14:32:33 -05:00
parent 53d55eb08c
commit 5be66da9f4
9 changed files with 44 additions and 37 deletions

View File

@@ -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
View 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

View File

@@ -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)"

View File

@@ -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 "$@"

View File

@@ -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

View File

@@ -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)"