Skip to content

Commit

Permalink
A refactoring we will go... A refactoring we will go...
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed Feb 9, 2010
1 parent e495ca2 commit 0f4d335
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions scripts/gems
Expand Up @@ -214,13 +214,17 @@ __rvm_gem_install() {
fi

if [[ ! -z "$gem" ]] ; then

gem_action="$(echo $gem_args | awk '{print $1}')"
gems_args="$(echo $gem_args | awk '{$1="" ; print}' | sed 's/^[ \t]*//')"

# 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="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home/bin:$rvm_gems_path/$rvm_ruby_string%global/bin' $gem_prefix gem $gems_args $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 $gem_action $gems_args $rvm_gem_options $gem $gem_postfix $vars"
else
command="$gem_prefix gem $gems_args $rvm_gem_options -q $gem $gem_postfix $vars"
command="$gem_prefix gem $gem_action $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=$?
Expand All @@ -229,7 +233,7 @@ __rvm_gem_install() {
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"
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 gem_args

return $result
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/log
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi

if [[ ! -z "$2" ]] ; then level=$1 ; shift ; else level="info" ; fi

Expand Down

2 comments on commit 0f4d335

@courtenay
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, line #219, the regex doesn't work (it's seeing the \ and the t as separate because they're in the square braces) which means rvm gem install terminator tries to install the 'erminator' gem. perhaps you want \s* instead of [ \t]*

@courtenay
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was \s* instead of [ \t]*

Please sign in to comment.