mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-08 11:33:49 -05:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10e96bfc47 | ||
|
|
896e76c3d5 | ||
|
|
228fbf4c4f | ||
|
|
84839ae589 | ||
|
|
75aee988b3 | ||
|
|
1d08efe089 | ||
|
|
2e3ef01abb | ||
|
|
efeab7f8ee | ||
|
|
e5c7eb3399 | ||
|
|
a43095dc11 | ||
|
|
4aa904634f | ||
|
|
4a7d13d7ce | ||
|
|
c335ab83de | ||
|
|
bf1fcd346b | ||
|
|
873e0249a5 | ||
|
|
d6e547b94e |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -8,7 +8,7 @@ jobs:
|
||||
name: Bump Homebrew formula
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: mislav/bump-homebrew-formula-action@v3.1
|
||||
- uses: mislav/bump-homebrew-formula-action@v3.2
|
||||
if: "!contains(github.ref, '-')" # skip prereleases
|
||||
with:
|
||||
formula-name: rbenv
|
||||
|
||||
2
Makefile
2
Makefile
@@ -1,4 +1,4 @@
|
||||
release_version := $(shell git describe --tags)
|
||||
release_version := $(shell GIT_CEILING_DIRECTORIES=$(PWD) bin/rbenv --version | cut -d' ' -f2)
|
||||
|
||||
share/man/man1/rbenv.1: share/man/man1/rbenv.1.adoc
|
||||
asciidoctor -b manpage -a version=$(release_version:v%=%) $<
|
||||
|
||||
24
README.md
24
README.md
@@ -52,6 +52,14 @@ On systems with Homebrew package manager, the “Using Package Managers” metho
|
||||
rbenv and you can install it from the AUR using the instructions from this
|
||||
[wiki page](https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_and_upgrading_packages).
|
||||
|
||||
#### Fedora
|
||||
|
||||
Fedora has an [official package](https://packages.fedoraproject.org/pkgs/rbenv/rbenv/) which you can install:
|
||||
|
||||
```sh
|
||||
sudo dnf install rbenv
|
||||
```
|
||||
|
||||
2. Set up your shell to load rbenv.
|
||||
|
||||
```sh
|
||||
@@ -280,7 +288,20 @@ name | default | description
|
||||
|
||||
### How rbenv hooks into your shell
|
||||
|
||||
`rbenv init` is a helper command to bootstrap rbenv into a shell. This helper is part of the recommended installation instructions, but optional, as an advanced user can set up the following tasks manually. Here is what the command does when its output is `eval`'d by a shell during its startup:
|
||||
`rbenv init` is a helper command to hook rbenv into a shell. This helper is part of the recommended installation instructions, but optional, as an experienced user can set up the following tasks manually. The `rbenv init` command has two modes of operation:
|
||||
|
||||
1. `rbenv init`: made for humans, this command edits your shell initialization files on disk to add rbenv to shell startup. (Prior to rbenv 1.3.0, this mode only printed user instructions to the terminal, but did nothing else.)
|
||||
|
||||
2. `rbenv init -`: made for machines, this command outputs a shell script suitable to be eval'd by the user's shell.
|
||||
|
||||
When `rbenv init` is invoked from a bash shell, for example, it will add the following to the user's `~/.bashrc` or `~/.bash_profile`:
|
||||
|
||||
```sh
|
||||
# Added by `rbenv init` on <DATE>
|
||||
eval "$(rbenv init - --no-rehash bash)"
|
||||
```
|
||||
|
||||
You may add this line to your shell initialization files manually if you want to avoid running `rbenv init` as part of the setup process. Here is what the eval'd script does:
|
||||
|
||||
0. Adds `rbenv` executable to PATH if necessary.
|
||||
|
||||
@@ -292,7 +313,6 @@ name | default | description
|
||||
|
||||
4. Installs the "sh" dispatcher. This bit is also optional, but allows rbenv and plugins to change variables in your current shell, making commands like `rbenv shell` possible.
|
||||
|
||||
You can run `rbenv init -` for yourself to inspect the generated script.
|
||||
|
||||
### Uninstalling rbenv
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ if [ ! "${libexec_dir%/*}"/rbenv.d -ef "$RBENV_ROOT"/rbenv.d ]; then
|
||||
# Add rbenv's own `rbenv.d` unless rbenv was cloned to RBENV_ROOT
|
||||
RBENV_HOOK_PATH="${RBENV_HOOK_PATH}:${libexec_dir%/*}/rbenv.d"
|
||||
fi
|
||||
RBENV_HOOK_PATH="${RBENV_HOOK_PATH}:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks"
|
||||
RBENV_HOOK_PATH="${RBENV_HOOK_PATH}:/usr/etc/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks"
|
||||
for plugin_hook in "${RBENV_ROOT}/plugins/"*/etc/rbenv.d; do
|
||||
RBENV_HOOK_PATH="${RBENV_HOOK_PATH}:${plugin_hook}"
|
||||
done
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
set -e
|
||||
[ -n "$RBENV_DEBUG" ] && set -x
|
||||
|
||||
version="1.3.0"
|
||||
version="1.3.2"
|
||||
git_revision=""
|
||||
|
||||
if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q rbenv; then
|
||||
|
||||
@@ -18,32 +18,33 @@ if [ "$1" = "--complete" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
exclude_shell=
|
||||
command_prefix="rbenv-"
|
||||
|
||||
if [ "$1" = "--sh" ]; then
|
||||
sh=1
|
||||
command_prefix="rbenv-sh-"
|
||||
shift
|
||||
elif [ "$1" = "--no-sh" ]; then
|
||||
nosh=1
|
||||
exclude_shell=1
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=: read -d '' -r -a paths <<<"$PATH" || true
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
{ for path in "${paths[@]}"; do
|
||||
for command in "${path}/rbenv-"*; do
|
||||
command="${command##*rbenv-}"
|
||||
if [ -n "$sh" ]; then
|
||||
if [ "${command:0:3}" = "sh-" ]; then
|
||||
echo "${command##sh-}"
|
||||
{
|
||||
PATH_remain="$PATH"
|
||||
# traverse PATH to find "rbenv-" prefixed commands
|
||||
while true; do
|
||||
path="${PATH_remain%%:*}"
|
||||
if [ -n "$path" ]; then
|
||||
for rbenv_command in "${path}/${command_prefix}"*; do
|
||||
rbenv_command="${rbenv_command##*rbenv-}"
|
||||
if [[ -z $exclude_shell || $rbenv_command != sh-* ]]; then
|
||||
echo "${rbenv_command##sh-}"
|
||||
fi
|
||||
elif [ -n "$nosh" ]; then
|
||||
if [ "${command:0:3}" != "sh-" ]; then
|
||||
echo "${command##sh-}"
|
||||
fi
|
||||
else
|
||||
echo "${command##sh-}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
[[ $PATH_remain == *:* ]] || break
|
||||
PATH_remain="${PATH_remain#*:}"
|
||||
done
|
||||
} | sort | uniq
|
||||
|
||||
@@ -154,20 +154,27 @@ print_usage() {
|
||||
if [ "$1" = "--complete-commands" ]; then
|
||||
command_prefix="${2:-}"
|
||||
seen=()
|
||||
IFS=: read -d '' -r -a paths <<<"$PATH" || true
|
||||
shopt -s nullglob
|
||||
for path in "${paths[@]}"; do
|
||||
for command in "${path}/rbenv-${command_prefix}"*; do
|
||||
command_name="${command##*/}"
|
||||
command_name="${command_name#rbenv-}"
|
||||
command_name="${command_name#sh-}"
|
||||
[[ " ${seen[*]} " != *" ${command_name} "* ]] || continue
|
||||
seen+=("$command_name")
|
||||
summary=""
|
||||
eval "$(extract_initial_comment_block < "$command" | collect_documentation)"
|
||||
[ -n "$summary" ] || continue
|
||||
printf "%s:%s\n" "$command_name" "$summary"
|
||||
done
|
||||
PATH_remain="$PATH"
|
||||
# traverse PATH to find "rbenv-" prefixed commands
|
||||
while true; do
|
||||
path="${PATH_remain%%:*}"
|
||||
if [ -n "$path" ]; then
|
||||
for rbenv_command in "${path}/rbenv-"*; do
|
||||
command_name="${rbenv_command##*/}"
|
||||
command_name="${command_name#rbenv-}"
|
||||
command_name="${command_name#sh-}"
|
||||
[[ $command_name == "${command_prefix}"* ]] || continue
|
||||
[[ " ${seen[*]} " != *" ${command_name} "* ]] || continue
|
||||
seen+=("$command_name")
|
||||
summary=""
|
||||
eval "$(extract_initial_comment_block < "$rbenv_command" | collect_documentation)"
|
||||
[ -n "$summary" ] || continue
|
||||
printf "%s:%s\n" "$command_name" "$summary"
|
||||
done
|
||||
fi
|
||||
[[ $PATH_remain == *:* ]] || break
|
||||
PATH_remain="${PATH_remain#*:}"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
4
share/man/man1/rbenv.1
generated
4
share/man/man1/rbenv.1
generated
@@ -4,10 +4,10 @@
|
||||
.\" Generator: Asciidoctor 2.0.20
|
||||
.\" Date: 2023-11-08
|
||||
.\" Manual: Rbenv Manual
|
||||
.\" Source: rbenv 1.3.0
|
||||
.\" Source: rbenv 1.3.2
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "RBENV" "1" "2023-11-08" "rbenv 1.3.0" "Rbenv Manual"
|
||||
.TH "RBENV" "1" "2023-11-08" "rbenv 1.3.2" "Rbenv Manual"
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.ss \n[.ss] 0
|
||||
|
||||
@@ -64,7 +64,7 @@ load test_helper
|
||||
@test "RBENV_HOOK_PATH includes etc/rbenv.d folders" {
|
||||
mkdir -p "$RBENV_ROOT"/plugins/rbenv-foo/etc/rbenv.d
|
||||
run rbenv echo -F: "RBENV_HOOK_PATH"
|
||||
assert_line 6 "${RBENV_ROOT}/plugins/rbenv-foo/etc/rbenv.d"
|
||||
assert_line 7 "${RBENV_ROOT}/plugins/rbenv-foo/etc/rbenv.d"
|
||||
}
|
||||
|
||||
@test "RBENV_HOOK_PATH preserves value from environment" {
|
||||
@@ -78,5 +78,5 @@ load test_helper
|
||||
@test "RBENV_HOOK_PATH includes rbenv built-in plugins" {
|
||||
unset RBENV_HOOK_PATH
|
||||
run rbenv echo "RBENV_HOOK_PATH"
|
||||
assert_success "${RBENV_ROOT}/rbenv.d:${BATS_TEST_DIRNAME%/*}/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks"
|
||||
assert_success "${RBENV_ROOT}/rbenv.d:${BATS_TEST_DIRNAME%/*}/rbenv.d:/usr/etc/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks"
|
||||
}
|
||||
|
||||
@@ -57,11 +57,12 @@ create_executable() {
|
||||
}
|
||||
|
||||
@test "doesn't include current directory in PATH search" {
|
||||
bats_require_minimum_version 1.5.0
|
||||
mkdir -p "$RBENV_TEST_DIR"
|
||||
cd "$RBENV_TEST_DIR"
|
||||
touch kill-all-humans
|
||||
chmod +x kill-all-humans
|
||||
PATH="$(path_without "kill-all-humans")" RBENV_VERSION=system run rbenv-which kill-all-humans
|
||||
PATH="$(path_without "kill-all-humans")" RBENV_VERSION=system run -127 rbenv-which kill-all-humans
|
||||
assert_failure "rbenv: kill-all-humans: command not found"
|
||||
}
|
||||
|
||||
@@ -72,22 +73,25 @@ create_executable() {
|
||||
}
|
||||
|
||||
@test "no executable found" {
|
||||
bats_require_minimum_version 1.5.0
|
||||
create_executable "1.8" "rspec"
|
||||
RBENV_VERSION=1.8 run rbenv-which rake
|
||||
RBENV_VERSION=1.8 run -127 rbenv-which rake
|
||||
assert_failure "rbenv: rake: command not found"
|
||||
}
|
||||
|
||||
@test "no executable found for system version" {
|
||||
PATH="$(path_without "rake")" RBENV_VERSION=system run rbenv-which rake
|
||||
bats_require_minimum_version 1.5.0
|
||||
PATH="$(path_without "rake")" RBENV_VERSION=system run -127 rbenv-which rake
|
||||
assert_failure "rbenv: rake: command not found"
|
||||
}
|
||||
|
||||
@test "executable found in other versions" {
|
||||
bats_require_minimum_version 1.5.0
|
||||
create_executable "1.8" "ruby"
|
||||
create_executable "1.9" "rspec"
|
||||
create_executable "2.0" "rspec"
|
||||
|
||||
RBENV_VERSION=1.8 run rbenv-which rspec
|
||||
RBENV_VERSION=1.8 run -127 rbenv-which rspec
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
rbenv: rspec: command not found
|
||||
@@ -99,9 +103,10 @@ OUT
|
||||
}
|
||||
|
||||
@test "executable not found in user gems" {
|
||||
bats_require_minimum_version 1.5.0
|
||||
create_executable "2.7.6" "ruby"
|
||||
create_executable "${HOME}/.gem/ruby/2.7.0/bin" "rake"
|
||||
GEM_HOME='' RBENV_VERSION=2.7.6 run rbenv-which rake
|
||||
GEM_HOME='' RBENV_VERSION=2.7.6 run -127 rbenv-which rake
|
||||
assert_failure
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user