From 2f88bfd81f7343ba582275d9b08c3a35527c7f12 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Mon, 23 Sep 2013 09:06:32 -0400 Subject: [PATCH] setup postactivate for virtualenvwrapper --- postactivate | 11 +++++++++++ setup.sh | 21 ++++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100755 postactivate diff --git a/postactivate b/postactivate new file mode 100755 index 0000000..dfff46f --- /dev/null +++ b/postactivate @@ -0,0 +1,11 @@ +#!/bin/zsh +# This hook is run after every virtualenv is activated. + +proj_name=$(echo $VIRTUAL_ENV|awk -F'/' '{print $NF}') +if [ -d ~/Magnetic/$proj_name ] +then + cd ~/Magnetic/$proj_name +elif [ -d ~/src/$proj_name ] +then + cd ~/src/$proj_name +fi diff --git a/setup.sh b/setup.sh index 6f3e0a6..3d9f369 100755 --- a/setup.sh +++ b/setup.sh @@ -29,8 +29,8 @@ for file in $files; do then echo "Moving $file to $olddir/$file" mv ~/.$file $olddir - echo "Creating symlink to $file in home directory." - ln -s $dir/$file ~/.$file + echo "Creating symlink to $file in home directory." + ln -s $dir/$file ~/.$file fi done @@ -40,12 +40,23 @@ sudo pip install elpy rope echo "Installing Virtualenvwrapper" sudo pip install virtualenvwrapper -source ~/.zshrc +echo "Setting up $WORKON_HOME" +WORKON_HOME=~/environments +mkdir -p WORKON_HOME +file="postactivate" +if [ -e $file ] +then + echo "Moving $WORKON_HOME/$file to $olddir/$file" + mv $WORKON_HOME/$file $olddir + echo "Creating symlink to $file in $WORKON_HOME directory." + ln -s $dir/$file $WORKON_HOME/$file +fi + echo "Setting up GOPATH" mkdir -p $GOPATH echo "Setting up CHEF_PATH" mkdir -p $CHEF_PATH -echo "Setting up WORKON_HOME" -mkdir -p $WORKON_HOME +echo "Source ~/.zshrc" +source ~/.zshrc