Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

allow providing multiple servers for binary rubies, closes #1265

  • Loading branch information...
commit 9391d2832ac097873d965f6ca45d3cfac20b504b 1 parent 0fd84b2
@mpapis mpapis authored
View
12 help/mount
@@ -85,6 +85,14 @@ RVM requires just https server for your own hosting, the pattern for building ur
Where:
-- `rvm_remote_server_url` - can be defined in `~/.rvmrc` or in `$rvm_path/user/db`
-- `rvm_system_server_path` - can be defined in `~/.rvmrc` or in `$rvm_path/user/db`, autodetected
+- `rvm_remote_server_url` - can be defined in `$rvm_path/user/db`
+- `rvm_system_server_path` - can be defined in `$rvm_path/user/db`, autodetected if not defined
- `rvm_ruby_string` - is the name specified by user
+
+For multiple servers/paths suffix the definition with numbers, for example:
+
+ rvm_remote_server_url=https://own.company.com/binaries
+ rvm_system_server_path=my/system
+ rvm_remote_server_url1=https://rvm.io/binaries
+
+When coresponding path is not defined for url then it is autodetected.
View
22 scripts/functions/manage/rubinius
@@ -1,27 +1,5 @@
#!/usr/bin/env bash
-file_exists_at_url()
-{
- typeset _url
- _url="${1:-}"
- if [[ -n "${_url}" ]]
- then
- ( #subshell to be able to temporary disable curl function
- unset curl 2>/dev/null
- if curl -slk --head ${_url} 2>&1 | \head -n 1 | GREP_OPTIONS="" \grep '200 OK' >/dev/null 2>&1
- then
- return 0
- else
- return 1
- fi
- )
- else
- rvm_log "Warning: URL was not passed to __rvm_check_for_tarball"
- return 1
- fi
-
-}
-
rbx_configure_with_path()
{
typeset name _opt_path
View
39 scripts/functions/utility
@@ -475,9 +475,10 @@ __rvm_detect_system()
_system_arch="${_system_arch//[ \/]/_}"
}
+# params: [printf_if=-] [suffix]
__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}" ]] ||
if __rvm_detect_system
then rvm_remote_server_path="${_system_name}/${_system_version}/${_system_arch}"
@@ -488,11 +489,26 @@ __rvm_system_path()
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()
{
- true "${rvm_remote_server_url:=$( __rvm_db "rvm_remote_server_url" )}"
- __rvm_system_path
- printf "%b" "${rvm_remote_server_url}/${rvm_remote_server_path}${1:+/}${1:-}"
+ typeset _iterator
+ _iterator=""
+ while ! __rvm_remote_server_path_single 0 1 "${_iterator}" "${1:-}"
+ do : $(( _iterator+=1 ))
+ done
}
__list_remote_rubies_for()
@@ -547,3 +563,18 @@ __rvm_gemsets_initial()
rvm_log "Skipped importing default gemsets"
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

What's the rationale for curl -s (--silent) here? Would substituting curl -S (--show-error) break anything? Related to possible fix for #1814

@mpapis Owner
mpapis added a note

-s and -k are here on purpose, this function checks for existence of a file, it should fail only when the file is missing, it should not print any output as it can be ran multiple times and it's status can not represent fail in the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ then return 0
+ else return 1
+ fi
+ else
+ rvm_log "Warning: URL was not passed to file_exists_at_url"
+ return 1
+ fi
+}
Please sign in to comment.
Something went wrong with that request. Please try again.