scripts/upgrade in rvm-0.1.47 vs scripts/upgrade in rvm-1.0.0

- old
+ new

@@ -11,11 +11,11 @@ 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" exit "${2:-1}" @@ -31,34 +31,34 @@ while read -r ruby_name; do if [[ "$ruby_name" != "$expanded_destination"* ]]; then echo "$ruby_name" return 0 fi - done < <($rvm_scripts_path/list strings | tr ' ' '\n' | sort -ur | grep "^$prefix" | grep -v '-head$' | head -n1) + done < <($rvm_scripts_path/list strings | tr ' ' '\n' | sort -ur | \grep "^$prefix" | \grep -v '-head$' | head -n1) return 1 } upgrade_ruby() { [[ -z "$source_ruby" ]] && die_with_error "Unable to find a source ruby. Please manually provide one." - + expanded_source="$(expand_ruby_name "$source_ruby")" [[ -z "$expanded_source" ]] && die_with_error "The source ruby was not a valid ruby string." - + confirm "Are you sure you wish to upgrade from $expanded_source to $expanded_destination?" || die_with_error "Cancelling upgrade." - + if [[ ! -d "$rvm_rubies_path/$expanded_destination" ]]; then $rvm_scripts_path/log "info" "Installing new ruby $expanded_destination" $rvm_bin_path/rvm install "$expanded_destination" result="$?" [[ "$result" -gt 0 ]] && die_with_error "Unable to install ruby $expanded_destination. Please install it manually to continue." "$result" fi - + $rvm_scripts_path/log "info" "Migrating gems from $expanded_source to $expanded_destination" $rvm_scripts_path/migrate "$expanded_source" "$expanded_destination" result="$?" [[ "$result" -gt 0 ]] && die_with_error "Error migrating gems." "$result" - + $rvm_scripts_path/log "info" "Upgrade complete!" } [[ -z "$1" ]] && usage @@ -66,6 +66,6 @@ expanded_destination="$(expand_ruby_name "$destination_ruby")" [[ -z "$expanded_destination" ]] && die_with_error "The destination ruby was not a valid ruby string." source_ruby="${1:-"$(expand_existing_ruby "$destination_ruby")"}" -upgrade_ruby \ No newline at end of file +upgrade_ruby