Compare commits

...

3 Commits

Author SHA1 Message Date
Sladyn
3dfb250814
Merge c04530396e492c3cba8520e9106c124370063d66 into 762f9ef9d17623b45095e8ca1a996c8928f3f424 2024-07-07 21:07:50 +09:00
Jordan Harband
762f9ef9d1
[Tests] only install python 2.7 if not already installed
See ee6f7667 / #3067
2024-07-06 10:29:55 -05:00
Sladyn Nunes
c04530396e
Add check to nvm profile for nvm path 2021-03-18 17:21:05 +05:30
2 changed files with 42 additions and 1 deletions

View File

@ -32,7 +32,7 @@ before_install:
- zsh --version
- dpkg -s dash | grep ^Version | awk '{print $2}'
# install python
- pyenv install 2.7.18
- pyenv local 2.7.18 || pyenv install 2.7.18
- pyenv local 2.7.18 || echo 'pyenv failed'
- python -V
install:

View File

@ -0,0 +1,41 @@
#!/bin/sh
setup () {
HOME="."
NVM_ENV=testing \. ../../install.sh
touch ".bashrc"
touch ".zshrc"
touch ".profile"
}
cleanup () {
unset HOME
unset NVM_ENV
unset NVM_DETECT_PROFILE
unset BASH_VERSION
unset ZSH_VERSION
unset -f setup cleanup die
rm -f ".bashrc" ".bash_profile" ".zshrc" ".profile" "test_profile" > "/dev/null" 2>&1
}
die () { echo "$@" '$NVM_DETECT_PROFILE:' "$NVM_DETECT_PROFILE"; cleanup; exit 1; }
setup
# check if nvm_path already exists in bashrc
NVM_DETECT_PROFILE="$(BASH_VERSION="1"; unset PROFILE; nvm_detect_profile)"
echo "export NVM_DIR="$HOME/.nvm"" > $HOME/.bashrc
OUTPUT = "$(nvm_do_install)"
EXPECTED_OUTPUT='nvm source string already in ${NVM_PROFILE}'
if [ "${OUTPUT#*$EXPECTED_OUTPUT}" = "${OUTPUT}" ]; then
die "Path already exists in the profile, so should have returned >${EXPECTED_OUTPUT}<. Instead it returned >${OUTPUT}<"
fi
# .zshrc should be detected for zsh
NVM_DETECT_PROFILE="$(ZSH_VERSION="1"; unset PROFILE; unset BASH_VERSION; nvm_detect_profile)"
echo "export NVM_DIR="$HOME/.nvm"" > $HOME/.zshrc
OUTPUT = "$(nvm_do_install)"
EXPECTED_OUTPUT='nvm source string already in ${NVM_PROFILE}'
if [ "${OUTPUT#*$EXPECTED_OUTPUT}" = "${OUTPUT}" ]; then
die "Path already exists in the profile, so should have returned >${EXPECTED_OUTPUT}<. Instead it returned >${OUTPUT}<"
fi