Testable install script
* wraps main code into a function * EnvVar-based install start * Clean environment after installmaster
parent
cec1c38a84
commit
3cdec8e875
|
@ -9,6 +9,11 @@ before_script:
|
||||||
script:
|
script:
|
||||||
- NVM_DIR=$TRAVIS_BUILD_DIR make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin $SHELL
|
- NVM_DIR=$TRAVIS_BUILD_DIR make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin $SHELL
|
||||||
env:
|
env:
|
||||||
|
- SHELL=sh TEST_SUITE=install_script
|
||||||
|
- SHELL=dash TEST_SUITE=install_script
|
||||||
|
- SHELL=bash TEST_SUITE=install_script
|
||||||
|
- SHELL=zsh TEST_SUITE=install_script
|
||||||
|
- SHELL=ksh TEST_SUITE=install_script
|
||||||
- SHELL=sh TEST_SUITE=fast
|
- SHELL=sh TEST_SUITE=fast
|
||||||
- SHELL=dash TEST_SUITE=fast
|
- SHELL=dash TEST_SUITE=fast
|
||||||
- SHELL=bash TEST_SUITE=fast
|
- SHELL=bash TEST_SUITE=fast
|
||||||
|
@ -34,4 +39,3 @@ env:
|
||||||
- SHELL=zsh TEST_SUITE=installation WITHOUT_CURL=1
|
- SHELL=zsh TEST_SUITE=installation WITHOUT_CURL=1
|
||||||
- SHELL=ksh TEST_SUITE=installation
|
- SHELL=ksh TEST_SUITE=installation
|
||||||
- SHELL=ksh TEST_SUITE=installation WITHOUT_CURL=1
|
- SHELL=ksh TEST_SUITE=installation WITHOUT_CURL=1
|
||||||
|
|
||||||
|
|
13
install.sh
13
install.sh
|
@ -66,6 +66,7 @@ install_nvm_as_script() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvm_do_install() {
|
||||||
if [ -z "$METHOD" ]; then
|
if [ -z "$METHOD" ]; then
|
||||||
# Autodetect install method
|
# Autodetect install method
|
||||||
if nvm_has "git"; then
|
if nvm_has "git"; then
|
||||||
|
@ -129,3 +130,15 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=> Close and reopen your terminal to start using nvm"
|
echo "=> Close and reopen your terminal to start using nvm"
|
||||||
|
nvm_reset
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Unsets the various functions defined
|
||||||
|
# during the execution of the install script
|
||||||
|
#
|
||||||
|
nvm_reset() {
|
||||||
|
unset -f nvm_do_install nvm_has nvm_download install_nvm_as_script install_nvm_from_git nvm_reset
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "_$NVM_ENV" = "_testing" ] || nvm_do_install
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
"test/fast": "urchin -f test/fast",
|
"test/fast": "urchin -f test/fast",
|
||||||
"test/slow": "urchin -f test/slow",
|
"test/slow": "urchin -f test/slow",
|
||||||
"test/installation": "urchin -f test/installation",
|
"test/installation": "urchin -f test/installation",
|
||||||
"test/sourcing": "urchin -f test/sourcing"
|
"test/sourcing": "urchin -f test/sourcing",
|
||||||
|
"test/install_script": "urchin -f test/install_script"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
NVM_ENV=testing . ../../install.sh
|
||||||
|
|
||||||
|
#nvm_do_install is available
|
||||||
|
type nvm_do_install > /dev/null 2>&1
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
NVM_ENV=testing . ../../install.sh
|
||||||
|
|
||||||
|
safe_type() {
|
||||||
|
type "$1" > /dev/null 2>&1 && return 0 || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check nvm_reset exists
|
||||||
|
type nvm_reset > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Apply nvm_reset
|
||||||
|
nvm_reset
|
||||||
|
|
||||||
|
# The names should be unset
|
||||||
|
! safe_type nvm_do_install && \
|
||||||
|
! safe_type nvm_has && \
|
||||||
|
! safe_type nvm_download && \
|
||||||
|
! safe_type install_nvm_as_script && \
|
||||||
|
! safe_type install_nvm_from_git && \
|
||||||
|
! safe_type nvm_reset
|
Loading…
Reference in New Issue