Merge pull request #1579 from rbenv/no-rehash-default
rbenv init in setup mode defaults to no auto-rehashing
This commit is contained in:
commit
19fa774e42
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Summary: Configure the shell environment for rbenv
|
# Summary: Configure the shell environment for rbenv
|
||||||
# Usage: rbenv init [--no-rehash] [<shells>...]
|
# Usage: rbenv init [<shells>...]
|
||||||
# rbenv init - [--no-rehash] [<shell>]
|
# rbenv init - [--no-rehash] [<shell>]
|
||||||
#
|
#
|
||||||
# Modifies shell initialization files to bootstrap rbenv functionality.
|
# Modifies shell initialization files to bootstrap rbenv functionality.
|
||||||
@ -110,7 +110,7 @@ if [ -z "$print" ]; then
|
|||||||
[ -n "$profile" ] || profile="$HOME/.bash_profile"
|
[ -n "$profile" ] || profile="$HOME/.bash_profile"
|
||||||
fi
|
fi
|
||||||
write_config "$profile" \
|
write_config "$profile" \
|
||||||
"eval \"\$($rbenv_command init -${no_rehash:+ --no-rehash} bash)\""
|
"eval \"\$($rbenv_command init - --no-rehash bash)\""
|
||||||
;;
|
;;
|
||||||
zsh )
|
zsh )
|
||||||
# check zshrc for backward compatibility with older rbenv init
|
# check zshrc for backward compatibility with older rbenv init
|
||||||
@ -120,7 +120,7 @@ if [ -z "$print" ]; then
|
|||||||
profile="${ZDOTDIR:-$HOME}/.zprofile"
|
profile="${ZDOTDIR:-$HOME}/.zprofile"
|
||||||
fi
|
fi
|
||||||
write_config "$profile" \
|
write_config "$profile" \
|
||||||
"eval \"\$($rbenv_command init -${no_rehash:+ --no-rehash} zsh)\""
|
"eval \"\$($rbenv_command init - --no-rehash zsh)\""
|
||||||
;;
|
;;
|
||||||
ksh | ksh93 | mksh )
|
ksh | ksh93 | mksh )
|
||||||
# There are two implementations of Korn shell: AT&T (ksh93) and Mir (mksh).
|
# There are two implementations of Korn shell: AT&T (ksh93) and Mir (mksh).
|
||||||
@ -133,7 +133,7 @@ if [ -z "$print" ]; then
|
|||||||
;;
|
;;
|
||||||
fish )
|
fish )
|
||||||
write_config "${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish" \
|
write_config "${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish" \
|
||||||
"status --is-interactive; and $rbenv_command init -${no_rehash:+ --no-rehash} fish | source"
|
"status --is-interactive; and $rbenv_command init - --no-rehash fish | source"
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
printf 'unsupported shell: "%s"\n' "$shell" >&2
|
printf 'unsupported shell: "%s"\n' "$shell" >&2
|
||||||
|
@ -57,7 +57,7 @@ OUT
|
|||||||
assert_success "writing ~/.bash_profile: now configured for rbenv."
|
assert_success "writing ~/.bash_profile: now configured for rbenv."
|
||||||
run cat ~/.bash_profile
|
run cat ~/.bash_profile
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
assert_line 'eval "$(rbenv init - bash)"'
|
assert_line 'eval "$(rbenv init - --no-rehash bash)"'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "set up bash (bashrc)" {
|
@test "set up bash (bashrc)" {
|
||||||
@ -68,7 +68,7 @@ OUT
|
|||||||
assert_success "writing ~/.bashrc: now configured for rbenv."
|
assert_success "writing ~/.bashrc: now configured for rbenv."
|
||||||
run cat ~/.bashrc
|
run cat ~/.bashrc
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
assert_line 'eval "$(rbenv init - bash)"'
|
assert_line 'eval "$(rbenv init - --no-rehash bash)"'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "set up zsh" {
|
@test "set up zsh" {
|
||||||
@ -78,7 +78,7 @@ OUT
|
|||||||
assert_success "writing ~/.zprofile: now configured for rbenv."
|
assert_success "writing ~/.zprofile: now configured for rbenv."
|
||||||
run cat ~/.zprofile
|
run cat ~/.zprofile
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
assert_line 'eval "$(rbenv init - zsh)"'
|
assert_line 'eval "$(rbenv init - --no-rehash zsh)"'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "set up zsh (zshrc)" {
|
@test "set up zsh (zshrc)" {
|
||||||
@ -89,7 +89,7 @@ OUT
|
|||||||
assert_success "writing ~/.zshrc: now configured for rbenv."
|
assert_success "writing ~/.zshrc: now configured for rbenv."
|
||||||
run cat ~/.zshrc
|
run cat ~/.zshrc
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
assert_line 'eval "$(rbenv init - zsh)"'
|
assert_line 'eval "$(rbenv init - --no-rehash zsh)"'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "set up fish" {
|
@test "set up fish" {
|
||||||
@ -97,7 +97,7 @@ OUT
|
|||||||
run rbenv-init fish
|
run rbenv-init fish
|
||||||
assert_success "writing ~/.config/fish/config.fish: now configured for rbenv."
|
assert_success "writing ~/.config/fish/config.fish: now configured for rbenv."
|
||||||
run cat ~/.config/fish/config.fish
|
run cat ~/.config/fish/config.fish
|
||||||
assert_line 'status --is-interactive; and rbenv init - fish | source'
|
assert_line 'status --is-interactive; and rbenv init - --no-rehash fish | source'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "set up multiple shells at once" {
|
@test "set up multiple shells at once" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user