Skip to content

Commit

Permalink
fix __rvm_become with gemsets, fix #710
Browse files Browse the repository at this point in the history
  • Loading branch information
mpapis committed Jan 19, 2012
1 parent 431e010 commit ebee88a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 46 deletions.
2 changes: 1 addition & 1 deletion rvm-test
Submodule rvm-test updated from 0d05c3 to 462717
69 changes: 25 additions & 44 deletions scripts/alias
Expand Up @@ -162,74 +162,55 @@ alias_after_create_default()
done
}

alias_create() {

alias_create()
{
alias_name="${alias_name:-""}"
rvm_ruby_string="$rvm_environment_identifier"

rvm_ruby_string="$rvm_environment_identifier"

rvm_expanding_aliases=1

__rvm_become
rvm_expanding_aliases=1
__rvm_become
unset rvm_expanding_aliases

unset rvm_expanding_aliases

if [[ "default" != "$alias_name" ]] && alias_conflicts_with_ruby "$alias_name"; then
if [[ "default" != "$alias_name" ]] && alias_conflicts_with_ruby "$alias_name"
then
# Force it to an empty alias name to trigger the usage.
alias_name=""
fi

if [[ -z "${rvm_environment_identifier:-""}" || -z "$alias_name" ]] ; then

if [[ -z "${rvm_environment_identifier:-""}" || -z "$alias_name" ]]
then
rvm_error "usage: 'rvm alias [alias_name] [ruby_string]'"
return 1

result=1
else

if [[ -z "$rvm_ruby_string" ]]; then

rvm_error "Unknown ruby string '$rvm_ruby_string' specified"

result=1

return $result
fi

if [[ "default" == "$alias_name" ]] ; then
rvm_alias=""
if [[ -z "$rvm_ruby_string" ]]
then
rvm_error "Unknown ruby string '$rvm_ruby_string' specified"
return 1
fi

if [[ -z "$rvm_alias" ]] ; then
if [[ "default" == "$alias_name" ]]
then rvm_alias=""
fi

if [[ -z "$rvm_alias" ]]
then
final_environment_identifier="${rvm_ruby_string:-$(__rvm_env_string)}"

rvm_log "Creating alias $alias_name for $final_environment_identifier."

ln -fs "$rvm_rubies_path/$rvm_ruby_string" "$rvm_rubies_path/$alias_name"

rvm_log "Recording alias $alias_name for $final_environment_identifier."

"$rvm_scripts_path"/db "$rvm_path/config/alias" "$alias_name" "$final_environment_identifier"

if [[ "default" == "$alias_name" ]] ; then
alias_after_create_default
fi

[[ "default" != "$alias_name" ]] || alias_after_create_default
else

if [[ -d "$rvm_rubies_path/$alias_name" ]] ; then

rvm_error "$rvm_rubies_path/$alias_name is taken and is *not* able to be an alias name."

result=1

else

rvm_error "$rvm_rubies_path/$alias_name is already aliased."

result=1

if [[ -d "$rvm_rubies_path/$alias_name" ]]
then rvm_error "$rvm_rubies_path/$alias_name is taken and is *not* able to be an alias name."
else rvm_error "$rvm_rubies_path/$alias_name is already aliased."
fi
return 1
fi
fi
}
Expand Down
4 changes: 3 additions & 1 deletion scripts/functions/environment
Expand Up @@ -68,7 +68,9 @@ __rvm_become()

[[ -n "$string" ]] && rvm_ruby_string="$string"

{ __rvm_ruby_string && __rvm_select && __rvm_use; } > /dev/null 2>&1
__rvm_use > /dev/null 2>&1

rvm_ruby_string="${rvm_ruby_string}${rvm_gemset_name:+${rvm_gemset_separator:-'@'}}${rvm_gemset_name:-}"

return 0
}
Expand Down

0 comments on commit ebee88a

Please sign in to comment.