Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow providing multiple servers for binary rubies, closes #1265
- Loading branch information
Showing
3 changed files
with
45 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -475,9 +475,10 @@ __rvm_detect_system() | ||
_system_arch="${_system_arch//[ \/]/_}" | _system_arch="${_system_arch//[ \/]/_}" | ||
} | } | ||
|
|
||
# params: [printf_if=-] [suffix] | |||
__rvm_system_path() | __rvm_system_path() | ||
{ | { | ||
true "${rvm_remote_server_path:=$(__rvm_db "rvm_remote_server_path")}" | rvm_remote_server_path="$(__rvm_db "rvm_remote_server_path${2:-}")" | ||
[[ -n "${rvm_remote_server_path}" ]] || | [[ -n "${rvm_remote_server_path}" ]] || | ||
if __rvm_detect_system | if __rvm_detect_system | ||
then rvm_remote_server_path="${_system_name}/${_system_version}/${_system_arch}" | then rvm_remote_server_path="${_system_name}/${_system_version}/${_system_arch}" | ||
|
@@ -488,11 +489,26 @@ __rvm_system_path() | ||
fi | fi | ||
} | } | ||
|
|
||
# 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 | |||
fi | |||
} | |||
|
|||
# params: [file_name] | |||
__rvm_remote_server_path() | __rvm_remote_server_path() | ||
{ | { | ||
true "${rvm_remote_server_url:=$( __rvm_db "rvm_remote_server_url" )}" | typeset _iterator | ||
__rvm_system_path | _iterator="" | ||
printf "%b" "${rvm_remote_server_url}/${rvm_remote_server_path}${1:+/}${1:-}" | while ! __rvm_remote_server_path_single 0 1 "${_iterator}" "${1:-}" | ||
do : $(( _iterator+=1 )) | |||
done | |||
} | } | ||
|
|
||
__list_remote_rubies_for() | __list_remote_rubies_for() | ||
|
@@ -547,3 +563,18 @@ __rvm_gemsets_initial() | ||
rvm_log "Skipped importing default gemsets" | rvm_log "Skipped importing default gemsets" | ||
fi | fi | ||
} | } | ||
|
|||
file_exists_at_url() | |||
{ | |||
if | |||
[[ -n "${1:-}" ]] | |||
then | |||
if \curl -slk --head "$1" 2>&1 | \head -n 1 | GREP_OPTIONS="" \grep '200 OK' >/dev/null 2>&1 | |||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mpapis
Author
Member
|
|||
then return 0 | |||
else return 1 | |||
fi | |||
else | |||
rvm_log "Warning: URL was not passed to file_exists_at_url" | |||
return 1 | |||
fi | |||
} |
What's the rationale for
curl -s
(--silent
) here? Would substitutingcurl -S
(--show-error
) break anything? Related to possible fix for #1814