Permalink
Browse files

add support for binary ruby, reworked fetching and packaging, extract…

… remote file and extension building, closes #1241
  • Loading branch information...
1 parent 5c92a14 commit da93081a4a1e60e981a5a90b233d2119bd4390e3 @mpapis mpapis committed Oct 30, 2012
View
4 config/db
@@ -67,7 +67,9 @@ maglev_repo_url=git://github.com/MagLev/maglev.git
ironruby_version=1.0
ironruby_repo_url=git://github.com/ironruby/ironruby.git
ironruby_1.0_url=http://rubyforge.org/frs/download.php/70179/
-rvm_remote_server_url=https://rvm.io/binaries
+rvm_remote_server_url=http://jruby.org.s3.amazonaws.com
+rvm_remote_server_path=downloads
+rvm_remote_server_url1=https://rvm.io/binaries
# rvm_remote_server_path=gentoo/ec2-2013.09/amd64
# Packages
readline_url=http://ftp.gnu.org/gnu/readline
View
1 config/md5
@@ -205,6 +205,7 @@ GemStone-27184.Darwin-i386.tar.gz=292b3b169656a8451cfa19c228828e5a
GemStone-27184.Linux-x86_64.tar.gz=cfabd4dd73d2656fc10243e35dd7452b
GemStone-27184.SunOS-i86pc.tar.gz=5755a0689488748dfeab3bc74572aaa8
MagLev-1.0.0.tar.gz=e02cb8ee04438451eb78df14f91a68a9
+http://jruby.org.s3.amazonaws.com/downloads/1.7.0/jruby-bin-1.7.0.tar.gz=21861e0ecdbf48cda713c8ade82fdddb
https://rvm.io/binaries/arch/libc-2.15/x86_64/ruby-1.9.3-p194.tar.bz2=384ea18aef77b95e49df6f3944fc3e11
https://rvm.io/binaries/arch/libc-2.15/x86_64/ruby-1.9.3-p286.tar.bz2=e7ee7c1a6dc913f6e7fad3ba03e459da
https://rvm.io/binaries/centos/5.6/x86_64/ruby-1.9.3-p194.tar.bz2=3e1aa66177d0d1a7af1bb2617e836464
View
1 config/sha512
@@ -1,3 +1,4 @@
+http://jruby.org.s3.amazonaws.com/downloads/1.7.0/jruby-bin-1.7.0.tar.gz=1e466a3f8d52b553c9def09827fda4b8433576b0262c40ee505602754521a00defd821d5ead5052be52baf281c6cb080fd03a8b15c628a0ee67b4e417633e5e2
https://rvm.io/binaries/arch/libc-2.15/x86_64/ruby-1.9.3-p194.tar.bz2=289f3921543eb096b0d50a2ce7f8655176f6f4dbc8a52aa1342b5238e33f36c9dc78948e4144f41eeca616920ba3422adb0a17d216ec7d2cfaae51f570c1f9b3
https://rvm.io/binaries/arch/libc-2.15/x86_64/ruby-1.9.3-p286.tar.bz2=29d827ca2241fe8b6ee2b6e5bf454820594c4631f46748e8cb4402052b848b43b3f2095d97f57aeb84815193af0e191f80b0f4967aeeaacf9109af1386f17295
https://rvm.io/binaries/centos/5.6/x86_64/ruby-1.9.3-p194.tar.bz2=6c541bab1e17e712adb7cdbd464a188c365ee109d8b0df044917806cd3263563e48fc8b2f2817804f0984a6c1a94510bcfab569b86cbd231e0504f92114a4080
View
47 scripts/external
@@ -236,13 +236,14 @@ external_import_configure()
(http*) true ;;
(*)
__rvm_ruby_string
- rvm_ruby_url="$(__rvm_remote_server_path "${rvm_ruby_string}.${rvm_remote_extension:-tar.bz2}" )"
+ rvm_ruby_url="$(__rvm_remote_server_path "${rvm_ruby_string}" )"
;;
esac
rvm_ruby_string="${rvm_ruby_string##*/}"
rvm_ruby_string="${rvm_ruby_string%.t*}"
- rvm_ruby_package_file="bin-${rvm_ruby_string}.${rvm_remote_extension:-tar.bz2}"
+ __rvm_ruby_package_file "${rvm_ruby_string}"
+ rvm_ruby_package_file="bin-${rvm_ruby_string}.$(__rvm_remote_extension "${rvm_ruby_string}" -)"
}
external_import_download()
@@ -264,7 +265,7 @@ external_import_download()
fi
downloaded_names="$(
- tar tjf "$rvm_archives_path/${rvm_ruby_package_file}" | awk -F/ '{print $1}' | sort -u
+ __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}'."
@@ -274,8 +275,7 @@ external_import_download()
external_import_extract()
{
- chpwd_functions="" builtin cd "${rvm_rubies_path}"
- tar xjf "$rvm_archives_path/${rvm_ruby_package_file}" || {
+ __rvm_package extract "$rvm_archives_path/${rvm_ruby_package_file}" "${rvm_rubies_path}" || {
$err_command "Unpacking ${rvm_ruby_package_file} failed."
return 6
}
@@ -334,6 +334,12 @@ __rvm_fix_wrappers()
-e "/^ENV\[[\"']PATH[\"']\]=/ d"
fi
done
+ if
+ [[ ! -f "$rvm_rubies_path/$rvm_ruby_string/bin/ruby" ]] &&
+ [[ -f "$rvm_rubies_path/$rvm_ruby_string/bin/jruby" ]]
+ then
+ ln -s "$rvm_rubies_path/$rvm_ruby_string/bin/jruby" "$rvm_rubies_path/$rvm_ruby_string/bin/ruby"
+ fi
}
__rvm_fix_lib_files()
@@ -353,9 +359,9 @@ __rvm_fix_lib_files()
external_import_setup()
{
__rvm_ruby_string
- __rvm_rubygems_create_link
__rvm_fix_wrappers
__rvm_fix_lib_files
+ __rvm_rubygems_create_link "$rvm_rubies_path/$rvm_ruby_string/bin/ruby"
rvm_create_flag=1 __rvm_use
@@ -410,19 +416,22 @@ external_prepare_package()
fi
rvm_log "Preparing ${rvm_ruby_string} ..."
- case "${file_name}" in
- (*.tar.bz2)
- tar cjf "${file_name}" -C "${rvm_rubies_path}" "${rvm_ruby_string}"
- ;;
- (*.tar.gz|*.tgz)
- tar czf "${file_name}" -C "${rvm_rubies_path}" "${rvm_ruby_string}"
- ;;
- (*)
- rvm_error "Do not know how to package '${file_name}'."
- return 1
- ;;
- esac
- rvm_log "Prepared $1."
+ if
+ __rvm_package create "${file_name}" "${rvm_rubies_path}" "${rvm_ruby_string}"
+ then
+ rvm_log "Prepared ${file_name}."
+ else
+ case $? in
+ 199)
+ rvm_error "Unrecognized archive format for ${file_name}"
+ return 199
+ ;;
+ *)
+ rvm_error "Error packaging ${file_name}."
+ return 1
+ ;;
+ esac
+ fi
}
#TODO: move to SMF ! RVM2 ?
View
55 scripts/functions/manage/base
@@ -265,11 +265,11 @@ __rvm_install_ruby_try_remote()
: rvm_disable_binary_flag:${rvm_disable_binary_flag:=0}: rvm_remote_flag:${rvm_remote_flag:=0}:
(( rvm_disable_binary_flag )) ||
{
- rubies=($(
- __list_remote_rubies_for "$( __rvm_remote_server_path "${rvm_ruby_string//\./\.}\.tar\..*" )"
- ))
- case ${#rubies[@]} in
- (0)
+ typeset __rvm_ruby_url
+ __rvm_ruby_url="$( __rvm_remote_server_path "${rvm_ruby_string}" )"
+ if
+ [[ -z "${__rvm_ruby_url}" ]]
+ then
if
(( rvm_remote_flag ))
then
@@ -279,28 +279,16 @@ __rvm_install_ruby_try_remote()
rvm_warn "No binary rubies available for: $(__rvm_system_path -)/${rvm_ruby_string}.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies."
fi
- ;;
- (1)
+ else
if
- rvm_remote_flag=1 "${rvm_scripts_path}/external" mount "$rvm_ruby_string"
+ rvm_remote_flag=1 "${rvm_scripts_path}/external" mount "${__rvm_ruby_url}" "${rvm_ruby_string}"
then
return 0
else
- __rvm_rm_rf "$rvm_rubies_path/$rvm_ruby_string"
+ __rvm_rm_rf "$rvm_rubies_path/$rvm_ruby_string" # cleanup so standard installation works
rvm_warn "Mounting remote ruby failed, trying to compile."
fi
- ;;
- (*)
- if
- (( rvm_remote_flag ))
- then
- rvm_error "Requested binary installation but multiple rubies are available to download, this most likely is a bug, please report an issue!"
- return 1
- else
- rvm_warn "More then one binary ruby found, this most likely is a bug, please report an issue!"
- fi
- ;;
- esac
+ fi
}
return 2 # continue with compilation
}
@@ -549,29 +537,18 @@ __rvm_fetch_ruby()
then
mkdir -p "${rvm_tmp_path:-/tmp}/rvm_src_$$"
- case "$rvm_archive_extension" in
- tar.gz|tgz)
- _current_command=(
- "$rvm_tar_command" xzf "${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension" -C "${rvm_tmp_path:-/tmp}/rvm_src_$$" ${rvm_tar_options:-}
- )
- ;;
- tar.bz2)
- _current_command=(
- "$rvm_tar_command" xjf "${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension" -C "${rvm_tmp_path:-/tmp}/rvm_src_$$" ${rvm_tar_options:-}
- )
- ;;
- zip)
- _current_command=(
- unzip -q -o "${rvm_archives_path}/$rvm_ruby_package_file" -d "${rvm_tmp_path:-/tmp}/rvm_src_$$"
- )
+ __rvm_log_command "extract" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string" \
+ __rvm_package extract "${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension" "${rvm_tmp_path:-/tmp}/rvm_src_$$" ||
+ case $? in
+ 199)
+ rvm_error "\nUnrecognized archive format '$archive_format'"
+ return 199
;;
*)
- rvm_error "Unknown archive format extension '$rvm_archive_extension'.\nHalting the installation."
+ rvm_error "There has been an error while trying to extract the source. Halting the installation."
return 1
;;
esac
- __rvm_log_command "extract" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string" \
- "${_current_command[@]}" || return $?
__rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"
View
21 scripts/functions/manage/maglev
@@ -71,15 +71,18 @@ maglev_install()
mkdir -p "${rvm_src_path}/${rvm_gemstone_package_file}"
fi
- __rvm_run "gemstone.extract" \
- "$rvm_tar_command xzf \"${rvm_archives_path}/${rvm_gemstone_package_file}.${rvm_archive_extension}\" -C ${rvm_src_path}/ ${rvm_tar_options:-}"
- result=$?
-
- if (( result > 0 ))
- then
- rvm_error "There has been an error while trying to extract the GemStone package. \nHalting the installation."
- exit $result
- fi
+ __rvm_log_command "extract" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string" \
+ __rvm_package extract "${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension" "${rvm_tmp_path:-/tmp}/rvm_src_$$" ||
+ case $? in
+ 199)
+ rvm_error "\nUnrecognized archive format '$archive_format'"
+ return 199
+ ;;
+ *)
+ rvm_error "There has been an error while trying to extract the source. Halting the installation."
+ return 1
+ ;;
+ esac
ln -fs "${rvm_src_path}/$rvm_gemstone_package_file" "gemstone"
View
44 scripts/functions/manage/ree
@@ -21,38 +21,38 @@ ree_install()
chpwd_functions="" builtin cd "${rvm_src_path}"
- if [[ -d "${rvm_src_path}/$rvm_ruby_string" &&
- -x "${rvm_src_path}/$rvm_ruby_string/installer" ]]
+ if
+ [[ -d "${rvm_src_path}/$rvm_ruby_string" ]] &&
+ [[ -x "${rvm_src_path}/$rvm_ruby_string/installer" ]]
then
rvm_log "It appears that the archive has already been extracted. Skipping extract (use reinstall to do fresh installation)."
-
else
rvm_log "$rvm_ruby_string - #fetching ($rvm_ruby_package_file)"
-
- "$rvm_scripts_path/fetch" "$rvm_ruby_url"
- result=$?
-
- if (( result > 0 ))
+ if
+ "$rvm_scripts_path/fetch" "$rvm_ruby_url"
then
+ true
+ else
+ result=$?
rvm_error "There has been an error while trying to fetch the source. \nHalting the installation."
return $result
fi
- __rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"
+ __rvm_log_command "extract" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string" \
+ __rvm_package extract "${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension" "${rvm_tmp_path:-/tmp}/rvm_src_$$" ||
+ case $? in
+ 199)
+ rvm_error "\nUnrecognized archive format '$archive_format'"
+ return 199
+ ;;
+ *)
+ rvm_error "There has been an error while trying to extract the source. Halting the installation."
+ return 1
+ ;;
+ esac
- __rvm_run "extract" \
- "$rvm_tar_command xzf \"${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension\" -C ${rvm_src_path} ${rvm_tar_options:-}" \
- "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string"
- result=$?
-
- if (( result > 0 ))
- then
- rvm_error "There has been an error while trying to extract the source. Halting the installation."
- return $result
- fi
-
- mv "${rvm_src_path}/$rvm_ruby_package_file" \
- "${rvm_src_path}/$rvm_ruby_string"
+ __rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"
+ mv "${rvm_src_path}/$rvm_ruby_package_file" "${rvm_src_path}/$rvm_ruby_string"
fi
chpwd_functions="" builtin cd "${rvm_src_path}/$rvm_ruby_string"
View
21 scripts/functions/manage/rubinius
@@ -74,16 +74,19 @@ rubinius_install()
rvm_error "There has been an error while trying to fetch the source. Halting the installation."
return $result
fi
- __rvm_run "extract" \
- "$rvm_tar_command xzf \"${rvm_archives_path}/$(basename ${rvm_ruby_package_file})\" -C ${rvm_src_path} ${rvm_tar_options:-}" \
- "$rvm_ruby_string - #extracting"
- result=$?
- if (( result > 0 ))
- then
- rvm_error "There has been an error while trying to extract the source. \nHalting the installation."
- return $result
- fi
+ __rvm_log_command "extract" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string" \
+ __rvm_package extract "${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension" "${rvm_tmp_path:-/tmp}/rvm_src_$$" ||
+ case $? in
+ 199)
+ rvm_error "\nUnrecognized archive format '$archive_format'"
+ return 199
+ ;;
+ *)
+ rvm_error "There has been an error while trying to extract the source. Halting the installation."
+ return 1
+ ;;
+ esac
# Remove the left over folder first.
__rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"
View
27 scripts/functions/pkg
@@ -7,27 +7,16 @@ install_package()
chpwd_functions="" builtin cd "$rvm_src_path"
rvm_log "Fetching $package-$version.$archive_format to $rvm_archives_path"
- case "$archive_format" in
- tar.gz|tgz)
- "$rvm_scripts_path/fetch" "$package_url/$package-$version.$archive_format" || return $?
- __rvm_run "$package/extract" \
- "$rvm_tar_command xmzf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path ${rvm_tar_options:-}" \
- "Extracting $package-$version.$archive_format to $rvm_src_path"
- ;;
- tar.bz2)
- "$rvm_scripts_path/fetch" "$package_url/$package-$version.$archive_format" || return $?
- __rvm_run "$package/extract" \
- "$rvm_tar_command xmjf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path ${rvm_tar_options:-} "\
- "Extracting $package-$version.$archive_format to $rvm_src_path"
- ;;
- zip)
- "$rvm_scripts_path/fetch" "$package_url/$package-$version.$archive_format" || return $?
- __rvm_run "$package/extract" \
- "unzip -q -o $rvm_archives_path/$package-$version.$archive_format -d $rvm_src_path/$package-$version" \
- "Extracting $package-$version.$archive_format to $rvm_src_path"
+ "$rvm_scripts_path/fetch" "$package_url/$package-$version.$archive_format" || return $?
+ __rvm_log_command "$package/extract" "Extracting ${package} to $rvm_src_path/$package-$version" \
+ __rvm_package extract "$rvm_archives_path/$package-$version.$archive_format" "$rvm_src_path" ||
+ case $? in
+ 199)
+ rvm_error "\nUnrecognized archive format '$archive_format'"
+ return 199
;;
*)
- printf "%b" "\nUnrecognized archive format '$archive_format'"
+ rvm_error "There has been an error while trying to extract the source. Halting the installation."
return 1
;;
esac
View
26 scripts/functions/support
@@ -106,20 +106,24 @@ __rvm_array_add_or_update()
# Assumes that filename is the first argument, all others are passed onto sed
__rvm_sed_i()
{
- typeset _filename _executable
- _filename="$1"
- shift
+ typeset _filename _executable
+ [[ -n "${1:-}" ]] || {
+ rvm_debug "no file given for __rvm_sed_i"
+ return 0
+ }
+ _filename="$1"
+ shift
- if [[ -x "${_filename}" ]]
- then _executable=true
- fi
+ if [[ -x "${_filename}" ]]
+ then _executable=true
+ fi
- sed "$@" < "${_filename}" > "${_filename}.new"
- \mv "${_filename}.new" "${_filename}"
+ sed "$@" < "${_filename}" > "${_filename}.new"
+ \mv "${_filename}.new" "${_filename}"
- if [[ -n "${_executable:-}" ]]
- then chmod +x "${_filename}"
- fi
+ if [[ -n "${_executable:-}" ]]
+ then chmod +x "${_filename}"
+ fi
}
# Drop in replacement for which compatible with OSX / ZSH
View
102 scripts/functions/utility
@@ -489,15 +489,64 @@ __rvm_system_path()
fi
}
+__rvm_remote_extension()
+{
+ case "$1" in
+ *.tar.*)
+ rvm_remote_extension="tar${1##*tar}"
+ ;;
+ jruby-*)
+ rvm_remote_extension="tar.gz"
+ ;;
+ *)
+ rvm_remote_extension="tar.bz2"
+ ;;
+ esac
+ [[ "$2" != "-" ]] || printf "%b" "${rvm_remote_extension}"
+}
+
+# params: ruby-string-to-transform
+__rvm_ruby_package_file()
+{
+ case "$1" in
+ *.tar.*)
+ rvm_ruby_package_file="/$1"
+ ;;
+ jruby-*)
+ typeset __version
+ __version="$(
+ rvm_ruby_string="$1"
+ __rvm_ruby_string
+ echo "$rvm_ruby_version"
+ )"
+ rvm_ruby_package_file="/${__version}/jruby-bin-${__version}.$(__rvm_remote_extension "$1" -)"
+ ;;
+ "")
+ rvm_ruby_package_file=""
+ ;;
+ *)
+ rvm_ruby_package_file="/$1.$(__rvm_remote_extension "$1" -)"
+ ;;
+ esac
+}
+
# params: return_on_end return_on_failed_link [suffix] [file]
__rvm_remote_server_path_single()
{
rvm_remote_server_url="$( __rvm_db "rvm_remote_server_url${3:-}" )"
[[ -n "$rvm_remote_server_url" ]] || return $1
__rvm_system_path "" "${3:-}"
- if file_exists_at_url "${rvm_remote_server_url}/${rvm_remote_server_path}${4:+/}${4:-}"
- then printf "%b" "${rvm_remote_server_url}/${rvm_remote_server_path}${4:+/}${4:-}"
- else return $2
+ __rvm_ruby_package_file "${4:-}"
+ typeset __remote_file
+ __remote_file="${rvm_remote_server_url}/${rvm_remote_server_path}${rvm_ruby_package_file}"
+ if
+ file_exists_at_url "${__remote_file}"
+ then
+ rvm_debug "Found remote file ${__remote_file}"
+ printf "%b" "${__remote_file}"
+ else
+ rvm_debug "Remote file does not exist ${__remote_file}"
+ return $2
fi
}
@@ -523,21 +572,21 @@ __list_remote_rubies_for()
rubygems_detect_ruby_lib_gem_path()
{
- ruby_lib_gem_path="$(ruby -rrbconfig -e "puts ::Kernel.const_get('RbConfig')::CONFIG['rubylibprefix']")/gems/"
+ ruby_lib_gem_path="$("${1:-ruby}" -rrbconfig -e "puts ::Kernel.const_get('RbConfig')::CONFIG['rubylibprefix']")/gems/"
case "$rvm_ruby_string" in
(jruby*)
ruby_lib_gem_path+="shared"
;;
(*)
- ruby_lib_gem_path+="$(ruby -rrbconfig -e "puts ::Kernel.const_get('RbConfig')::CONFIG['ruby_version']")"
+ ruby_lib_gem_path+="$("${1:-ruby}" -rrbconfig -e "puts ::Kernel.const_get('RbConfig')::CONFIG['ruby_version']")"
;;
esac
}
__rvm_rubygems_create_link()
{
typeset ruby_lib_gem_path
- rubygems_detect_ruby_lib_gem_path
+ rubygems_detect_ruby_lib_gem_path "${1:-ruby}"
# Add ruby's gem path to ruby's lib direcotry.
\mkdir -p "$(dirname $ruby_lib_gem_path)"
@@ -579,3 +628,44 @@ file_exists_at_url()
return 1
fi
)
+
+# params: action archive_file [path [path2]]
+__rvm_package()
+{
+ rvm_debug __rvm_package:$#: "$@"
+ case "$1-$2" in
+ list-*.zip)
+ unzip -Z -1 "$2"
+ ;;
+ extract-*.zip)
+ unzip -q -o "$2" -d "$3"
+ ;;
+ list-*.tar.bz2)
+ ${rvm_tar_command:-tar} tjf "$2"
+ ;;
+ create-*.tar.bz2)
+ if [[ -z "${4:-}" ]]
+ then ${rvm_tar_command:-tar} cjf "$2" "$3"
+ else ${rvm_tar_command:-tar} cjf "$2" -C "$3" "$4"
+ fi
+ ;;
+ extract-*.tar.bz2)
+ ${rvm_tar_command:-tar} xjf "$2" -C "$3" ${rvm_tar_options:-}
+ ;;
+ list-*.tar.gz|list-*.tgz)
+ ${rvm_tar_command:-tar} tzf "$2"
+ ;;
+ create-*.tar.gz|create-*.tgz)
+ if [[ -z "${4:-}" ]]
+ then ${rvm_tar_command:-tar} czf "$2" "$3"
+ else ${rvm_tar_command:-tar} czf "$2" -C "$3" "$4"
+ fi
+ ;;
+ extract-*.tar.gz|extract-*.tgz)
+ ${rvm_tar_command:-tar} xzf "$2" -C "$3" ${rvm_tar_options:-}
+ ;;
+ *)
+ return 199
+ ;;
+ esac
+}
View
32 scripts/rubygems
@@ -129,27 +129,25 @@ rubygems_setup()
[[ -f "${rvm_src_path}/$rvm_gem_package_name/setup.rb" ]] ||
__rvm_rm_rf "${rvm_src_path}/$rvm_gem_package_name"
- if [[ ! -d "${rvm_src_path}/${rvm_gem_package_name}" ]]
+ if
+ [[ ! -d "${rvm_src_path}/${rvm_gem_package_name}" ]]
then
rvm_log "Retrieving $rvm_gem_package_name"
-
- "$rvm_scripts_path/fetch" "$rvm_gem_url" "${rvm_gem_package_name}.tgz"
- result=$?
-
- if (( result > 0 ))
+ if
+ "$rvm_scripts_path/fetch" "$rvm_gem_url" "${rvm_gem_package_name}.tgz"
then
+ true
+ else
+ result=$?
rvm_error "There has been an error while trying to fetch the source. \nHalting the installation."
return $result
fi
- if [[ ! -d "${rvm_src_path}/$rvm_gem_package_name" ]]
- then
+ [[ -d "${rvm_src_path}/$rvm_gem_package_name" ]] ||
\mkdir -p "${rvm_src_path}/$rvm_gem_package_name"
- fi
- __rvm_run "rubygems.extract" \
- "$rvm_tar_command xzf ${rvm_archives_path}/$rvm_gem_package_name.tgz -C ${rvm_src_path}" \
- "Extracting $rvm_gem_package_name ..."
+ __rvm_log_command "rubygems.extract" "Extracting $rvm_gem_package_name ..." \
+ __rvm_package extract "${rvm_archives_path}/$rvm_gem_package_name.tgz" "${rvm_src_path}"
fi
rubygems_remove # Remove old gems.
@@ -185,11 +183,10 @@ rubygems_link()
__rvm_rubygems_create_link
}
-if ! builtin command -v ruby > /dev/null
-then
+builtin command -v ruby > /dev/null || {
rvm_error "'ruby' was not found, cannot install rubygems unless ruby is present (Do you have an RVM ruby installed & selected?)"
exit 1
-fi
+}
#
# rvm rubygems X
@@ -199,11 +196,10 @@ export version
version="${args[0]}"
args="$(echo ${args[@]:1})" # Strip trailing / leading / extra spacing.
-if [[ -z "$version" ]]
-then
+[[ -n "$version" ]] || {
rvm_error "Usage: rvm rubygems [x.y.z|latest-x.y|latest|remove]"
exit 1
-fi
+}
if can_switch_rubygems
then
View
1 scripts/selector
@@ -151,7 +151,6 @@ __rvm_select()
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
rvm_ruby_url="${jruby_url}/${rvm_ruby_version}/${rvm_ruby_package_file}.tar.gz"
jruby_url=""
- rvm_disable_binary_flag=1
fi
alias jruby_ng="jruby --ng"

0 comments on commit da93081

Please sign in to comment.