Skip to content

Instantly share code, notes, and snippets.

@homburg
Created April 18, 2013 11:07
Show Gist options
  • Save homburg/5411931 to your computer and use it in GitHub Desktop.
Save homburg/5411931 to your computer and use it in GitHub Desktop.
Generic virtual environment
#!/usr/bin/env bash
echo "*** Remeber to call this with source ***"
echo "Activating \"virtual environment\" (modifying PATH).
Use \"deactivate\" to escape"
function deactivate () {
PS1=$_OLD_PS1
PATH=$_OLD_PATH
WRK=$_OLD_WRK
unset -f deactivate
}
_OLD_PS1=$PS1
_OLD_PATH=$PATH
_OLD_WRK=$WRK
LOCAL_BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LOCAL_VENDOR_BIN_DIR=$( readlink -f "${LOCAL_BIN_DIR}/../vendor/vendor/bin/" )
PS1="grammatip venv:${PS1}"
PATH="${LOCAL_BIN_DIR}:${LOCAL_VENDOR_BIN_DIR}:${PATH}"
WRK="$( readlink -f "${LOCAL_BIN_DIR}/../" )"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment