scripts/gemsets in rvm-1.0.4 vs scripts/gemsets in rvm-1.0.5
- old
+ new
@@ -197,48 +197,57 @@
fi ; unset gemdir
}
# Migrate gemsets from ruby X to ruby Y
gemset_copy() {
- local source_ruby="${gems_args/ */}"
- local destination_ruby="${gems_args/* /}"
+ local source_ruby="${args[1]:-""}"
+ local destination_ruby="${args[2]:-""}"
if [[ -z "$destination_ruby" || -z "$source_ruby" ]] ; then
"$rvm_scripts_path/log" "error" "Source and destination must be specified: 'rvm gemset copy X Y'"
return 1
fi
+ # TODO: Account for more possibilities:
+ # rvm gemset copy 1.9.2 @gemsetb # From 1.9.2 default to current ruby, 1.9.2 exists.
+ # rvm gemset copy @gemseta @gemsetb # Current ruby, gemseta exists.
+ # rvm gemset copy gemseta gemsetb # Currenty Ruby, gemseta exists.
+ # rvm gemset copy gemseta 1.8.7@gemsetb # Currenty Ruby@gemseta, current ruby@gemseta exists.
+
local source_path="$(rvm_silence_logging=1 rvm "$source_ruby" gem env gemdir)"
local destination_path="$(rvm_silence_logging=1 rvm "$destination_ruby" gem env gemdir)"
- if [[ -z "$source_path" ]]; then
- "$rvm_scripts_path/log" "error" "Unable to expand ruby '$source_ruby'"
+ if [[ -z "$source_path" || ! -d "$source_path" ]]; then
+ "$rvm_scripts_path/log" "error" "Unable to expand '$source_ruby' or directory does not exist."
return 1
fi
if [[ -z "$destination_path" ]]; then
- "$rvm_scripts_path/log" "error" "Unable to expand ruby '$destination_ruby'"
+ "$rvm_scripts_path/log" "error" "Unable to expand '$destination_ruby'"
return 1
fi
if [[ -d "$source_path" ]] ; then
- [[ ! -d "$destination_path" ]] && mkdir -p "$destination_path"
+
"$rvm_scripts_path/log" "info" "Copying gemset from $source_ruby to $destination_ruby"
+
for dir in bin doc gems specifications cache ; 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_run_with_env "gemset.pristine" "$destination_ruby" "rvm gemset pristine"
else
"$rvm_scripts_path/log" "error" "Gems directory does not exist for $source_path ($source_path)"
return 1
fi
}
gemset_export() {
- rvm_file_name="${rvm_file_name:-$gems_args}"
+ rvm_file_name="${rvm_file_name:-${gems_args// }}"
if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
export GEM_HOME="$rvm_ruby_gem_home"
export GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_gems_path/$rvm_ruby_string${rvm_gemset_separator}global/bin"
export BUNDLE_PATH="$rvm_ruby_gem_home"
@@ -501,10 +510,10 @@
args=($*)
action="${args[0]}"
gems_args="$(echo ${args[@]:1}) " # Strip trailing / leading / extra spacing.
-export rvm_gemset_name="${args[1]}" # For wherever used.
+export rvm_gemset_name="${args[1]:-""}" # For wherever used.
rvm_sticky_flag=1
if [[ "import" = "$action" ]] || [[ "load" = "$action" ]] ; then
if [[ -z "$rvm_ruby_strings" ]]; then
gemset_import