Permalink
Browse files

use more of __rvm_version_sort, fix #2676

  • Loading branch information...
mpapis committed Mar 7, 2014
1 parent 25a89fe commit 6e7a9598eeba2ddc7a05982b81ad80deb2e5121b
View
@@ -308,7 +308,8 @@ __rvm_mri_rubies()
# with things like rbx etc which require a ruby be installed.
__rvm_mri_ruby()
{
- __rvm_mri_rubies "${1:-"ruby-1.9|ruby-2"}" | sort |
+ __rvm_mri_rubies "${1:-"ruby-1.9|ruby-2"}" |
+ __rvm_version_sort |
__rvm_awk 'BEGIN{ selected=$0 } /'"$(__rvm_env_string)"'/{ selected=$0 } END {print $0}'
}
@@ -111,8 +111,10 @@ __rvm_setup_compile_environment_system_BSD()
then
export AUTOCONF_VERSION
AUTOCONF_VERSION="$(
- ls -1 /usr/local/bin/autoreconf-* | __rvm_awk -F- '{print $NF}' |
- __rvm_version_sort | __rvm_tail -n 1
+ ls -1 /usr/local/bin/autoreconf-* |
+ __rvm_awk -F- '{print $NF}' |
+ __rvm_version_sort |
+ __rvm_tail -n 1
)"
fi
if
@@ -121,8 +123,10 @@ __rvm_setup_compile_environment_system_BSD()
export AUTOMAKE_VERSION
# FreeBSD might have automake-wrapper
AUTOMAKE_VERSION="$(
- ls -1 /usr/local/bin/automake-1* | __rvm_awk -F- '{print $NF}' |
- __rvm_version_sort | __rvm_tail -n 1
+ ls -1 /usr/local/bin/automake-1* |
+ __rvm_awk -F- '{print $NF}' |
+ __rvm_version_sort |
+ __rvm_tail -n 1
)"
fi
}
@@ -127,7 +127,9 @@ requirements_version_minimal()
then return 0
fi
typeset latest_version="$(
- requirements_${__lib_type}_version_list $1 | __rvm_version_sort | __rvm_tail -n 1
+ requirements_${__lib_type}_version_list $1 |
+ __rvm_version_sort |
+ __rvm_tail -n 1
)"
if
[[ -z "${latest_version}" ]] ||
@@ -168,7 +168,9 @@ requirements_osx_port_install_port()
macports_version="$(
__rvm_curl https://distfiles.macports.org/MacPorts/ |
__rvm_grep -Eo "<a href=\"MacPorts-[[:digit:]\.]+.tar.bz2\">" |
- __rvm_awk -F'"' '{print $2}' | sort | __rvm_tail -n 1
+ __rvm_awk -F'"' '{print $2}' |
+ __rvm_version_sort |
+ __rvm_tail -n 1
)" #'
macports_version="${macports_version%.tar.bz2}"
: macports_version:${macports_version:=MacPorts-2.1.3}
@@ -371,7 +371,7 @@ __rvm_ruby_string_autodetect()
__rvm_list_strings |
__rvm_grep "^${rvm_ruby_interpreter}-.*${rvm_ruby_name:-}" |
__rvm_awk -F- '{print $2}' |
- \sort |
+ __rvm_version_sort |
__rvm_tail -n 1
)"
fi
@@ -410,7 +410,7 @@ __rvm_ruby_string_autodetect()
new_ruby_string="$(
__rvm_list_strings |
__rvm_grep "^${rvm_ruby_string}.*${rvm_ruby_name:-}" |
- \sort |
+ __rvm_version_sort |
__rvm_tail -n 1
)"
rvm_ruby_string="${new_ruby_string:-$rvm_ruby_string}"
@@ -436,7 +436,7 @@ __rvm_ruby_string_autodetect()
__rvm_list_strings |
__rvm_grep "^${rvm_ruby_interpreter}-${rvm_ruby_version}-.*${rvm_ruby_name:-}" |
__rvm_awk -F- '{print $3}' |
- \sort |
+ __rvm_version_sort |
__rvm_tail -n 1
)"
fi
@@ -82,7 +82,9 @@ __rvm_select_macruby_nightly_detect()
rvm_ruby_version="$(
__rvm_curl -s "$rvm_ruby_url" |
__rvm_grep -oE "<a href=\"macruby_nightly-[^<]+\.pkg</a>" |
- __rvm_awk -F"[<>]" '{print $3}' | sort | __rvm_tail -n 1
+ __rvm_awk -F"[<>]" '{print $3}' |
+ __rvm_version_sort |
+ __rvm_tail -n 1
)"
[[ -n "${rvm_ruby_version}" ]] ||
{
@@ -17,7 +17,8 @@ __rvm_select_late_rbx_partial()
__found="$(
__rvm_curl -s $1/index.txt "rubinius-$1" |
__rvm_awk -F"${__ext}" "/${__patern}/"'{print $1}' |
- \sort | \tail -n 1
+ __rvm_version_sort |
+ __rvm_tail -n 1
)"
if
[[ -n "${__found}" ]]
@@ -7,7 +7,7 @@ __rvm_ruby_string_fuzzy_remote_for()
new_ruby_string="$(
__list_remote_$1_for $( __rvm_system_path_for ${2:-$1} ) |
__rvm_awk -F/ '{x=$NF; gsub(".tar.*","",x); gsub("jruby-bin","jruby",x); print x}' |
- \sort -V |
+ __rvm_version_sort |
__rvm_awk '
BEGIN{found=""; any=""}
/^'"${__search}"'$/ {found=$1}
@@ -36,7 +36,10 @@ __rvm_ruby_string_fuzzy()
then __search="${__search%${rvm_ruby_name:-}}.*${rvm_ruby_name:-}"
fi
new_ruby_string="$(
- __rvm_list_strings | __rvm_grep "${__search}" | \sort | __rvm_tail -n 1
+ __rvm_list_strings |
+ __rvm_grep "${__search}" |
+ __rvm_version_sort |
+ __rvm_tail -n 1
)"
if [[ -n "${new_ruby_string}" ]]
then rvm_ruby_string="${new_ruby_string}"
@@ -255,7 +258,8 @@ __rvm_ruby_string_latest()
new_ruby_string="$(
\cat "$rvm_path/config/known_strings" |
__rvm_grep "${check_ruby_string}" |
- sort | __rvm_tail -n 1
+ __rvm_version_sort |
+ __rvm_tail -n 1
)"
if
[[ -n "${new_ruby_string}" ]]
@@ -181,7 +181,7 @@ __rvm_detect_xcode_version_at_least()
# TODO: better semver support
__rvm_version_sort()
{
- LC_ALL=C sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n
+ LC_ALL=C \sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n
}
__rvm_version_compare()

0 comments on commit 6e7a959

Please sign in to comment.