Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only call colors once per color. Set rvm_ruby_gem_home if it is not set.
  • Loading branch information
wayneeseguin committed Dec 11, 2009
1 parent 1a3dd4c commit db9ffd1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions scripts/gems
Expand Up @@ -2,10 +2,14 @@

#source $rvm_path/scripts/rvm
source $rvm_path/scripts/utility
source $rvm_path/scripts/selector
#rvm_ruby_string="${rvm_ruby_string:-system}"
#__rvm_select
#source $rvm_path/scripts/selector

color_green=$($rvm_scripts_path/color "green")
color_green=$($rvm_scripts_path/color "red")
color_yellow=$($rvm_scripts_path/color "yellow")
color_none=$($rvm_scripts_path/color "none")

if [[ -z "$rvm_ruby_gem_home" ]] ; then rvm_ruby_gem_home="$(gem env home)" ; fi
if [[ "$rvm_trace_flag" -eq 1 ]] ; then set -x ; export rvm_trace_flag ; fi

trap "rm -f $rvm_path/$$* > /dev/null 2>&1 ; exit" 0 1 2 3 15
Expand Down Expand Up @@ -153,9 +157,10 @@ __rvm_gem_install() {
#
# Evaluate
#

if [[ -z "$rvm_force_flag" ]] && [[ -f "${rvm_ruby_gem_home}/specifications/${gem_file_name}spec" ]] ; then
unset gem
$rvm_scripts_path/log "info" "$($rvm_scripts_path/color "green")$gem_name $gem_version$($rvm_scripts_path/color "none") exists, skipping (--force to re-install)"
$rvm_scripts_path/log "info" "$color_green$gem_name $gem_version$yellow exists, skipping (--force to re-install)"
else
if [[ -f "$gem" ]] ; then
cache_file="$gem"
Expand Down Expand Up @@ -212,9 +217,9 @@ __rvm_gem_install() {
eval $command > /dev/null 2>&1
result=$?
if [[ $result -eq 0 ]] ; then
$rvm_scripts_path/log "info" "$($rvm_scripts_path/color "green")$gem_name $gem_version$($rvm_scripts_path/color "none") installed."
$rvm_scripts_path/log "info" "$color_green$gem_name $gem_version$color_none installed."
else
$rvm_scripts_path/log "error" "$($rvm_scripts_path/color "red")$gem_name $gem_version$($rvm_scripts_path/color "none") failed to install."
$rvm_scripts_path/log "error" "$color_red$gem_name $gem_version$color_none failed to install."
fi
fi
unset gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string
Expand All @@ -237,8 +242,6 @@ __rvm_gems_gemdir() {

unset GEM_PATH

#if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi

if [[ -z "$(which gem 2>/dev/null)" ]] ; then
$rvm_scripts_path/log "error" "'gem' was not found, cannot perform gem actions."
return 1
Expand Down

0 comments on commit db9ffd1

Please sign in to comment.