1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-08 11:33:49 -05:00

Compare commits

...

13 Commits

Author SHA1 Message Date
Mislav Marohnić
84839ae589 rbenv 1.3.1 2025-01-08 00:00:16 +01:00
Mislav Marohnić
75aee988b3 Use static rbenv release version when generating man page 2025-01-07 23:59:22 +01:00
Mislav Marohnić
1d08efe089 Merge pull request #1604 from rbenv/readarray
Use readarray in bash v4+ to avoid rbenv init hanging
2025-01-07 23:52:57 +01:00
Mislav Marohnić
2e3ef01abb Use readarray in bash v4+ to avoid rbenv init hanging
For just a handful of people, rbenv init would hang indefinitely. Turning on
debugging output suggested that the `read` expression to split PATH into a bash
array was hanging, but I could never reproduce this myself. Instead, this uses
bash v4+ `readarray` if it's available, or falls back to bash v3 `read` with the
default DELIM being a newline character. This will cause a regression if any PATH
entries contain a literal newline character, but hopefully people are not relying
on such paths.
2025-01-07 23:40:54 +01:00
Mislav Marohnić
efeab7f8ee Merge pull request #1600 from mikelolasagasti/fix-127
Skip BW01 and BW02 error messages during tests
2024-12-11 18:47:21 +01:00
Mikel Olasagasti Uranga
e5c7eb3399 Skip BW01 and BW02 error messages during tests 2024-12-10 22:03:36 +01:00
Mislav Marohnić
a43095dc11 docs: further clarify the rbenv init command 2024-12-02 18:16:10 +01:00
Mislav Marohnić
4aa904634f Merge pull request #1598 from rbenv/dependabot/github_actions/mislav/bump-homebrew-formula-action-3.2
Bump mislav/bump-homebrew-formula-action from 3.1 to 3.2
2024-11-25 23:25:44 +01:00
dependabot[bot]
4a7d13d7ce Bump mislav/bump-homebrew-formula-action from 3.1 to 3.2
Bumps [mislav/bump-homebrew-formula-action](https://github.com/mislav/bump-homebrew-formula-action) from 3.1 to 3.2.
- [Release notes](https://github.com/mislav/bump-homebrew-formula-action/releases)
- [Commits](https://github.com/mislav/bump-homebrew-formula-action/compare/v3.1...v3.2)

---
updated-dependencies:
- dependency-name: mislav/bump-homebrew-formula-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 19:26:27 +00:00
Tom Schraitle
c335ab83de Add /usr/etc/rbenv.d to hooks path (#1587)
The directory /usr/etc is an optional directory and used by
Fedora, RHEL 9, and openSUSE. The purpose of /usr/etc is to store
distribution-provided configuration files that can be overridden
by user-modified files in /etc.

Also used in the sister project pyenv/pyenv#3039

Co-authored-by: Mislav Marohnić <git@mislav.net>
2024-08-27 16:10:43 +02:00
Mislav Marohnić
bf1fcd346b Merge pull request #1583 from nethad/patch-1
Add instructions for Fedora Linux installation
2024-07-16 02:46:42 +02:00
Thomas Ritter
873e0249a5 Fix numbering 2024-07-15 19:56:13 +02:00
Thomas Ritter
d6e547b94e Add instructions for Fedora installation 2024-07-15 19:52:50 +02:00
10 changed files with 52 additions and 17 deletions

View File

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

View File

@@ -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%=%) $<

View File

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

View File

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

View File

@@ -12,7 +12,7 @@
set -e
[ -n "$RBENV_DEBUG" ] && set -x
version="1.3.0"
version="1.3.1"
git_revision=""
if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q rbenv; then

View File

@@ -26,7 +26,12 @@ elif [ "$1" = "--no-sh" ]; then
shift
fi
IFS=: read -d '' -r -a paths <<<"$PATH" || true
if [ "$(type -t readarray)" = "builtin" ]; then
readarray -d : -t paths < <(printf "%s" "$PATH")
else
# bash 3.x compatibility
IFS=: read -r -a paths <<<"$PATH" || true
fi
shopt -s nullglob

View File

@@ -154,7 +154,12 @@ print_usage() {
if [ "$1" = "--complete-commands" ]; then
command_prefix="${2:-}"
seen=()
IFS=: read -d '' -r -a paths <<<"$PATH" || true
if [ "$(type -t readarray)" = "builtin" ]; then
readarray -d : -t paths < <(printf "%s" "$PATH")
else
# bash 3.x compatibility
IFS=: read -r -a paths <<<"$PATH" || true
fi
shopt -s nullglob
for path in "${paths[@]}"; do
for command in "${path}/rbenv-${command_prefix}"*; do

View File

@@ -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.1
.\" Language: English
.\"
.TH "RBENV" "1" "2023-11-08" "rbenv 1.3.0" "Rbenv Manual"
.TH "RBENV" "1" "2023-11-08" "rbenv 1.3.1" "Rbenv Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0

View File

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

View File

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