Skip to content
This repository
Browse code

Only call colors once per color. Set rvm_ruby_gem_home if it is not set.

  • Loading branch information...
commit db9ffd10bbf82b55fa9a0fd58c001ab15c90e3aa 1 parent 1a3dd4c
Wayne E. Seguin authored

Showing 1 changed file with 11 additions and 8 deletions. Show diff stats Hide diff stats

  1. +11 8 scripts/gems
19 scripts/gems
@@ -2,10 +2,14 @@
2 2
3 3 #source $rvm_path/scripts/rvm
4 4 source $rvm_path/scripts/utility
5   -source $rvm_path/scripts/selector
6   -#rvm_ruby_string="${rvm_ruby_string:-system}"
7   -#__rvm_select
  5 +#source $rvm_path/scripts/selector
8 6
  7 +color_green=$($rvm_scripts_path/color "green")
  8 +color_green=$($rvm_scripts_path/color "red")
  9 +color_yellow=$($rvm_scripts_path/color "yellow")
  10 +color_none=$($rvm_scripts_path/color "none")
  11 +
  12 +if [[ -z "$rvm_ruby_gem_home" ]] ; then rvm_ruby_gem_home="$(gem env home)" ; fi
9 13 if [[ "$rvm_trace_flag" -eq 1 ]] ; then set -x ; export rvm_trace_flag ; fi
10 14
11 15 trap "rm -f $rvm_path/$$* > /dev/null 2>&1 ; exit" 0 1 2 3 15
@@ -153,9 +157,10 @@ __rvm_gem_install() {
153 157 #
154 158 # Evaluate
155 159 #
  160 +
156 161 if [[ -z "$rvm_force_flag" ]] && [[ -f "${rvm_ruby_gem_home}/specifications/${gem_file_name}spec" ]] ; then
157 162 unset gem
158   - $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)"
  163 + $rvm_scripts_path/log "info" "$color_green$gem_name $gem_version$yellow exists, skipping (--force to re-install)"
159 164 else
160 165 if [[ -f "$gem" ]] ; then
161 166 cache_file="$gem"
@@ -212,9 +217,9 @@ __rvm_gem_install() {
212 217 eval $command > /dev/null 2>&1
213 218 result=$?
214 219 if [[ $result -eq 0 ]] ; then
215   - $rvm_scripts_path/log "info" "$($rvm_scripts_path/color "green")$gem_name $gem_version$($rvm_scripts_path/color "none") installed."
  220 + $rvm_scripts_path/log "info" "$color_green$gem_name $gem_version$color_none installed."
216 221 else
217   - $rvm_scripts_path/log "error" "$($rvm_scripts_path/color "red")$gem_name $gem_version$($rvm_scripts_path/color "none") failed to install."
  222 + $rvm_scripts_path/log "error" "$color_red$gem_name $gem_version$color_none failed to install."
218 223 fi
219 224 fi
220 225 unset gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string
@@ -237,8 +242,6 @@ __rvm_gems_gemdir() {
237 242
238 243 unset GEM_PATH
239 244
240   -#if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi
241   -
242 245 if [[ -z "$(which gem 2>/dev/null)" ]] ; then
243 246 $rvm_scripts_path/log "error" "'gem' was not found, cannot perform gem actions."
244 247 return 1

0 comments on commit db9ffd1

Please sign in to comment.
Something went wrong with that request. Please try again.