Selaa lähdekoodia

Report default or local version.

If no argument is passed to the default or local sub commands, report
the currently configured version.
pull/360/head^2
Graham Ashton 13 vuotta sitten
vanhempi
commit
1ed231cb21
4 muutettua tiedostoa jossa 30 lisäystä ja 15 poistoa
  1. +6
    -0
      README.md
  2. +11
    -7
      libexec/rbenv-default
  3. +2
    -2
      libexec/rbenv-help
  4. +11
    -6
      libexec/rbenv-local

+ 6
- 0
README.md Näytä tiedosto

@ -134,6 +134,9 @@ overridden by a per-project `.rbenv-version` file, or by setting the
The special version name `system` tells rbenv to use the system Ruby
(detected by searching your `$PATH`).
When run without a version number the currently configured default
version is reported.
### <a name="section_3.2"></a> 3.2 local
Sets a local per-project Ruby version by writing the version name to
@ -143,6 +146,9 @@ overrides the default, and can be overridden itself by setting the
$ rbenv local rbx-1.2.4
When run without a version number the currently configured local
version is reported.
### <a name="section_3.3"></a> 3.3 versions
Lists all Ruby versions known to rbenv, and shows an asterisk next to

+ 11
- 7
libexec/rbenv-default Näytä tiedosto

@ -1,12 +1,16 @@
#!/usr/bin/env bash -e
RBENV_VERSION="$1"
VERSION_FILE="${HOME}/.rbenv/default"
if [ -z "$RBENV_VERSION" ]; then
echo "usage: rbenv default VERSION" >&2
exit 1
fi
# Make sure the specified version is installed
rbenv-prefix "$RBENV_VERSION" >/dev/null
if [[ -e "$VERSION_FILE" ]]; then
cat "$VERSION_FILE"
else
echo "No default version configured - set with: rbenv default <version>"
fi
else
# Make sure the specified version is installed
rbenv-prefix "$RBENV_VERSION" >/dev/null
echo "$RBENV_VERSION" > "${HOME}/.rbenv/default"
echo "$RBENV_VERSION" > "$VERSION_FILE"
fi

+ 2
- 2
libexec/rbenv-help Näytä tiedosto

@ -22,8 +22,8 @@ case "$1" in
Some useful rbenv commands are:
commands List all commands
rehash Rehash rbenv shims (run this after installing binaries)
default Set the default Ruby version
local Set a local directory-specific Ruby version
default Set or show the default 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

+ 11
- 6
libexec/rbenv-local Näytä tiedosto

@ -1,12 +1,17 @@
#!/usr/bin/env bash -e
RBENV_VERSION="$1"
VERSION_FILE=".rbenv-version"
if [ -z "$RBENV_VERSION" ]; then
echo "usage: rbenv local VERSION" >&2
exit 1
fi
if [[ -e "$VERSION_FILE" ]]; then
cat "$VERSION_FILE"
else
echo "No local version configured - set with: rbenv local <version>"
fi
else
# Make sure the specified version is installed
rbenv-prefix "$RBENV_VERSION" >/dev/null
# Make sure the specified version is installed
rbenv-prefix "$RBENV_VERSION" >/dev/null
echo "$RBENV_VERSION" > "$VERSION_FILE"
fi
echo "$RBENV_VERSION" > .rbenv-version

Ladataan…
Peruuta
Tallenna