Compare commits

..

4 Commits

Author SHA1 Message Date
Jordan Harband
0641363102
[Tests] install.sh: clean up nvm_detect_profile tests 2024-11-08 10:52:41 +00:00
Jordan Harband
9659af6c16
[Tests] nvm_detect_profile: refactor 2024-11-12 13:31:36 -08:00
menaechmi
abd02e5aae
[Fix] install.sh: fix failing install tests (#3458) 2024-11-12 11:57:02 -06:00
menaechmi
3de0b15810
[Tests] run urchin tests on pull requests 2024-11-12 12:58:53 -06:00
3 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
name: urchin tests name: urchin tests
on: [push] on: [push, pull_request]
permissions: permissions:
contents: read contents: read

View File

@ -306,7 +306,7 @@ nvm_detect_profile() {
if [ -z "$DETECTED_PROFILE" ]; then if [ -z "$DETECTED_PROFILE" ]; then
for EACH_PROFILE in ".profile" ".bashrc" ".bash_profile" ".zprofile" ".zshrc" for EACH_PROFILE in ".profile" ".bashrc" ".bash_profile" ".zprofile" ".zshrc"
do do
if DETECTED_PROFILE="$(nvm_try_profile "${HOME}/${EACH_PROFILE}")"; then if DETECTED_PROFILE="$(nvm_try_profile "${ZDOTDIR:-${HOME}}/${EACH_PROFILE}")"; then
break break
fi fi
done done

View File

@ -23,7 +23,7 @@ cleanup () {
unset -f setup cleanup die unset -f setup cleanup die
unset ZDOTDIR unset ZDOTDIR
rm -f ".bashrc" ".bash_profile" ".zprofile" ".zshrc" ".profile" "test_profile" > "/dev/null" 2>&1 rm -f ".bashrc" ".bash_profile" ".zprofile" ".zshrc" ".profile" "test_profile" > "/dev/null" 2>&1
rm -rf zdot>&1 rm -rf zdotdir 2>&1
} }
die () { echo "$@" '$NVM_DETECT_PROFILE:' "$NVM_DETECT_PROFILE"; cleanup; exit 1; } die () { echo "$@" '$NVM_DETECT_PROFILE:' "$NVM_DETECT_PROFILE"; cleanup; exit 1; }
@ -94,21 +94,21 @@ fi
# #
# It should favor .profile if file exists # It should favor .profile if file exists
NVM_DETECT_PROFILE="$(SHELL= nvm_detect_profile)" NVM_DETECT_PROFILE="$(SHELL= ZDOTDIR= nvm_detect_profile)"
if [ "$NVM_DETECT_PROFILE" != "$HOME/.profile" ]; then if [ "$NVM_DETECT_PROFILE" != "$HOME/.profile" ]; then
die "nvm_detect_profile should have selected .profile; got $NVM_DETECT_PROFILE" die "nvm_detect_profile should have selected .profile; got $NVM_DETECT_PROFILE"
fi fi
# Otherwise, it should favor .bashrc if file exists # Otherwise, it should favor .bashrc if file exists
rm ".profile" rm ".profile"
NVM_DETECT_PROFILE="$(SHELL= nvm_detect_profile)" NVM_DETECT_PROFILE="$(SHELL= ZDOTDIR= nvm_detect_profile)"
if [ "$NVM_DETECT_PROFILE" != "$HOME/.bashrc" ]; then if [ "$NVM_DETECT_PROFILE" != "$HOME/.bashrc" ]; then
die "nvm_detect_profile should have selected .bashrc; got $NVM_DETECT_PROFILE" die "nvm_detect_profile should have selected .bashrc; got $NVM_DETECT_PROFILE"
fi fi
# Otherwise, it should favor .bash_profile if file exists # Otherwise, it should favor .bash_profile if file exists
rm ".bashrc" rm ".bashrc"
NVM_DETECT_PROFILE="$(SHELL= nvm_detect_profile)" NVM_DETECT_PROFILE="$(SHELL= ZDOTDIR= nvm_detect_profile)"
if [ "$NVM_DETECT_PROFILE" != "$HOME/.bash_profile" ]; then if [ "$NVM_DETECT_PROFILE" != "$HOME/.bash_profile" ]; then
die "nvm_detect_profile should have selected .bash_profile; got $NVM_DETECT_PROFILE" die "nvm_detect_profile should have selected .bash_profile; got $NVM_DETECT_PROFILE"
fi fi