scripts/migrate in rvm-1.0.7 vs scripts/migrate in rvm-1.0.8

- old
+ new

@@ -3,12 +3,21 @@ unset GREP_OPTIONS source "$rvm_path/scripts/base" usage() { - echo "Usage: rvm migrate from to" >&2 - echo "Moves all gemsets from one ruby to another." >&2 + printf " + + Usage: + + rvm migrate {source-ruby} {destination-ruby} + + Description: + + Moves all gemsets from {source-ruby} ruby to {destination-ruby}. + +" >&2 } confirm() { local confirmation_response @@ -41,14 +50,14 @@ die_with_error "Could not expand destination ruby '$destination_ruby'" elif [[ "$expanded_destination" = "$expanded_source" ]]; then die_with_error "Source and Destination Ruby are the same ($expanded_destination)" - elif [[ ! -d "$rvm_rubies_path/$expanded_source" ]]; then + elif [[ ! -d "$rvm_path/rubies/$expanded_source" ]]; then die_with_error "Ruby '$expanded_source' is not installed - please install it first." - elif [[ ! -d "$rvm_rubies_path/$expanded_destination" ]]; then + elif [[ ! -d "$rvm_path/rubies/$expanded_destination" ]]; then die_with_error "Ruby '$expanded_destination' is not installed - please install it first." fi echo "Are you sure you wish to MOVE gems from $expanded_source to $expanded_destination?" @@ -67,19 +76,19 @@ destination_gemset="${destination_gemset}${rvm_gemset_separator:-"@"}${gemset_name}" fi echo "Moving $origin_gemset to $destination_gemset" - rm -rf "$rvm_gems_path/$destination_gemset" + rm -rf "${rvm_gems_path:-"$rvm_path/gems"}/$destination_gemset" result="$?" - [[ $result -gt 0 ]] && die_with_error "Unable to remove gem directory '$rvm_gems_path/$destination_gemset'" "$result" + [[ $result -gt 0 ]] && die_with_error "Unable to remove gem directory '${rvm_gems_path:-"$rvm_path/gems"}/$destination_gemset'" "$result" - mv "$rvm_gems_path/$origin_gemset" "$rvm_gems_path/$destination_gemset" + mv "${rvm_gems_path:-"$rvm_path/gems"}/$origin_gemset" "${rvm_gems_path:-"$rvm_path/gems"}/$destination_gemset" result="$?" - [[ $result -gt 0 ]] && die_with_error "Unable to move '$rvm_gems_path/$origin_gemset' to '$rvm_gems_path/$destination_gemset'" "$result" + [[ $result -gt 0 ]] && die_with_error "Unable to move '${rvm_gems_path:-"$rvm_path/gems"}/$origin_gemset' to '${rvm_gems_path:-"$rvm_path/gems"}/$destination_gemset'" "$result" echo "Making gemset $destination_gemset pristine." __rvm_run_with_env "gemset.pristine" "$destination_gemset" "rvm gemset pristine" @@ -103,22 +112,22 @@ "$rvm_path/scripts/alias" delete "$migrate_alias_name" >/dev/null 2>&1 "$rvm_path/scripts/alias" create "$migrate_alias_name" "$migrate_new_alias_name" >/dev/null 2>&1 fi - done < "$rvm_config_path/alias" + done < "$rvm_path/config/alias" fi if confirm "Do you wish to move over wrappers?" ; then - origin_wrappers_path="$rvm_wrappers_path/$expanded_source" + origin_wrappers_path="$rvm_path/wrappers/$expanded_source" - binaries=($(cd "$rvm_bin_path" ; find . -maxdepth 1 -mindepth 1 -type f)) + binaries=($(cd "${rvm_bin_path:-"$rvm_path/bin"}" ; find . -maxdepth 1 -mindepth 1 -type f)) for binary_name in "${binaries[@]//.\/}" ; do - full_bin_path="$rvm_bin_path/$binary_name" + full_bin_path="${rvm_bin_path:-"$rvm_path/bin"}/$binary_name" [[ ! -L "$full_bin_path" ]] && continue expanded_symlink="$(readlink "$full_bin_path")"