Forked from robbles/virtualenv-auto-activate.sh
Last active
December 12, 2015 07:59
Revisions
-
flynfish revised this gist
Feb 8, 2013 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -65,6 +65,11 @@ _virtualenv_auto_activate() { fi echo Activated virtualenv \"$_VENV_NAME\". fi else #deactivate when leaving the dir if [ "$VIRTUAL_ENV" != "" ]; then deactivate fi fi } -
robbles revised this gist
Jun 3, 2012 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -37,9 +37,11 @@ _virtualenv_auto_activate() { # Check for symlink pointing to virtualenv if [ -L ".venv" ]; then _VENV_PATH=$(readlink .venv) _VENV_WRAPPER_ACTIVATE=false # Check for directory containing virtualenv elif [ -d ".venv" ]; then _VENV_PATH=$(pwd -P)/.venv _VENV_WRAPPER_ACTIVATE=false # Check for file containing name of virtualenv elif [ -f ".venv" -a $VENV_WRAPPER = "true" ]; then _VENV_PATH=$WORKON_HOME/$(cat .venv) @@ -50,18 +52,18 @@ _virtualenv_auto_activate() { # Check to see if already activated to avoid redundant activating if [ "$VIRTUAL_ENV" != $_VENV_PATH ]; then if $_VENV_WRAPPER_ACTIVATE; then _VENV_NAME=$(basename $_VENV_PATH) workon $_VENV_NAME else _VENV_NAME=$(basename `pwd`) VIRTUAL_ENV_DISABLE_PROMPT=1 source .venv/bin/activate _OLD_VIRTUAL_PS1="$PS1" PS1="($_VENV_NAME)$PS1" export PS1 fi echo Activated virtualenv \"$_VENV_NAME\". fi fi } -
robbles revised this gist
Mar 27, 2012 . 1 changed file with 44 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,32 +11,62 @@ # For example: # . # ├── .git # │ ├── HEAD # │ ├── config # │ ├── description # │ ├── hooks # │ ├── info # │ ├── objects # │ └── refs # └── .venv # ├── bin # ├── include # └── lib # # The virtualenv will be activated automatically when you enter the directory. # Check for virtualenvwrapper if type workon >/dev/null 2>&1; then VENV_WRAPPER=true else VENV_WRAPPER=false fi _virtualenv_auto_activate() { if [ -e ".venv" ]; then # Check for symlink pointing to virtualenv if [ -L ".venv" ]; then _VENV_PATH=$(readlink .venv) # Check for directory containing virtualenv elif [ -d ".venv" ]; then _VENV_PATH=$(pwd -P)/.venv # Check for file containing name of virtualenv elif [ -f ".venv" -a $VENV_WRAPPER = "true" ]; then _VENV_PATH=$WORKON_HOME/$(cat .venv) _VENV_WRAPPER_ACTIVATE=true else return fi # Check to see if already activated to avoid redundant activating if [ "$VIRTUAL_ENV" != $_VENV_PATH ]; then _VENV_NAME=$(basename $_VENV_PATH) echo Activating virtualenv \"$_VENV_NAME\"... if $_VENV_WRAPPER_ACTIVATE; then workon $_VENV_NAME else VIRTUAL_ENV_DISABLE_PROMPT=1 source .venv/bin/activate _OLD_VIRTUAL_PS1="$PS1" PS1="($_VENV_NAME)$PS1" export PS1 fi fi fi } chpwd_functions=(_virtualenv_auto_activate) export PROMPT_COMMAND=_virtualenv_auto_activate -
codysoyland created this gist
Mar 25, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ #!/bin/bash # virtualenv-auto-activate.sh # # Installation: # Add this line to your .bashrc or .bash-profile: # # source /path/to/virtualenv-auto-activate.sh # # Go to your project folder, run "virtualenv .venv", so your project folder # has a .venv folder at the top level, next to your version control directory. # For example: # . # ├── .git # │ ├── HEAD # │ ├── config # │ ├── description # │ ├── hooks # │ ├── info # │ ├── objects # │ └── refs # └── .venv # ├── bin # ├── include # └── lib # # The virtualenv will be activated automatically when you enter the directory. _virtualenv_auto_activate() { if [ -e ".venv" ]; then # Check to see if already activated to avoid redundant activating if [ "$VIRTUAL_ENV" != "$(pwd -P)/.venv" ]; then _VENV_NAME=$(basename `pwd`) echo Activating virtualenv \"$_VENV_NAME\"... VIRTUAL_ENV_DISABLE_PROMPT=1 source .venv/bin/activate _OLD_VIRTUAL_PS1="$PS1" PS1="($_VENV_NAME)$PS1" export PS1 fi fi } export PROMPT_COMMAND=_virtualenv_auto_activate