Created
August 21, 2013 06:39
-
-
Save airtonix/6291018 to your computer and use it in GitHub Desktop.
RVM Gemset integration with VirtualEnvWrapper
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 characters
#!/bin/bash | |
# | |
# ~/.virtualenvs/postactivate | |
# | |
# This hook is run after this virtualenv is activated. | |
source ~/.rvm/scripts/rvm | |
# use a specific version of Ruby | |
rvm use 1.9.3 | |
# cache a list of existing gemsets | |
gemsets=`rvm gemset list` | |
# get the directory name of the python virtual environment | |
# method 1 | |
# project_name=$(echo $VIRTUAL_ENV|awk -F'/' '{print $NF}') | |
# method 2 | |
project_name=$(basename $VIRTUAL_ENV) | |
# Create a new gemset for $project_name if it doesn't exist | |
if [[ ! $gemsets == *"$project_name" ]]; then | |
rvm gemset create $project_name | |
fi | |
# use the $project_name gemset | |
rvm gemset use $project_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment