Skip to content

Commit

Permalink
allow providing multiple servers for binary rubies, closes #1265
Browse files Browse the repository at this point in the history
Conflicts:
	scripts/functions/utility
  • Loading branch information
mpapis committed Nov 6, 2012
1 parent 8e0c262 commit 086def6
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 28 deletions.
12 changes: 10 additions & 2 deletions help/mount
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,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.
22 changes: 0 additions & 22 deletions scripts/functions/manage/rubinius
Original file line number Diff line number Diff line change
@@ -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
Expand Down
54 changes: 50 additions & 4 deletions scripts/functions/utility
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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()
Expand Down Expand Up @@ -532,3 +548,33 @@ __rvm_rubygems_create_link()
then ln -fs "$rvm_ruby_gem_home" "$ruby_lib_gem_path"
fi
}

# Import the initial gemsets, unless skipped.
__rvm_gemsets_initial()
{
if
(( ${rvm_skip_gemsets_flag:-0} == 0 ))
then
__rvm_run_with_env "gemsets.initial" "$rvm_ruby_string" \
"'$rvm_scripts_path/gemsets' initial" \
"$rvm_ruby_string - #importing default gemsets ($rvm_gemsets_path/), this may take time ..."
else
mkdir -p "$rvm_gems_path/$rvm_ruby_string@global/bin"
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
then return 0
else return 1
fi
else
rvm_log "Warning: URL was not passed to file_exists_at_url"
return 1
fi
}

0 comments on commit 086def6

Please sign in to comment.