Created
February 18, 2010 02:17
-
-
Save Sutto/307257 to your computer and use it in GitHub Desktop.
Simple gem set switching for ruby
This file contains 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
function gemset --description 'Switches gemset' | |
set gemset_name $argv[1] | |
if [ -n "$gemset_name" ] | |
set gem_dir "$HOME/.gems-switcher/$gemset_name" | |
echo "Using gemset: $gemset_name (location: '$gem_dir')" | |
mkdir -p "$gem_dir/bin" | |
set -xg PATH "$gem_dir/bin" $GEMLESS_PATH | |
set -xg GEM_HOME "$gem_dir" | |
set -xg GEM_PATH "$gem_dir" | |
else | |
echo "Using default gemset." | |
set -e GEM_HOME | |
set -e GEM_PATH | |
set PATH $GEMLESS_PATH | |
end | |
end |
This file contains 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
export GEMLESS_PATH=$PATH | |
function gemset { | |
GEMSET_NAME="$1" | |
if [ -n "$GEMSET_NAME" ] | |
then | |
GEMSET_DIR="$HOME/.gems-switcher/$GEMSET_NAME" | |
echo "Using gemset: $GEMSET_NAME (location: '$GEMSET_DIR')" | |
mkdir -p $GEMSET_DIR/bin | |
export PATH="$GEMSET_DIR/bin:$GEMLESS_PATH" | |
export GEM_HOME=$GEMSET_DIR | |
export GEM_PATH=$GEMSET_DIR | |
else | |
echo "Using default gemset." | |
unset GEM_HOME | |
unset GEM_PATH | |
export PATH=$GEMLESS_PATH | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment