Skip to content

Commit

Permalink
osx does not support version sorting, thanks god for ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
mpapis committed Mar 19, 2012
1 parent e07cea7 commit 5282c23
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/rubygems
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ can_switch_rubygems()

rubygems_version_list()
{
curl -s https://api.github.com/repos/rubygems/rubygems/tags | sed -n '/"name": / {s/^.*".*": "\(.*\)".*$/\1/; p}' | sort -V
curl -s https://api.github.com/repos/rubygems/rubygems/tags |
sed -n '/"name": / {s/^.*".*": "v\(.*\)".*$/\1/; p;}' |
"${rvm_ruby_binary:-ruby}" -e 'arr=[]; while a=gets() do arr<<a; end; puts arr.map{|a| a.split(/\./).map(&:to_i) }.sort.map{|a| a * "."};'
}

rubygems_master_sha()
{
curl -s "https://api.github.com/repos/rubygems/rubygems/commits?page=last&per_page=1" | sed -n '/^ "sha":/ {s/^.*".*": "\(.*\)".*$/\1/;p}'
curl -s "https://api.github.com/repos/rubygems/rubygems/commits?page=last&per_page=1" | sed -n '/^ "sha":/ {s/^.*".*": "\(.*\)".*$/\1/;p;}'
}

rubygems_select_version_url()
Expand Down Expand Up @@ -88,8 +90,8 @@ rubygems_select_version_url()
case "$version" in
latest-*)
version="${version#latest-}"
version="$(rubygems_version_list | grep "^v${version}\." | tail -n 1 )"
version="${version#v}"
version="$(rubygems_version_list | grep "^${version}\." | tail -n 1 )"
version="${version}"
;;
esac

Expand Down

0 comments on commit 5282c23

Please sign in to comment.