scripts/gems in rvm-0.0.97 vs scripts/gems in rvm-0.0.98
- old
+ new
@@ -20,19 +20,19 @@
echo "$rvm_ruby_gem_home"
}
__rvm_gems_list() {
if [[ $rvm_dir =~ rvm ]] ; then
- for gemdir in $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version%* ; do
+ for gemdir in "${rvm_gem_path}"/${rvm_ruby_string}%* ; do
echo "$gemdir" | awk -F'%' '{print $2}'
done
fi
}
__rvm_gems_delete() {
if [[ ! -z "$rvm_gem_set_name" ]] ; then
- gemdir="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version%$rvm_gem_set_name"
+ gemdir="$rvm_gem_path/$rvm_ruby_string%$rvm_gem_set_name"
if [[ -d "$gemdir" ]] && [[ ! -z "$rvm_force_flag" ]] ; then
rm -rf "$gemdir"
elif [[ -d "$gemdir" ]] ; then
$rvm_scripts_path/log "warn" "Are you SURE you wish to remove the installed gems '$rvm_gem_set_name ' ($gemdir)?"
echo -n "(anything other than 'yes' will cancel) > "
@@ -62,13 +62,14 @@
else
rvm_file_name="default.gems"
fi
fi
+ $rvm_scripts_path/log "info" "Dumping current environments gems to $rvm_file_name"
+
touch $rvm_file_name
echo "# $rvm_file_name generated gem dump file. Note that any env variable settings will be missing. Append these after using a ';' field separator" > $rvm_file_name
-
for gem in $(gem list | sed 's#[\(|\)]##g' | sed 's#, #,#g' | tr ' ' ';') ; do
name="$(echo $gem | awk -F';' '{print $1}')"
if [[ -z "$rvm_latest_flag" ]] ; then
versions="$(echo $gem | awk -F';' '{print $2}' | sed 's#,# #g')"
for version in $versions ; do
@@ -112,12 +113,11 @@
echo "Loading $rvm_file_name file..."
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 :(
- __rvm_parse_gem_line $line
- __rvm_gem_install
+ __rvm_gem_install $line
done < <(awk '/^[\.\/a-zA-Z]/{print}' "$rvm_file_name")
else
$rvm_scripts_path/log "error" "$rvm_file_name does not exist to load from."
fi
}
@@ -154,11 +154,11 @@
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)"
+ 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
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
@@ -200,22 +200,20 @@
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
- $rvm_scripts_path/log "warn" "$gem_name $gem_version is not installed, installing..."
if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
- command="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home' $gem_prefix $rvm_ruby_home/bin/gem install --no-rdoc --no-ri -q $gem $gem_postfix $vars"
+ 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"
else
- command="$gem_prefix $rvm_ruby_home/bin/gem install --no-rdoc --no-ri -q $gem $gem_postfix $vars"
+ command="$gem_prefix gem install --no-rdoc --no-ri -q $gem $gem_postfix $vars"
fi
-
- eval $command >> "$rvm_path/log/$rvm_ruby_string/gem.install.log" 2>> "$rvm_path/log/$rvm_ruby_string/gem.install.error.log"
+ __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."
else
- $rvm_scripts_path/log "error" "$color_red$gem_name $gem_version$color_none failed to install, output logged to $rvm_path/log/$rvm_ruby_string/gem.install.error.log"
+ $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
return $result
}