Last active
August 29, 2015 14:17
-
-
Save jsplink/232269d8d941ca3c019d to your computer and use it in GitHub Desktop.
postactivate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This hook is sourced after every virtualenv is activated. | |
export PROJECT_NAME=${VIRTUAL_ENV#$WORKON_HOME/}; | |
export PROJECT_PATH=/Users/${USER}/repos/${PROJECT_NAME}; | |
export PROJECT_RVM_ENV=`echo $PROJECT_NAME | sed 's,[/-_],,g'`; | |
# override path to... | |
# (1) setup rvm and | |
# (2) pyenv and | |
# (3) virtualenv binaries | |
# (4) system binaries | |
############################## | |
# Setup the PATH env var | |
############################## | |
rvm use ruby-1.9.3-p484@${PROJECT_RVM_ENV} --create; # RVM paths | |
OS_PATH=${PATH} # OS/PyEnv paths are here | |
export PATH=${VIRTUAL_ENV}/bin:${VIRTUAL_ENV}/bin; # Virtualenv paths | |
export PATH=${PATH}:${PROJECT_PATH}/node_modules/.bin; # Nodeenv paths | |
export PATH=${PATH}:${OS_PATH}; # OS paths | |
############################## | |
# Setup NPM paths | |
############################## | |
# setup node and npm | |
export NPM_CONFIG_PREFIX=/Users/${USER}/.virtualenv/${PROJECT_NAME} | |
# if there's an error try adding npm_config_prefix i suppose | |
export NODE_VIRTUAL_ENV=/Users/${USER}/.virtualenv/${PROJECT_NAME} | |
export NODE_PATH=/Users/${USER}/.virtualenv/${PROJECT_NAME}/lib/node_modules | |
# Done. | |
cd ${PROJECT_PATH}; | |
echo " ###############################################"; | |
echo " #"; | |
echo " # Opened project: ${PROJECT_NAME}"; | |
echo " #"; | |
echo " ###############################################"; | |
echo "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment