scripts/gemsets in rvm-0.1.32 vs scripts/gemsets in rvm-0.1.33
- old
+ new
@@ -9,11 +9,11 @@
if [[ ! -d "$rvm_ruby_gem_home" ]] && command -v gem > /dev/null 2>&1; then rvm_ruby_gem_home="$(gem env home)" ; fi
trap "if [[ -d $rvm_tmp_path/ ]] && [[ -s $rvm_tmp_path/$$ ]] ; then rm -f $rvm_tmp_path/$$ > /dev/null 2>&1 ; fi ; exit" 0 1 2 3 15
__rvm_gemset_name() {
- __rvm_gemset_gemdir | awk -F${rvm_gemset_separator} '{print $2}'
+ __rvm_gemset_dir | awk -F${rvm_gemset_separator} '{print $2}'
}
__rvm_gemset_dir() {
echo "$rvm_ruby_gem_home"
}
@@ -33,13 +33,11 @@
$rvm_scripts_path/log "info" "gemsets : for $rvm_ruby_string (found in $rvm_gems_path/)"
if [[ ! -z "$rvm_gems_path" ]] ; then
if [[ ! -z $rvm_ruby_string ]] ; then
- for gemdir in $rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}* ; do
- echo "$gemdir" | awk -F${rvm_gemset_separator} '{print $2}'
- done
+ \ls ${rvm_gems_path}/ | awk -F"${rvm_gemset_separator}" "/${rvm_ruby_string}${rvm_gemset_separator}/{print \$2}" 2>/dev/null
else
$rvm_scripts_path/log "error" "\$rvm_ruby_string is not set!"
fi
else
$rvm_scripts_path/log "error" "\$rvm_gems_path is not set!"
@@ -71,17 +69,17 @@
__rvm_gemset_empty() {
if [[ -z "$rvm_ruby_gem_home" ]] ; then __rvm_select ; fi
gemdir="$rvm_ruby_gem_home"
if [[ -d "$gemdir" ]] && [[ "$gemdir" != '/' ]] && [[ ! -z "$rvm_force_flag" ]] ; then
- cd $gemdir && rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
+ builtin cd $gemdir && rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
elif [[ -d "$gemdir" ]] ; then
$rvm_scripts_path/log "warn" "Are you SURE you wish to remove the installed gemset for gemset '$(basename $gemdir)' ($gemdir)?"
echo -n "(anything other than 'yes' will cancel) > "
read response
if [[ "yes" = "$response" ]] ; then
- cd $gemdir && rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
+ builtin cd $gemdir && rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
else
$rvm_scripts_path/log "info" "Not doing anything, phew... close call that one eh?"
fi
else
$rvm_scripts_path/log "info" "$gemdir already does not exist."
@@ -100,15 +98,17 @@
fi
source_path="$(rvm $source_ruby gem env gemdir | tail -n 1)"
destination_path="$(rvm $destination_ruby gem env gemdir | tail -n 1)"
if [[ -d "$source_path" ]] ; then
if [[ ! -d "$destination_path" ]] ; then mkdir -p $destination_path ; fi
- $rvm_scripts_path/log "info" "Copying gemset from $source_ruby to $destination_ruby" ;
+ $rvm_scripts_path/log "info" "Copying gemset from $source_ruby to $destination_ruby"
for dir in bin doc gems specifications ; do
mkdir -p "$destination_path/$dir"
cp -Rf "$source_path/$dir" "$destination_path/"
done
+ $rvm_scripts_path/log "info" "Making gemset for $destination_ruby pristine."
+ $(rvm $destination_ruby ; gem pristine --all)
else
$rvm_scripts_path/log "error" "Gems directory does not exist for $source_path ($source_path)"
return 1
fi
@@ -293,21 +293,21 @@
return $result
}
# Output the user's current gem directory.
-__rvm_gemset_gemdir() {
+__rvm_gemset_info() {
if [[ "$rvm_user_flag" -eq 1 ]] ; then
echo $(rvm system ; gem env | grep "\- $HOME" | awk '{print $NF}')
elif [[ "$rvm_system_flag" -eq 1 ]] ; then
- echo $(rvm system ; gem env gemdir system)
+ echo $(rvm system ; gem env $action system)
elif [[ ! -z "$rvm_ruby_string" ]] ; then
- echo $(rvm "$rvm_ruby_string" ; gem env gemdir)
+ echo $(rvm "$rvm_ruby_string" ; gem env $action)
elif [[ ! -z "$GEM_HOME" ]] ; then
echo "$GEM_HOME"
else
- gem env gemdir
+ gem env $action
fi
}
__rvm_gem_pristine() {
gem pristine --all
@@ -340,19 +340,19 @@
__rvm_gemset_name
elif [[ "dir" = "$action" ]] ; then
__rvm_gemset_dir
elif [[ "list" = "$action" ]] ; then
__rvm_gemset_list
-elif [[ "gemdir" = "$action" ]] ; then
- __rvm_gemset_gemdir
+elif [[ "gemdir" = "$action" ]] || [[ "gempath" = "$action" ]] || [[ "gemhome" = "$action" ]] || [[ "home" = "$action" ]] || [[ "path" = "$action" ]] || [[ "version" = "$action" ]] ; then
+ __rvm_gemset_info
elif [[ "install" = "$action" ]] ; then
__rvm_gem_install $*
elif [[ "pristine" = "$action" ]] ; then
__rvm_gem_pristine $*
elif [[ "clear" = "$action" ]] ; then
$rvm_scripts_path/log "info" "gemset cleared."
exit 0
else
- $rvm_scripts_path/log "error" "Unrecognized gemset action '$action'.\n\nValid gems actions are: {create,use,import,export,copy,delete,empty,name,list,gemdir,install}"
+ $rvm_scripts_path/log "error" "Unrecognized gemset action '$action'.\n\nValid gems actions are: {import,export,create,copy,empty,delete,name,dir,list,gemdir,install,pristine,clear}"
fi
exit $?