From b5775083a1fe12b3393789ad6b4ea67c67112558 Mon Sep 17 00:00:00 2001 From: Baptiste Darthenay Date: Tue, 27 Dec 2016 19:54:25 +0100 Subject: Using WORKON_HOME instead of envroot. This improves compatibility with virtualenvwrapper. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 3ddcf66..fc74104 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,9 @@ will be printed instead. ## Where venvs are created When `workon` is called, venvs are created or loaded from the -`$HOME/.venvs` folder. +`$HOME/.venvs` folder by default. +To change this behavior, set the `WORKON_HOME` environment +variable before sourcing `venvworkon.sh`. ## Post-load script If the file `$HOME/.venvs//postload.sh` exists, it is -- cgit v1.2.3 From ef80fa0bec2df62c2ea5469123b4ad794c7c9306 Mon Sep 17 00:00:00 2001 From: Baptiste Darthenay Date: Tue, 27 Dec 2016 20:33:59 +0100 Subject: Rename postload.sh to postactivate.sh. This is closer to the virtualenvwrapper naming. --- README.md | 6 +++--- venvworkon.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index fc74104..3376c4b 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ When `workon` is called, venvs are created or loaded from the To change this behavior, set the `WORKON_HOME` environment variable before sourcing `venvworkon.sh`. -## Post-load script -If the file `$HOME/.venvs//postload.sh` exists, it is -automatically sourced after the venv is loaded. This is useful +## Post-activate script +If the file `$HOME/.venvs//postactivate.sh` exists, it is +automatically sourced after the venv is activated. This is useful to export environment variable such as `DJANGO_SETTINGS_MODULE`. ## Why bother using this diff --git a/venvworkon.sh b/venvworkon.sh index adca644..f6ac4ef 100755 --- a/venvworkon.sh +++ b/venvworkon.sh @@ -26,8 +26,8 @@ workon() { source "$envdir/bin/activate" - if [ -e "$envdir/postload.sh" ] + if [ -e "$envdir/postactivate.sh" ] then - source "$envdir/postload.sh" + source "$envdir/postactivate.sh" fi } -- cgit v1.2.3 From dbbc7dc2950d6b565488864ee8ebf53a73d6e8eb Mon Sep 17 00:00:00 2001 From: Baptiste Darthenay Date: Wed, 28 Dec 2016 11:35:56 +0100 Subject: Jumps to project directory if exists. --- README.md | 5 +++++ venvworkon.sh | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 3376c4b..acbec3b 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,11 @@ If the file `$HOME/.venvs//postactivate.sh` exists, it is automatically sourced after the venv is activated. This is useful to export environment variable such as `DJANGO_SETTINGS_MODULE`. +## Project directory +If `PROJECT_HOME` is set (e.g. `$HOME/Projects`) and there is +a project folder which match the environment name, venvworkon +change the current working directory to the project directory. + ## Why bother using this `virtualenvwrapper` is certainly much more feature-packed and useful than this. But this wrapper is handy for development and diff --git a/venvworkon.sh b/venvworkon.sh index f6ac4ef..960048b 100755 --- a/venvworkon.sh +++ b/venvworkon.sh @@ -26,6 +26,11 @@ workon() { source "$envdir/bin/activate" + if [ -d "$PROJECT_HOME/$envname" ] + then + cd "$PROJECT_HOME/$envname" + fi + if [ -e "$envdir/postactivate.sh" ] then source "$envdir/postactivate.sh" -- cgit v1.2.3