scripts/gemsets in rvm-0.1.20 vs scripts/gemsets in rvm-0.1.21
- old
+ new
@@ -21,22 +21,23 @@
__rvm_gemset_dir() {
echo "$rvm_ruby_gem_home"
}
__rvm_gemset_create() {
+ rvm_ruby_gem_prefix=$(echo $rvm_ruby_gem_home | sed 's/%.*$//')
for gemset in $(echo $gems_args) ; do
- gem_home="$rvm_ruby_gem_home%${gems_args/ /}"
- mkdir -p $gem_home
+ gem_home="$rvm_ruby_gem_prefix%${gems_args/ /}"
+ mkdir -p $gem_home
ln -nfs "$HOME/.gem/cache" "$gem_home/cache"
$rvm_scripts_path/log "info" "Gemset '$gemset' created."
done ; unset gem_home
}
__rvm_gemset_list() {
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
- $rvm_scripts_path/log "info" "gems(ets) : for $rvm_ruby_string (found in $rvm_gems_path/)"
+ $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}%* ; do
echo "$gemdir" | awk -F'%' '{print $2}'
@@ -66,21 +67,21 @@
fi
else
$rvm_scripts_path/log "info" "$gemdir already does not exist."
fi ; unset gemdir
else
- $rvm_scripts_path/log "error" "A gems name must be specified in order to delete a gems."
+ $rvm_scripts_path/log "error" "A gemset name must be specified in order to delete a gems."
fi
}
__rvm_gemset_empty() {
if [[ -z "$rvm_ruby_selected_flag" ]] ; 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/*
elif [[ -d "$gemdir" ]] ; then
- $rvm_scripts_path/log "warn" "Are you SURE you wish to remove the installed gems for gemset '%$rvm_gemset_name' ($gemdir)?"
+ $rvm_scripts_path/log "warn" "Are you SURE you wish to remove the installed gemset for gemset '%$rvm_gemset_name' ($gemdir)?"
echo -n "(anything other than 'yes' will cancel) > "
read response
if [[ "yes" = "$response" ]] ; then
cd $gemdir && rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
else
@@ -94,14 +95,14 @@
# Migrate gemsets from ruby X to ruby Y
__rvm_gemset_copy() {
source_ruby="$(echo $gems_args | awk '{print $1}')"
destination_ruby="$(echo $gems_args | awk '{print $2}')"
if [[ -z "$source_ruby" ]] ; then
- $rvm_scripts_path/log "error" "Source and destination must be specified: 'rvm gems copy X Y'"
+ $rvm_scripts_path/log "error" "Source and destination must be specified: 'rvm gemset copy X Y'"
fi
if [[ -z "$destination_ruby" ]] ; then
- $rvm_scripts_path/log "error" "Source and destination must be specified: 'rvm gems copy X Y'"
+ $rvm_scripts_path/log "error" "Source and destination must be specified: 'rvm gemset copy X Y'"
fi
source_path="$($rvm_bin_path/rvm $source_ruby gem env gemdir | tail -n 1)"
destination_path="$($rvm_bin_path/rvm $destination_ruby gem env gemdir | tail -n 1)"
if [[ -d "$source_path" ]] ; then
@@ -133,11 +134,11 @@
else
rvm_file_name="default.gems"
fi
fi
- $rvm_scripts_path/log "info" "Exporting current environments gems to $rvm_file_name"
+ $rvm_scripts_path/log "info" "Exporting current environments gemset to $rvm_file_name"
touch $rvm_file_name
echo "# $rvm_file_name generated gem export 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}')"
@@ -316,10 +317,11 @@
exit 1
fi
action="$(echo $* | awk '{print $1}')"
gems_args=$(echo "$*" | awk '{$1="" ; print}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
+export rvm_gemset_name
if [[ "import" = "$action" ]] || [[ "load" = "$action" ]] ; then
__rvm_gemset_import
elif [[ "export" = "$action" ]] || [[ "dump" = "$action" ]] ; then
__rvm_gemset_export
@@ -343,9 +345,9 @@
__rvm_gem_install $*
elif [[ "clear" = "$action" ]] ; then
$rvm_scripts_path/log "info" "gemset cleared."
exit 0
else
- $rvm_scripts_path/log "error" "Unrecognized gems 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: {create,use,import,export,copy,delete,empty,name,list,gemdir,install}"
fi
exit $?