scripts/migrate in rvm-1.0.6 vs scripts/migrate in rvm-1.0.7
- old
+ new
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
unset GREP_OPTIONS
-source "$rvm_scripts_path/base"
+source "$rvm_path/scripts/base"
usage() {
echo "Usage: rvm migrate from to" >&2
echo "Moves all gemsets from one ruby to another." >&2
}
@@ -18,16 +18,16 @@
[[ -z "$confirmation_response" ]] || echo "$confirmation_response" | \grep -qi '^y'
}
die_with_error() {
- "$rvm_scripts_path/log" "fail" "$1"
+ "$rvm_path/scripts/log" "fail" "$1"
exit "${2:-1}"
}
expand_ruby_name() {
- "$rvm_scripts_path/tools" strings "$1" | awk -F"$rvm_gemset_separator" '{print $1}'
+ "$rvm_path/scripts/tools" strings "$1" | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}'
}
migrate_rubies() {
local origin_gemset destination_gemset gemset_name migrate_ruby_name migrate_alias_name migrate_new_alias_name binaries origin_wrappers_path full_bin_path expanded_symlink linked_binary_name new_wrapper_destination
@@ -55,18 +55,18 @@
confirm "This will overwrite existing gems in $expanded_destination and remove them from $expanded_source" || return 1
echo "Moving gemsets..."
while read -r origin_gemset; do
- [[ "$origin_gemset" = "$expanded_source" || "$origin_gemset" = "$expanded_source$rvm_gemset_separator"* ]] || continue
+ [[ "$origin_gemset" = "$expanded_source" || "$origin_gemset" = "${expanded_source}${rvm_gemset_separator:-"@"}"* ]] || continue
- gemset_name="${origin_gemset/*${rvm_gemset_separator}/}"
+ 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"
+ destination_gemset="${destination_gemset}${rvm_gemset_separator:-"@"}${gemset_name}"
fi
echo "Moving $origin_gemset to $destination_gemset"
rm -rf "$rvm_gems_path/$destination_gemset"
@@ -81,42 +81,42 @@
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_path/scripts/list" gemsets strings | \grep "^$expanded_source")
if confirm 'Do you wish to move over aliases?' ; then
while read -r alias_pair; do
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
+ 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_path/scripts/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_path/scripts/alias" create "$migrate_alias_name" "$migrate_new_alias_name" >/dev/null 2>&1
fi
done < "$rvm_config_path/alias"
fi
if confirm "Do you wish to move over wrappers?" ; then
origin_wrappers_path="$rvm_wrappers_path/$expanded_source"
- binaries=($(cd "$rvm_bin_path" ; find * -type f -maxdepth 0))
+ binaries=($(cd "$rvm_bin_path" ; find . -maxdepth 1 -mindepth 1 -type f))
- for binary_name in "${binaries[@]}" ; do
+ for binary_name in "${binaries[@]//.\/}" ; do
full_bin_path="$rvm_bin_path/$binary_name"
[[ ! -L "$full_bin_path" ]] && continue