more DRY
This commit is contained in:
parent
88d1656434
commit
e0143c086f
|
@ -192,8 +192,7 @@ COPY env/docker-entrypoint.sh \
|
||||||
/usr/local/bin/
|
/usr/local/bin/
|
||||||
COPY --chown=embark:embark \
|
COPY --chown=embark:embark \
|
||||||
env/.bash_env \
|
env/.bash_env \
|
||||||
env/.bash_env_denac \
|
env/.bash_env_unset_npm_config \
|
||||||
env/.bash_env_nvm_load \
|
|
||||||
env/.bashrc \
|
env/.bashrc \
|
||||||
env/.npmrc \
|
env/.npmrc \
|
||||||
/home/embark/
|
/home/embark/
|
||||||
|
|
|
@ -22,7 +22,7 @@ nac () {
|
||||||
__denac
|
__denac
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
__versions_export
|
__versions
|
||||||
alias denac='deactivate_node'
|
alias denac='deactivate_node'
|
||||||
alias deactivate_node='__denac'
|
alias deactivate_node='__denac'
|
||||||
case $- in
|
case $- in
|
||||||
|
@ -46,9 +46,8 @@ __denac () {
|
||||||
if type deactivate_node &> /dev/null; then
|
if type deactivate_node &> /dev/null; then
|
||||||
deactivate_node
|
deactivate_node
|
||||||
fi
|
fi
|
||||||
. ${HOME}/.bash_env_denac
|
. "${HOME}/.bash_env_unset_npm_config"
|
||||||
unset NODE_VERSION
|
__versions
|
||||||
unset NPM_VERSION
|
|
||||||
}
|
}
|
||||||
export -f __denac
|
export -f __denac
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ nvm_load () {
|
||||||
__nvm_mask () {
|
__nvm_mask () {
|
||||||
case "$*" in
|
case "$*" in
|
||||||
unload*) __nvm_unload ;;
|
unload*) __nvm_unload ;;
|
||||||
*) unalias nvm; nvm "$@"; alias nvm='__nvm_mask'; __versions_export ;;
|
*) unalias nvm; nvm "$@"; alias nvm='__nvm_mask'; __versions ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
export -f __nvm_mask
|
export -f __nvm_mask
|
||||||
|
@ -72,16 +71,14 @@ nvm_load () {
|
||||||
export -f nvm_load
|
export -f nvm_load
|
||||||
|
|
||||||
__nvm_load () {
|
__nvm_load () {
|
||||||
__nvm_unload
|
|
||||||
__denac
|
__denac
|
||||||
. ${HOME}/.bash_env_nvm_load
|
|
||||||
. ${HOME}/.nvm/nvm.sh &> /dev/null
|
. ${HOME}/.nvm/nvm.sh &> /dev/null
|
||||||
case $- in
|
case $- in
|
||||||
*i*) bash-it enable completion nvm &> /dev/null; \
|
*i*) bash-it enable completion nvm &> /dev/null; \
|
||||||
. ${BASH_IT}/completion/available/nvm.completion.bash ;;
|
. ${BASH_IT}/completion/available/nvm.completion.bash ;;
|
||||||
esac
|
esac
|
||||||
if [[ $(which node) = "${HOME}/.nvm/versions/"* ]]; then
|
if [[ $(which node) = "${HOME}/.nvm/versions/"* ]]; then
|
||||||
__versions_export
|
__versions
|
||||||
case $- in
|
case $- in
|
||||||
*i*) __npm_completion ;;
|
*i*) __npm_completion ;;
|
||||||
esac
|
esac
|
||||||
|
@ -96,8 +93,7 @@ __nvm_unload () {
|
||||||
if type nvm &> /dev/null; then
|
if type nvm &> /dev/null; then
|
||||||
nvm unload
|
nvm unload
|
||||||
fi
|
fi
|
||||||
unset NODE_VERSION
|
__versions
|
||||||
unset NPM_VERSION
|
|
||||||
}
|
}
|
||||||
export -f __nvm_unload
|
export -f __nvm_unload
|
||||||
|
|
||||||
|
@ -114,7 +110,7 @@ simple_nodeenv () {
|
||||||
}
|
}
|
||||||
export -f simple_nodeenv
|
export -f simple_nodeenv
|
||||||
|
|
||||||
__versions_export () {
|
__versions () {
|
||||||
if type node &> /dev/null; then
|
if type node &> /dev/null; then
|
||||||
local node_version=$(node --version)
|
local node_version=$(node --version)
|
||||||
export NODE_VERSION=${node_version##v}
|
export NODE_VERSION=${node_version##v}
|
||||||
|
@ -124,7 +120,7 @@ __versions_export () {
|
||||||
unset NPM_VERSION
|
unset NPM_VERSION
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
export -f __versions_export
|
export -f __versions
|
||||||
|
|
||||||
if [[ ! -v NODE_VIRTUAL_ENV ]]; then
|
if [[ ! -v NODE_VIRTUAL_ENV ]]; then
|
||||||
nac default
|
nac default
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
unset npm_config_prefix
|
|
||||||
unset NPM_CONFIG_PREFIX
|
|
Loading…
Reference in New Issue