Permalink
Browse files

add support for binary rbx, closes #1378

  • Loading branch information...
1 parent 47fc031 commit 0a1ba869e4681ee15eba78effff57ed6d8cea42b @mpapis mpapis committed Jan 8, 2013
Showing with 46 additions and 17 deletions.
  1. +1 −0 config/db
  2. +44 −16 scripts/external
  3. +1 −1 scripts/functions/utility
View
1 config/db
@@ -76,6 +76,7 @@ ironruby_1.1.3_url=http://download-codeplex.sec.s-msft.com/Download/Release?Proj
rvm_remote_server_url=https://rvm.io/binaries
rvm_remote_server_url1=http://jruby.org.s3.amazonaws.com
rvm_remote_server_path1=downloads
+rvm_remote_server_url2=http://binaries.rubini.us
# rvm_remote_server_url2=http://gentoo-binaries.my-custom-server.com
# rvm_remote_server_path2=ec2-2013.09
# Packages
View
60 scripts/external
@@ -251,8 +251,6 @@ external_import_configure()
external_import_download()
{
- typeset downloaded_names
-
if
[[ -r "${rvm_ruby_url}" ]]
then
@@ -266,30 +264,60 @@ external_import_download()
return 2
}
fi
+}
- downloaded_names="$(
+external_import_validate_archive()
+{
+ typeset -a downloaded_names path_to_bin_ruby
+
+ __rvm_read_lines path_to_bin_ruby < <(
+ __rvm_package list "$rvm_archives_path/${rvm_ruby_package_file}" | grep "bin/ruby$"
+ )
+ __rvm_read_lines downloaded_names < <(
__rvm_package list "$rvm_archives_path/${rvm_ruby_package_file}" | awk -F/ '{print $1}' | sort -u
- )"
- [[ "${rvm_ruby_string}" == "${downloaded_names}" ]] || {
- $err_command "The downloaded package ${rvm_ruby_url} contains '${downloaded_names}' instead of '${rvm_ruby_string}'."
+ )
+ if
+ [[ "${#path_to_bin_ruby[*]}" -eq 1 ]]
+ then
+ __path_to_extract="${path_to_bin_ruby[*]}"
+ __path_to_extract="${__path_to_extract%bin/ruby}"
+ elif
+ [[ "${rvm_ruby_string}" == "${downloaded_names[*]}" ]]
+ then
+ __path_to_extract="${rvm_ruby_string}"
+ else
+ $err_command "The downloaded package for ${rvm_ruby_url},
+Does not contains single 'bin/ruby' or '${rvm_ruby_string}',
+Only '${downloaded_names[*]}' were found instead."
return 4
- }
+ fi
}
+
external_import_extract()
{
- __rvm_package extract "$rvm_archives_path/${rvm_ruby_package_file}" "${rvm_rubies_path}" || {
+ rm -rf "${rvm_rubies_path}/${rvm_ruby_string}"
+ mkdir -p "${rvm_rubies_path}/${rvm_ruby_string}"
+ __rvm_package extract "$rvm_archives_path/${rvm_ruby_package_file}" "${rvm_rubies_path}/${rvm_ruby_string}" || {
$err_command "Unpacking ${rvm_ruby_package_file} failed."
return 6
}
- [[ -d "${rvm_rubies_path}/${rvm_ruby_string}" ]] || {
- $err_command "Ruby directory was not created, make "
- return 8
- }
+
+ if
+ [[ -n "${__path_to_extract}" && "${__path_to_extract}" != "/" ]]
+ then
+ [[ -d "${rvm_rubies_path}/${rvm_ruby_string}/${__path_to_extract}/bin" ]] || {
+ $err_command "Target directory '${__path_to_extract}' was not created,
+make sure '${rvm_ruby_url}' is a valid binary ruby archive."
+ return 8
+ }
+ mv "${rvm_rubies_path}/${rvm_ruby_string}/${__path_to_extract}"/* "${rvm_rubies_path}/${rvm_ruby_string}/"
+ rm -rf "${rvm_rubies_path}/${rvm_ruby_string}/${__path_to_extract%%/*}"
+ fi
}
# validate libraries - make sure everything can be loaded
-external_import_validate()
+external_import_validate_binary()
{
typeset IFS
typeset -a missing_libs
@@ -377,11 +405,11 @@ external_import_setup()
external_import()
{
- typeset step err_command rvm_ruby_url rvm_ruby_string rvm_ruby_package_file
+ typeset step err_command rvm_ruby_url rvm_ruby_string rvm_ruby_package_file __path_to_extract
- for step in configure download extract validate setup
+ for step in configure download validate_archive extract validate_binary setup
do
- rvm_log "${rvm_ruby_string:-${2:-$1}} - #$step"
+ rvm_log "${rvm_ruby_string:-${2:-$1}} - #${step//_/ }"
external_import_${step} "$@" || return $?
done
}
View
2 scripts/functions/utility
@@ -504,7 +504,7 @@ __rvm_remote_extension()
*.tar.*)
rvm_remote_extension="tar${1##*tar}"
;;
- jruby-*|rbx-*|rubinius-*)
+ jruby-*)
rvm_remote_extension="tar.gz"
;;
*)

0 comments on commit 0a1ba86

Please sign in to comment.