Permalink
Browse files

extract rbx nightly hanling to a function, add new macruby nightly ha…

…ndling, update #1584
  • Loading branch information...
1 parent c10b73f commit b4a899c0f93c836b432273654aebe0f55ba427fa @mpapis mpapis committed Apr 1, 2013
Showing with 79 additions and 46 deletions.
  1. +1 −2 config/db
  2. +78 −44 scripts/selector
View
@@ -62,11 +62,10 @@ jruby_version=1.7.3
jruby_repo_url=git://github.com/jruby/jruby.git
jruby_url=http://jruby.org.s3.amazonaws.com/downloads
macruby_version=0.12
-macruby_nightly_version=0.13
macruby_0.10_url=http://macruby.macosforge.org/files
macruby_url=https://github.com/downloads/MacRuby/MacRuby
macruby_repo_url=git://github.com/MacRuby/MacRuby.git
-macruby_nightly_url=http://macruby.macosforge.org/files/nightlies/macruby_nightly-latest.pkg
+macruby_nightly_url=http://macruby.jp/files/nightlies
maglev_version=head
maglev_url=http://glass-downloads.gemstone.com/maglev
maglev_repo_url=git://github.com/MagLev/maglev.git
View
@@ -1,5 +1,80 @@
#!/usr/bin/env bash
+__rvm_select_rbx_nightly()
+{
+ (( ${rvm_nightly_flag:=0} == 1 )) || return 0
+
+ typeset org_rvm_ruby_patch_level _rvm_ruby_name
+ if [[ "$rvm_ruby_version" == head ]]
+ then rvm_ruby_version=""
+ fi
+ rvm_debug "searching for binary rbx ${rvm_ruby_version:-}${rvm_ruby_version:+-}${rvm_ruby_patch_level}*${rvm_ruby_name:+-}${rvm_ruby_name:-}"
+ org_rvm_ruby_patch_level="$rvm_ruby_patch_level"
+ _rvm_ruby_name="${rvm_ruby_name:-${detected_rvm_ruby_name:-}}"
+ rvm_ruby_patch_level="$(
+ __list_remote_rbx_for $( __rvm_system_path_for rbx ) |
+ GREP_OPTIONS="" \grep ${rvm_ruby_version:-}${rvm_ruby_version:+-}${org_rvm_ruby_patch_level}.*${_rvm_ruby_name:+-}${_rvm_ruby_name:-} |
+ tail -n 1
+ )"
+ [[ -n "${rvm_ruby_patch_level:-}" ]] ||
+ {
+ rvm_error "Could not find rbx binary '${rvm_ruby_version:-}${rvm_ruby_version:+-}${org_rvm_ruby_patch_level}*${rvm_ruby_name:+-}${rvm_ruby_name:-}' release for '$( __rvm_system_path_for rbx )'."
+ return 1
+ }
+ rvm_ruby_patch_level="${rvm_ruby_patch_level##*/}"
+ rvm_ruby_patch_level="${rvm_ruby_patch_level%.tar.*}"
+ if
+ [[ -z "${rvm_ruby_version:-}" ]]
+ then
+ rvm_ruby_patch_level="${rvm_ruby_patch_level#rubinius-}"
+ rvm_ruby_version="${rvm_ruby_patch_level%%-*}"
+ fi
+ if
+ [[ -z "${rvm_ruby_name:-}" ]]
+ then
+ rvm_ruby_name="${rvm_ruby_patch_level##*-}"
+ fi
+ rvm_ruby_patch_level="${rvm_ruby_patch_level##*${org_rvm_ruby_patch_level}}"
+ rvm_ruby_patch_level="${rvm_ruby_patch_level%%-*}"
+ rvm_ruby_patch_level="${org_rvm_ruby_patch_level}${rvm_ruby_patch_level}"
+ rvm_ruby_string="rubinius-${rvm_ruby_version}-${rvm_ruby_patch_level}-${rvm_ruby_name}"
+ rvm_debug "detected rbx ${rvm_ruby_string}"
+ rvm_verify_downloads_flag=1
+}
+
+__rvm_select_macruby_nightly()
+{
+ __rvm_db "macruby_nightly_url" "rvm_ruby_url"
+ if
+ [[ "${rvm_ruby_version}" == "nightly" ]]
+ then
+ # detect latest version from server
+ rvm_ruby_version="$(
+ __rvm_curl -s "$rvm_ruby_url" |
+ GREP_OPTIONS="" \grep -oE "<a href=\"macruby_nightly-[^<]+\.pkg</a>" |
+ awk -F"[<>]" '{print $3}' | sort | tail -n 1
+ )"
+ [[ -n "${rvm_ruby_version}" ]] ||
+ {
+ rvm_error "Could not find MacRuby nightly binary."
+ return 1
+ }
+ rvm_ruby_version="${rvm_ruby_version#macruby_nightly-}"
+ rvm_ruby_version="${rvm_ruby_version%.pkg}"
+ rvm_ruby_string="macruby_nightly-${rvm_ruby_version}${rvm_ruby_name:+-}${rvm_ruby_name:-}"
+ rvm_debug "detected macruby nightly ${rvm_ruby_version}"
+ else
+ # allow specifying nightly[.]2013.03.31
+ rvm_ruby_version="${rvm_ruby_version#nightly}"
+ rvm_ruby_version="${rvm_ruby_version#.}"
+ rvm_ruby_version="${rvm_ruby_version//./-}"
+ fi
+ rvm_ruby_package_name="${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}"
+ rvm_ruby_package_file="$rvm_ruby_package_name.pkg"
+ rvm_ruby_url+="/${rvm_ruby_package_file}"
+ rvm_verify_downloads_flag=1
+}
+
# __rvm_select implementation version patch_level
__rvm_select()
{
@@ -68,11 +143,9 @@ __rvm_select()
rvm_ruby_url="$rvm_ruby_repo_url"
rvm_disable_binary_flag=1
- elif [[ "nightly" == "${rvm_ruby_version:-}" ]]
+ elif [[ "${rvm_ruby_version:-}" =~ "nightly" ]]
then
- __rvm_db "macruby_nightly_url" "rvm_ruby_url"
- rvm_ruby_package_name="${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}"
- rvm_ruby_package_file="$rvm_ruby_package_name"
+ __rvm_select_macruby_nightly
elif [[ -n "${rvm_ruby_version:-}" ]]
then
@@ -96,46 +169,7 @@ __rvm_select()
;;
rbx|rubinius)
- if
- (( ${rvm_nightly_flag:=0} == 1 ))
- then
- typeset org_rvm_ruby_patch_level _rvm_ruby_name
- if [[ "$rvm_ruby_version" == head ]]
- then rvm_ruby_version=""
- fi
- rvm_debug "searching for binary rbx ${rvm_ruby_version:-}${rvm_ruby_version:+-}${rvm_ruby_patch_level}*${rvm_ruby_name:+-}${rvm_ruby_name:-}"
- org_rvm_ruby_patch_level="$rvm_ruby_patch_level"
- _rvm_ruby_name="${rvm_ruby_name:-${detected_rvm_ruby_name:-}}"
- rvm_ruby_patch_level="$(
- __list_remote_rbx_for $( __rvm_system_path_for rbx ) |
- GREP_OPTIONS="" \grep ${rvm_ruby_version:-}${rvm_ruby_version:+-}${org_rvm_ruby_patch_level}.*${_rvm_ruby_name:+-}${_rvm_ruby_name:-} |
- tail -n 1
- )"
- [[ -n "${rvm_ruby_patch_level:-}" ]] ||
- {
- rvm_error "Could not find rbx binary '${rvm_ruby_version:-}${rvm_ruby_version:+-}${org_rvm_ruby_patch_level}*${rvm_ruby_name:+-}${rvm_ruby_name:-}' release for '$( __rvm_system_path_for rbx )'."
- return 1
- }
- rvm_ruby_patch_level="${rvm_ruby_patch_level##*/}"
- rvm_ruby_patch_level="${rvm_ruby_patch_level%.tar.*}"
- if
- [[ -z "${rvm_ruby_version:-}" ]]
- then
- rvm_ruby_patch_level="${rvm_ruby_patch_level#rubinius-}"
- rvm_ruby_version="${rvm_ruby_patch_level%%-*}"
- fi
- if
- [[ -z "${rvm_ruby_name:-}" ]]
- then
- rvm_ruby_name="${rvm_ruby_patch_level##*-}"
- fi
- rvm_ruby_patch_level="${rvm_ruby_patch_level##*${org_rvm_ruby_patch_level}}"
- rvm_ruby_patch_level="${rvm_ruby_patch_level%%-*}"
- rvm_ruby_patch_level="${org_rvm_ruby_patch_level}${rvm_ruby_patch_level}"
- rvm_ruby_string="rubinius-${rvm_ruby_version}-${rvm_ruby_patch_level}-${rvm_ruby_name}"
- rvm_debug "detected rbx ${rvm_ruby_string}"
- rvm_verify_downloads_flag=1
- fi
+ __rvm_select_rbx_nightly || return $?
rvm_archive_extension="tar.gz"
rvm_ruby_interpreter="rbx"

0 comments on commit b4a899c

Please sign in to comment.