Permalink
Browse files

Bugfix: do some more sanity checks when using a gemset.

  • Loading branch information...
1 parent fee9061 commit 2c749d742a97478148035e2ce6cab8d3c5448978 @wayneeseguin wayneeseguin committed Apr 15, 2010
Showing with 14 additions and 5 deletions.
  1. +14 −5 scripts/utility
View
@@ -666,11 +666,20 @@ __rvm_gemset_select() {
if [[ -z "$rvm_gemset_name" ]] ; then unset rvm_gemset_name ; fi
else
gemset=$(echo "$rvm_ruby_gem_home" | awk -F'@' '{print $NF}')
- if [[ -z "$rvm_ruby_gem_home" ]] || [[ ! -z "$gemset" ]] ; then
- rvm_ruby_gem_home="$rvm_gems_path/$(basename ${GEM_HOME/@*/})${rvm_gemset_separator}${rvm_gemset_name}"
- elif [[ ! -z "$gemset" ]] && [[ "$rvm_gemset_name" != "$gemset" ]] ; then
- rvm_ruby_gem_home="$rvm_gems_path/$(basename ${GEM_HOME/@*/})${rvm_gemset_separator}${rvm_gemset_name}"
- fi ; unset gemset
+ if [[ -z "$rvm_ruby_string" ]] && [[ ! -z "${GEM_HOME/@*/}" ]] ; then
+ rvm_ruby_string=$(basename ${GEM_HOME/@*/})
+ fi
+
+ if [[ ! -z "$rvm_ruby_string" ]] ; then
+ if [[ -z "$rvm_ruby_gem_home" ]] || [[ ! -z "$gemset" ]] ; then
+ rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
+ elif [[ ! -z "$gemset" ]] && [[ "$rvm_gemset_name" != "$gemset" ]] ; then
+ rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
+ fi ; unset gemset
+ else
+ $rvm_scripts_path/log "error" "Gemsets can not be used with non rvm controlled rubies (currently)."
+ return 1
+ fi
fi
# If the gemset does not exist, then notify the user as such and abort the action.

0 comments on commit 2c749d7

Please sign in to comment.