File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ http_get_stdout () {
2+ local f="$(mktemp "ruby-build.http.XXXXXX")"
3+ http get "$1" "$f"
4+ cat "$f"
5+ rm -f "$f"
6+ }
7+
18sort_release_urls () {
29 # With release names like /^(jdk-)?24.1.0-dev-20240207_2228$/
310 # strip everything up to the last dash so we can use the date as the sort field.
@@ -14,11 +21,11 @@ find_asset_url () {
1421 # The releases page hides assets behind an "expanded_assets" url
1522 # so we gather those, sort them according to "sort_release_urls" and store
1623 # them in an array to loop over next.
17- IFS=$'\n' read -d '' -r -a assets_urls < <(http get "$releases_prefix" - | grep -oE "$releases_prefix/expanded_assets/[^\"]+" | $sort_release_urls)
24+ IFS=$'\n' read -d '' -r -a assets_urls < <(http_get_stdout "$releases_prefix" | grep -oE "$releases_prefix/expanded_assets/[^\"]+" | $sort_release_urls)
1825
1926 # For each release look in the assets output for a download link to the specified filename.
2027 for assets_url in "${assets_urls[@]}"; do
21- path="$(http get "$assets_url" - | grep -m1 -oE "/$repo/releases/download/[^/]+/$filename")"
28+ path="$(http_get_stdout "$assets_url" | grep -m1 -oE "/$repo/releases/download/[^/]+/$filename")"
2229 if [[ -n "$path" ]]; then
2330 echo "https://github.com/$path"
2431 return 0
Original file line number Diff line number Diff line change 1+ http_get_stdout () {
2+ local f="$(mktemp "ruby-build.http.XXXXXX")"
3+ http get "$1" "$f"
4+ cat "$f"
5+ rm -f "$f"
6+ }
7+
18sort_release_urls () {
29 # With release names like /^(jdk-)?24.1.0-dev-20240207_2228$/
310 # strip everything up to the last dash so we can use the date as the sort field.
@@ -14,11 +21,11 @@ find_asset_url () {
1421 # The releases page hides assets behind an "expanded_assets" url
1522 # so we gather those, sort them according to "sort_release_urls" and store
1623 # them in an array to loop over next.
17- IFS=$'\n' read -d '' -r -a assets_urls < <(http get "$releases_prefix" - | grep -oE "$releases_prefix/expanded_assets/[^\"]+" | $sort_release_urls)
24+ IFS=$'\n' read -d '' -r -a assets_urls < <(http_get_stdout "$releases_prefix" | grep -oE "$releases_prefix/expanded_assets/[^\"]+" | $sort_release_urls)
1825
1926 # For each release look in the assets output for a download link to the specified filename.
2027 for assets_url in "${assets_urls[@]}"; do
21- path="$(http get "$assets_url" - | grep -m1 -oE "/$repo/releases/download/[^/]+/$filename")"
28+ path="$(http_get_stdout "$assets_url" | grep -m1 -oE "/$repo/releases/download/[^/]+/$filename")"
2229 if [[ -n "$path" ]]; then
2330 echo "https://github.com/$path"
2431 return 0
You can’t perform that action at this time.
0 commit comments