scripts/gems in rvm-0.0.98 vs scripts/gems in rvm-0.0.99
- old
+ new
@@ -6,10 +6,11 @@
color_red=$($rvm_scripts_path/color "red")
color_yellow=$($rvm_scripts_path/color "yellow")
color_none=$($rvm_scripts_path/color "none")
if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
+rvm_ruby_gem_home="${rvm_ruby_gem_home:-$GEM_HOME}"
if [[ -d "$rvm_ruby_gem_home" ]] && which gem &> /dev/null ; then rvm_ruby_gem_home="$(gem env home)" ; fi
trap "if [[ -d $rvm_path/tmp/ ]] && [[ -f $rvm_path/tmp/$$ ]] ; then rm -f $rvm_path/tmp/$$ > /dev/null 2>&1 ; fi ; exit" 0 1 2 3 15
__rvm_gems_name() {
@@ -19,11 +20,11 @@
__rvm_gems_dir() {
echo "$rvm_ruby_gem_home"
}
__rvm_gems_list() {
- if [[ $rvm_dir =~ rvm ]] ; then
+ if [[ $rvm_path =~ rvm ]] ; then
for gemdir in "${rvm_gem_path}"/${rvm_ruby_string}%* ; do
echo "$gemdir" | awk -F'%' '{print $2}'
done
fi
}
@@ -49,10 +50,12 @@
$rvm_scripts_path/log "error" "A gems name must be specified in order to delete a gems."
fi
}
__rvm_gems_dump() {
+ rvm_file_name="${rvm_file_name:-$gems_args}"
+
if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME ;
GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH ;
fi
@@ -151,15 +154,16 @@
gem_file_name="${gem_name/ /}*.gem"
else # version
gem_file_name="${gem_name/ /}-${gem_version/ /}.gem"
fi
}
+
__rvm_gem_install() {
__rvm_parse_gem_line $*
- installed_gem="$(ls ${rvm_ruby_gem_home}/specifications/${gem_file_name}*spec 2>/dev/null | head -n 1)"
- if [[ -z "$rvm_force_flag" ]] && [[ -f "$installed_gem" ]] ; then
+ installed_gems="$(ls ${rvm_ruby_gem_home}/specifications/ 2>/dev/null)"
+ if [[ -z "$rvm_force_flag" ]] && [[ ! -z "$(echo $installed_gems | awk '/'${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
cache_file="$gem"
@@ -200,13 +204,13 @@
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" ]] ; then
- command="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home' $gem_prefix gem install --no-rdoc --no-ri -q $gem $gem_postfix $vars"
+ if [[ ! -z "$rvm_ruby_gem_home" ]] && [[ "$rvm_ruby_gem_home" != "$rvm_gem_path" ]] ; then
+ command="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home' $gem_prefix gem install $rvm_gem_options $gem $gem_postfix $vars"
else
- command="$gem_prefix gem install --no-rdoc --no-ri -q $gem $gem_postfix $vars"
+ command="$gem_prefix gem install $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."