Loading bin/ruby-build +17 −18 Original line number Diff line number Diff line Loading @@ -300,26 +300,25 @@ verify_checksum() { http() { local method="$1" local url="$2" local file="$3" [ -n "$url" ] || return 1 [ -n "$2" ] || return 1 shift 1 local http_client if [ -n "${RUBY_BUILD_HTTP_CLIENT}" ]; then http_client="http_${method}_${RUBY_BUILD_HTTP_CLIENT}" else if type aria2c &>/dev/null; then http_client="http_${method}_aria2c" elif type curl &>/dev/null; then http_client="http_${method}_curl" elif type wget &>/dev/null; then http_client="http_${method}_wget" else echo "error: please install \`aria2c\`, \`curl\` or \`wget\` and try again" >&2 exit 1 fi RUBY_BUILD_HTTP_CLIENT="${RUBY_BUILD_HTTP_CLIENT:-$(detect_http_client)}" [ -n "$RUBY_BUILD_HTTP_CLIENT" ] || return 1 "http_${method}_${RUBY_BUILD_HTTP_CLIENT}" "$@" } detect_http_client() { local client for client in aria2c curl wget; do if type "$client" &>/dev/null; then echo "$client" return fi "${http_client}" "$url" "$file" done echo "error: please install \`aria2c\`, \`curl\`, or \`wget\` and try again" >&2 return 1 } http_head_aria2c() { Loading Loading
bin/ruby-build +17 −18 Original line number Diff line number Diff line Loading @@ -300,26 +300,25 @@ verify_checksum() { http() { local method="$1" local url="$2" local file="$3" [ -n "$url" ] || return 1 [ -n "$2" ] || return 1 shift 1 local http_client if [ -n "${RUBY_BUILD_HTTP_CLIENT}" ]; then http_client="http_${method}_${RUBY_BUILD_HTTP_CLIENT}" else if type aria2c &>/dev/null; then http_client="http_${method}_aria2c" elif type curl &>/dev/null; then http_client="http_${method}_curl" elif type wget &>/dev/null; then http_client="http_${method}_wget" else echo "error: please install \`aria2c\`, \`curl\` or \`wget\` and try again" >&2 exit 1 fi RUBY_BUILD_HTTP_CLIENT="${RUBY_BUILD_HTTP_CLIENT:-$(detect_http_client)}" [ -n "$RUBY_BUILD_HTTP_CLIENT" ] || return 1 "http_${method}_${RUBY_BUILD_HTTP_CLIENT}" "$@" } detect_http_client() { local client for client in aria2c curl wget; do if type "$client" &>/dev/null; then echo "$client" return fi "${http_client}" "$url" "$file" done echo "error: please install \`aria2c\`, \`curl\`, or \`wget\` and try again" >&2 return 1 } http_head_aria2c() { Loading