scripts/migrate in rvm-1.0.1 vs scripts/migrate in rvm-1.0.2

- old
+ new

@@ -12,20 +12,20 @@ confirm() { printf "$1 (Y/n): " local confirmation_response read -r confirmation_response - [[ -z "$confirmation_response" ]] || echo "$confirmation_response" | grep -qi '^y' + [[ -z "$confirmation_response" ]] || echo "$confirmation_response" | \grep -qi '^y' } die_with_error() { - $rvm_scripts_path/log "fail" "$1" + "$rvm_scripts_path/log" "fail" "$1" exit "${2:-1}" } expand_ruby_name() { - $rvm_scripts_path/tools strings "$1" | awk -F"$rvm_gemset_separator" '{print $1}' + "$rvm_scripts_path/tools" strings "$1" | awk -F"$rvm_gemset_separator" '{print $1}' } migrate_rubies() { expanded_source="$(expand_ruby_name "$source_ruby")" expanded_destination="$(expand_ruby_name "$destination_ruby")" @@ -47,11 +47,11 @@ echo "Moving gemsets..." while read -r origin_gemset; do [[ "$origin_gemset" = "$expanded_source" || "$origin_gemset" = "$expanded_source$rvm_gemset_separator"* ]] || continue - gemset_name="$(echo "$origin_gemset" | awk -F"$rvm_gemset_separator" '{print $2}')" + gemset_name="${origin_gemset/*${rvm_gemset_separator}/}" destination_gemset="$expanded_destination" if [[ -n "$gemset_name" ]]; then destination_gemset="$destination_gemset$rvm_gemset_separator$gemset_name" fi echo "Moving $origin_gemset to $destination_gemset" @@ -62,32 +62,31 @@ mv "$rvm_gems_path/$origin_gemset" "$rvm_gems_path/$destination_gemset" result="$?" [[ "$result" -gt "0" ]] && die_with_error "Unable to move '$rvm_gems_path/$origin_gemset' to '$rvm_gems_path/$destination_gemset'" "$result" - echo "Making gemset $destination_gemset pristine." __rvm_run_with_env "gemset.pristine" "$destination_gemset" "rvm gemset pristine" - done < <($rvm_scripts_path/list gemsets strings | grep "^$expanded_source") + done < <("$rvm_scripts_path/list" gemsets strings | \grep "^$expanded_source") unset origin_gemset destination_gemset gemset_name if confirm 'Do you wish to move over aliases?' ; then while read -r alias_pair; do - migrate_ruby_name="$(echo "$alias_pair" | awk -F= '{print $2}')" - migrate_alias_name="$(echo "$alias_pair" | awk -F= '{print $1}')" + migrate_ruby_name="${alias_pair/*=/}" + migrate_alias_name="${alias_pair/=*/}" if [[ "$migrate_ruby_name" = "$expanded_source" || "$migrate_ruby_name" = "$expanded_source$rvm_gemset_separator"* ]]; then migrate_new_alias_name="${migrate_ruby_name/$expanded_source/$expanded_destination}" echo "Updating alias $migrate_alias_name to point to $migrate_new_alias_name" - $rvm_scripts_path/alias delete "$migrate_alias_name" >/dev/null 2>&1 - $rvm_scripts_path/alias create "$migrate_alias_name" "$migrate_new_alias_name" >/dev/null 2>&1 + "$rvm_scripts_path/alias" delete "$migrate_alias_name" >/dev/null 2>&1 + "$rvm_scripts_path/alias" create "$migrate_alias_name" "$migrate_new_alias_name" >/dev/null 2>&1 fi done < "$rvm_config_path/alias" unset migrate_ruby_name migrate_alias_name migrate_new_alias_name fi if confirm "Do you wish to move over wrappers?" ; then origin_wrappers_path="$rvm_wrappers_path/$expanded_source" - for binary_name in $(\ls $rvm_bin_path) ; do + for binary_name in $(\ls "$rvm_bin_path") ; do full_bin_path="$rvm_bin_path/$binary_name" [[ ! -L "$full_bin_path" ]] && continue expanded_symlink="$(readlink "$full_bin_path")" [[ "$expanded_symlink" != "$origin_wrappers_path/"* ]] && continue linked_binary_name="$(basename "$expanded_symlink")"