--- a/rails.eselect 2008-12-01 21:48:01.000000000 +0100 +++ b/rails.eselect 2008-12-01 21:48:13.000000000 +0100 @@ -165,30 +165,11 @@ do_update() { - if [[ ${#} -ne 1 ]]; then - die -q "Usage error: requires a slot to update" - fi - - local slot=${1} - - # symlink exists - if [[ -L "${RAILS}" ]] ; then - # update it if it's the same slot - if [[ $(get_version) =~ ${slot} ]]; then - set_symlink_by_slot ${slot} - - # set to highest if it's set to some slot that isn't around anymore - elif [[ ! -f $(canonicalise ${RAILS}) ]]; then - set_symlink_default - # ignore - else - write_warning_msg "Current implementation, $(get_version), is not in slot ${slot}. Ignoring." - fi - # if it's a file, just warn about it being in the way - elif [[ -e ${RAILS} ]]; then - write_warning_msg "Can't set a new rails provider. There's a file in the way at ${RAILS}. You can try removing it manually, and then re-running this command." - # nothing set, so set to 1st, which is highest available - else + # Only set a symlink if there are any version of rails present + target=1 + targets=( $(find_targets ) ) + target=${targets[$(( ${target} - 1 ))]} + if [[ -f "${ROOT}/usr/bin/${target}" ]] ; then set_symlink_default fi }