scripts/gems in rvm-0.1.11 vs scripts/gems in rvm-0.1.12

- old
+ new

@@ -129,22 +129,21 @@ rvm_ruby_gem_list=$(\ls $rvm_ruby_gem_home/specifications/ 2> /dev/null | sed 's#.gems.*$##' 2> /dev/null) while read -r line do # Keep this on 2nd line :( if [[ ! -z "$(echo $line | sed 's/\s//g')" ]] ; then - __rvm_gem_install $line + gems_args="$line" ; __rvm_gem_install fi done < <(awk '/^[^#]+/{print}' "${rvm_file_name}") else $rvm_scripts_path/log "error" "${rvm_file_name} does not exist to load from." fi } -__rvm_parse_gem_line() { - line="$*" - gem="$(echo $line | awk -F';' '{print $1}')" - gem_prefix="$(echo $line | awk -F';' '{print $2}')" +__rvm_parse_gem_args() { + gem="$(echo $gems_args | awk -F';' '{print $1}')" + gem_prefix="$(echo $gems_args | awk -F';' '{print $2}')" if $rvm_scripts_path/match "$gem" "\.gem$" ; then gem_name="$(basename $gem | sed 's#\.gem##' | awk -F'-' '{$NF=NULL;print}')" gem_version="$(basename $gem | sed 's#\.gem##' | awk -F'-' '{print $NF}' )" gem_postfix="$(basename $gem | sed "s#.*\.gem##")" else @@ -171,12 +170,14 @@ fi } # Install a gem __rvm_gem_install() { - __rvm_parse_gem_line $* + # First we parse the gem args to pick apart the pieces. + __rvm_parse_gem_args + # Now we determine if a .gem cache file is already installed if [[ -z "$rvm_force_flag" ]] && [[ -f "${rvm_ruby_gem_home}/specifications/$(basename $gem_file_name)spec" ]] ; then unset gem $rvm_scripts_path/log "info" "$color_green$gem_name $gem_version$yellow exists, skipping (--force to re-install)" else if [[ -f "$gem" ]] ; then @@ -199,10 +200,11 @@ gem_file_name="$(basename "$cache_file")" gem_string="$(echo "$gem_file_name" | sed 's#\.gem$##')" if [[ -z "$rvm_force_flag" ]] && [[ -f "${rvm_ruby_gem_home}/specifications/$(basename $gem_file_name)spec" ]] ; then unset gem # already installed, not forcing reinstall. + $rvm_scripts_path/log "info" "$color_green$gem_name $gem_version$yellow exists, skipping (--force to re-install)" else if [[ -s "$rvm_gems_path/cache/$(basename $gem_file_name)" ]] ; then mkdir -p "$rvm_tmp_path/$$/" mv "$rvm_gems_path/cache/$gem_file_name" "$rvm_tmp_path/$$/$gem_file_name" gem="$rvm_tmp_path/$$/$gem_file_name -f -l" @@ -211,26 +213,27 @@ fi fi fi fi + # If $gem is still set, go forward with the install. if [[ ! -z "$gem" ]] ; then # TODO: Set vars if fourth field is non-empty (means that there are conditional statements to execute in the gem install line. if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi if [[ ! -z "$rvm_ruby_gem_home" ]] && [[ "$rvm_ruby_gem_home" != "$rvm_gems_path" ]] ; then - command="export GEM_HOME='$GEM_HOME' ; export GEM_PATH='$GEM_PATH' ; $gem_prefix gem install $rvm_gem_options $gem $gem_postfix $vars" + command="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home/bin:$rvm_gems_path/$rvm_ruby_string%global/bin' $gem_prefix gem install $gems_args $rvm_gem_options $gem_postfix $vars" else - command="$gem_prefix gem install $rvm_gem_options -q $gem $gem_postfix $vars" + command="$gem_prefix gem install $gems_args $rvm_gem_options -q $gem $gem_postfix $vars" fi __rvm_run "gem.install" "$command" "$gem_name $gem_version is not installed, installing..." result=$? if [[ $result -eq 0 ]] ; then - $rvm_scripts_path/log "info" "$color_green$gem_name $gem_version$color_none installed." + $rvm_scripts_path/log "info" "$gem_name $gem_version installed." else - $rvm_scripts_path/log "error" "$color_red$gem_name $gem_version$color_none failed to install, output has been logged to:\n$rvm_path/log/$rvm_ruby_string/gem.install.error.log" + $rvm_scripts_path/log "error" "$gem_name $gem_version failed to install, output has been logged to:\n$rvm_path/log/$rvm_ruby_string/gem.install.error.log" fi - fi ; unset gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string + fi ; unset gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string gem_action return $result } # Output the user's current gem directory.