"dot." -> "." -- allows more compact docker COPY
This commit is contained in:
parent
87eaaff3d2
commit
65c4c9950b
|
@ -0,0 +1,144 @@
|
|||
unset BASH_ENV
|
||||
# we don't need to run more than once
|
||||
if [[ -v embark_docker_embark_user_BASH_ENV ]]; then
|
||||
return
|
||||
fi
|
||||
export embark_docker_embark_user_BASH_ENV=
|
||||
|
||||
export embark_docker_embark_user_npm_bak_config_prefix=${HOME}/.npm-packages
|
||||
export npm_config_prefix=$embark_docker_embark_user_npm_bak_config_prefix
|
||||
export NPM_CONFIG_PREFIX=$npm_config_prefix
|
||||
|
||||
export embark_docker_embark_user_PATH_with_LOCALBIN=${HOME}/.local/bin:$PATH
|
||||
export embark_docker_embark_user_PATH_with_NPM=$NPM_CONFIG_PREFIX/bin:$embark_docker_embark_user_PATH_with_LOCALBIN
|
||||
export PATH=$embark_docker_embark_user_PATH_with_NPM
|
||||
|
||||
nac () {
|
||||
local txtbld=$(tput bold)
|
||||
local txtrst=$(tput sgr0)
|
||||
local bldcyn=${txtbld}$(tput setaf 6)
|
||||
local bldred=${txtbld}$(tput setaf 1)
|
||||
local ERROR=${bldred}ERROR${txtrst}
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "$ERROR: missing node environment name"
|
||||
return 1
|
||||
fi
|
||||
if [[ ! -d "${HOME}/.local/nodeenv/$1" ]]; then
|
||||
echo "$ERROR: no \"$1\" environment found in ${HOME}/.local/nodeenv"
|
||||
return 1
|
||||
fi
|
||||
____nvm_unload
|
||||
____denac
|
||||
export PATH=$embark_docker_embark_user_PATH_with_LOCALBIN
|
||||
. ${HOME}/.local/nodeenv/$1/bin/activate
|
||||
if [[ $? != 0 ]]; then
|
||||
____denac
|
||||
return 1
|
||||
fi
|
||||
alias deactivate_node='__denac'
|
||||
case $- in
|
||||
*i*) __npm_completion \
|
||||
&& echo "Now using NODEENV node $(node --version) (npm v$(npm --version))";;
|
||||
esac
|
||||
}
|
||||
export -f nac
|
||||
|
||||
__nac () {
|
||||
local curr_word="${COMP_WORDS[COMP_CWORD]}"
|
||||
local -a envs=( $(compgen -d -- "${HOME}/.local/nodeenv/$curr_word") )
|
||||
COMPREPLY=( "${envs[@]##*/}" )
|
||||
return 0
|
||||
}
|
||||
export -f __nac
|
||||
complete -F __nac nac
|
||||
|
||||
__denac () {
|
||||
____denac
|
||||
case $- in
|
||||
*i*) echo "Now using system node $(node --version) (npm v$(npm --version))";;
|
||||
esac
|
||||
}
|
||||
export -f __denac
|
||||
|
||||
____denac () {
|
||||
unalias deactivate_node &> /dev/null
|
||||
if type deactivate_node &> /dev/null; then
|
||||
deactivate_node
|
||||
fi
|
||||
export PATH=$embark_docker_embark_user_PATH_with_NPM
|
||||
}
|
||||
export -f ____denac
|
||||
|
||||
__npm_completion () {
|
||||
. <(npm completion)
|
||||
}
|
||||
export -f __npm_completion
|
||||
|
||||
nvm_load () {
|
||||
__nvm_load
|
||||
alias nvm_load='nvm'
|
||||
alias nvm='__nvm_mask'
|
||||
__nvm_mask () {
|
||||
case $* in
|
||||
unload*) shift 1; __nvm_unload;;
|
||||
*) unalias nvm; nvm "$@"; alias nvm='__nvm_mask';;
|
||||
esac
|
||||
}
|
||||
export -f __nvm_mask
|
||||
}
|
||||
export -f nvm_load
|
||||
|
||||
__nvm_load () {
|
||||
____nvm_unload
|
||||
____denac
|
||||
export PATH=$embark_docker_embark_user_PATH_with_LOCALBIN
|
||||
. ${HOME}/.bash_env_nvm_load
|
||||
. ${HOME}/.nvm/nvm.sh &> /dev/null
|
||||
if [[ (-z $(nvm alias default)) && ($1 != "no-auto-lts") ]]; then
|
||||
case $- in
|
||||
*i*) nvm install --lts;;
|
||||
*) nvm install --lts &> /dev/null;;
|
||||
esac
|
||||
local auto_lts=
|
||||
fi
|
||||
case $- in
|
||||
*i*) __npm_completion;;
|
||||
esac
|
||||
if [[ (! -v auto_lts) \
|
||||
&& ($(which node) = "${HOME}/.nvm/versions/"*) ]]; then
|
||||
case $- in
|
||||
*i*) echo "Now using NVM node $(node --version) (npm v$(npm --version))";;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
export -f __nvm_load
|
||||
|
||||
__nvm_unload () {
|
||||
____nvm_unload
|
||||
case $- in
|
||||
*i*) echo "Now using system node $(node --version) (npm v$(npm --version))";;
|
||||
esac
|
||||
}
|
||||
export -f __nvm_unload
|
||||
|
||||
____nvm_unload () {
|
||||
unalias nvm_load &> /dev/null
|
||||
unalias nvm &> /dev/null
|
||||
unset __nvm_mask
|
||||
if type nvm &> /dev/null; then
|
||||
nvm unload
|
||||
fi
|
||||
export PATH=$embark_docker_embark_user_PATH_with_NPM
|
||||
. ${HOME}/.bash_env_nvm_unload
|
||||
}
|
||||
export -f ____nvm_unload
|
||||
|
||||
simple_nodeenv () {
|
||||
pushd $PWD &> /dev/null
|
||||
cd ${HOME}/.local/nodeenv
|
||||
nodeenv --prebuilt --node $@
|
||||
popd &> /dev/null
|
||||
unalias nac &> /dev/null
|
||||
nac $2
|
||||
}
|
||||
export -f simple_nodeenv
|
|
@ -0,0 +1,2 @@
|
|||
unset npm_config_prefix
|
||||
unset NPM_CONFIG_PREFIX
|
|
@ -0,0 +1,2 @@
|
|||
export npm_config_prefix=$embark_docker_embark_user_npm_bak_config_prefix
|
||||
export NPM_CONFIG_PREFIX=$npm_config_prefix
|
132
dot.bash_env
132
dot.bash_env
|
@ -1,132 +0,0 @@
|
|||
unset BASH_ENV
|
||||
# we don't need to run more than once
|
||||
if [[ -v __BASH_ENV ]]; then
|
||||
return
|
||||
fi
|
||||
export __BASH_ENV=
|
||||
# if we're not pid 1, then it depends...
|
||||
if [[ $$ != 1 ]]; then
|
||||
# if we didn't get loaded via .bashrc then we don't run, but a user could
|
||||
# force the run with: `export BASH_ENV_OK_PID_NOT1_NOT_BASHRC=`
|
||||
if [[ (! -v __BASHRC) && (! -v BASH_ENV_OK_PID_NOT_1_NOT_BASHRC) ]]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
unset __BASHRC
|
||||
# if we haven't run yet, then if we're pid 1, or we're not pid 1 but got loaded
|
||||
# via .bashrc, we continue...
|
||||
|
||||
unset _npm_bak_config_prefix
|
||||
unset npm_config_prefix
|
||||
unset NPM_CONFIG_PREFIX
|
||||
|
||||
export _npm_bak_config_prefix=/home/embark/.npm-packages
|
||||
export npm_config_prefix=$_npm_bak_config_prefix
|
||||
export NPM_CONFIG_PREFIX=$npm_config_prefix
|
||||
|
||||
export PATH=${_PATH:-$PATH}
|
||||
unset _PATH
|
||||
unset __PATH
|
||||
|
||||
export _PATH=/home/embark/.local/bin:$PATH
|
||||
export __PATH=$NPM_CONFIG_PREFIX/bin:$_PATH
|
||||
export PATH=$__PATH
|
||||
|
||||
unset _denac
|
||||
_denac () {
|
||||
if type deactivate_node &> /dev/null; then
|
||||
deactivate_node
|
||||
fi
|
||||
|
||||
export PATH=$__PATH
|
||||
}
|
||||
export -f _denac
|
||||
|
||||
unset denac
|
||||
denac () {
|
||||
_denac
|
||||
case $- in
|
||||
*i*) echo "Now using system version of node: $(node --version) (npm v$(npm --version))";;
|
||||
esac
|
||||
}
|
||||
export -f denac
|
||||
|
||||
unset _nac
|
||||
_nac () {
|
||||
local curr_arg;
|
||||
curr_arg=${COMP_WORDS[COMP_CWORD]}
|
||||
local envs=$(basename /home/embark/.local/nodeenv/$2*)
|
||||
if [ $envs == $(echo $2*) ]; then
|
||||
COMPREPLY=()
|
||||
else
|
||||
COMPREPLY=( $(basename /home/embark/.local/nodeenv/$2*) );
|
||||
fi
|
||||
}
|
||||
export -f _nac
|
||||
|
||||
unset nac
|
||||
nac () {
|
||||
local txtbld=$(tput bold)
|
||||
local txtrst=$(tput sgr0)
|
||||
local bldcyn=${txtbld}$(tput setaf 6)
|
||||
local bldred=${txtbld}$(tput setaf 1)
|
||||
local ERROR=${bldred}ERROR${txtrst}
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "$ERROR: missing node environment name"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "/home/embark/.local/nodeenv/$1" ]]; then
|
||||
echo "$ERROR: no \"$1\" environment found in \/home/embark/.local/nodeenv"
|
||||
return 1
|
||||
fi
|
||||
|
||||
_denac
|
||||
_nvm_unload
|
||||
export PATH=$_PATH
|
||||
|
||||
. /home/embark/.local/nodeenv/$1/bin/activate
|
||||
case $- in
|
||||
*i*) echo "Now using NODEENV node $(node --version) (npm v$(npm --version))";;
|
||||
esac
|
||||
}
|
||||
export -f nac
|
||||
complete -F _nac nac
|
||||
|
||||
unset simple_nodeenv
|
||||
simple_nodeenv () {
|
||||
pushd $PWD &> /dev/null
|
||||
cd /home/embark/.local/nodeenv
|
||||
$(which nodeenv) --prebuilt --node $@
|
||||
popd &> /dev/null
|
||||
nac $2
|
||||
}
|
||||
export -f simple_nodeenv
|
||||
|
||||
unset npm_completion
|
||||
npm_completion () {
|
||||
. <(npm completion)
|
||||
}
|
||||
export -f npm_completion
|
||||
|
||||
unset nvm_load
|
||||
nvm_load () {
|
||||
. /home/embark/.bash_env_nvm_load
|
||||
}
|
||||
export -f nvm_load
|
||||
|
||||
unset _nvm_unload
|
||||
_nvm_unload () {
|
||||
. /home/embark/.bash_env_nvm_unload
|
||||
}
|
||||
export -f _nvm_unload
|
||||
|
||||
unset nvm_unload
|
||||
nvm_unload () {
|
||||
_nvm_unload
|
||||
case $- in
|
||||
*i*) echo "Now using system version of node: $(node --version) (npm v$(npm --version))";;
|
||||
esac
|
||||
}
|
||||
export -f nvm_unload
|
|
@ -1,26 +0,0 @@
|
|||
_nvm_unload
|
||||
_denac
|
||||
unset npm_config_prefix
|
||||
unset NPM_CONFIG_PREFIX
|
||||
export PATH=$_PATH
|
||||
|
||||
. /home/embark/.nvm/nvm.sh &> /dev/null
|
||||
|
||||
if [[ (-z $(nvm alias default)) && ($1 != "no-auto-lts") ]]; then
|
||||
case $- in
|
||||
*i*) nvm install --lts;;
|
||||
*) nvm install --lts &> /dev/null;;
|
||||
esac
|
||||
local auto_lts=
|
||||
fi
|
||||
|
||||
case $- in
|
||||
*i*) npm_completion;;
|
||||
esac
|
||||
|
||||
if [[ (! -v auto_lts) \
|
||||
&& ($(which node) = "/home/embark/.nvm/versions/"*) ]]; then
|
||||
case $- in
|
||||
*i*) echo "Now using NVM node $(node --version) (npm v$(npm --version))";;
|
||||
esac
|
||||
fi
|
|
@ -1,7 +0,0 @@
|
|||
if type nvm &> /dev/null; then
|
||||
nvm unload
|
||||
fi
|
||||
|
||||
export npm_config_prefix=$_npm_bak_config_prefix
|
||||
export NPM_CONFIG_PREFIX=$npm_config_prefix
|
||||
export PATH=$__PATH
|
|
@ -1,2 +0,0 @@
|
|||
export __BASHRC=
|
||||
. /home/embark/.bash_env
|
Loading…
Reference in New Issue