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

- old
+ new

@@ -1,10 +1,11 @@ #!/usr/bin/env bash default_flag="$rvm_default_flag" + # Prevent recursion -unset rvm_default_flag rvm_wrapper_name +unset rvm_default_flag rvm_wrapper_name prefix source "$rvm_path/scripts/base" usage() { printf " @@ -34,11 +35,11 @@ if [[ -s \"$rvm_path/environments/${environment_identifier}\" ]] ; then \\. \"$rvm_path/environments/${environment_identifier}\" exec $binary_name \"\$@\" else - echo \"ERROR: Missing RVM environment file: '${rvm_environments_path}/${environment_identifier}'\" + echo \"ERROR: Missing RVM environment file: '$rvm_path/environments/${environment_identifier}'\" exit 1 fi " > "$file_name" if [[ -f "$file_name" ]] ; then chmod +x "$file_name" ; fi @@ -53,23 +54,30 @@ symlink_binary() { # Generate the default wrapper with the given binary name. # We first check if we can wrap the binary and if we were able to, # we then symlink it into place. if wrap_binary && [[ -f "$file_name" ]]; then - rm -f "${rvm_bin_path}/${prefix}_${binary_name}" - ln -fs "$file_name" "${rvm_bin_path}/${prefix}_${binary_name}" + rm -f "${rvm_bin_path:-"$rvm_path/bin"}/${prefix}_${binary_name}" + + ln -fs "$file_name" "${rvm_bin_path:-"$rvm_path/bin"}/${prefix}_${binary_name}" + fi } wrap_binary() { # We wrap when the given binary is in the path or override_check is set to one. if [[ "$override_check" = "1" ]] || command -v $binary_name > /dev/null; then + wrap + else + "$rvm_path/scripts/log" "error" "Binary '$binary_name' not found in path." + return 1 + fi } # Empty ruby string: show usage and exit. if [[ "$#" -eq 0 ]] ; then @@ -102,11 +110,11 @@ # For each binary, we want to generate the wrapper / symlink # it to the existing wrapper if needed. for binary_name in "${binaries[@]}"; do - file_name="${rvm_wrappers_path}/${environment_identifier}/${binary_name}" + file_name="$rvm_path/wrappers/${environment_identifier}/${binary_name}" if [[ -z "$prefix" ]] ; then override_check=1 @@ -114,28 +122,33 @@ # Symlink it into place. if [[ -f "$file_name" ]]; then if [[ "$binary_name" == "ruby" ]] ; then - destination="$rvm_bin_path/$environment_identifier" + + destination="${rvm_bin_path:-"$rvm_path/bin"}/$environment_identifier" + else - destination="$rvm_bin_path/${binary_name}-${environment_identifier}" + + destination="${rvm_bin_path:-"$rvm_path/bin"}/${binary_name}-${environment_identifier}" + fi rm -rf "$destination" ln -nsf "$file_name" "$destination" + fi; unset destination elif [[ "$prefix" == "--no-prefix" ]]; then override_check=1 wrap_binary if [[ -f "$file_name" ]]; then - destination="$rvm_bin_path/$binary_name" + destination="${rvm_bin_path:-"$rvm_path/bin"}/$binary_name" if [[ -s "$destination" ]] ; then rm -rf "$destination" fi