24 Commits

Author SHA1 Message Date
Bo Anderson
5692c8ecbf
Fix style violations under newer RuboCop 2023-12-14 05:47:12 +00:00
Mike McQuaid
b7114651ac
utils/curl: include or use explicitly.
Include or use `Utils::Curl` explicitly everywhere it is used.
2023-09-04 22:17:57 -04:00
Douglas Eichelberger
08af78a2a5 brew style --fix 2023-04-25 09:26:24 -07:00
Douglas Eichelberger
7f3593e12d inline titleize 2023-02-27 20:18:10 -08:00
Bo Anderson
83b23e6d5e
Fix license handling for API formulae 2023-02-06 10:09:40 +00:00
Sam Ford
3f7d9f82fc
#curl_download: default try_partial to false
When its `try_partial` argument is `true`, `#curl_download` makes a
`HEAD` request before downloading the file using `#curl`. Currently
`try_partial` defaults to `true`, so any `#curl_download` call that
doesn't explicitly specify `try_partial: false` will make a `HEAD`
request first. This can potentially involve several requests if the
URL redirects, so it can be a bit of unnecessary overhead when a
partial download isn't needed.

Partial downloads are generally only useful when we're working with
larger files, however there's currently only one place in brew where
`#curl_download` is used and this is the case:
`CurlDownloadStrategy`. The other `#curl_download` calls are fetching
smaller [text] files and don't need to support partial downloads.

This commit changes the default `try_partial` value to `false`,
making partial downloads opt-in rather than opt-out.

We want `try_partial` to continue to default to `true` in
`CurlDownloadStrategy` and there are various ways to accomplish this.
In this commit, I've chosen to update its `#initialize` method to
accept a `try_partial` argument that defaults to `true`, as this
value can also be used in classes that inherit from
`CurlDownloadStrategy` (e.g., `HomebrewCurlDownloadStrategy`). This
instance variable is passed to `#curl_download` in related methods,
effectively maintaining the previous `try_partial: true` value, while
also allowing this value to be overridden when necessary.

Other uses of `#curl_download` in brew are
`Formulary::FromUrlLoader#load_file` and
`Cask::CaskLoader::FromURILoader#load`, which did not provide a
`try_partial` argument but should have been using
`try_partial: false`. With the `try_partial: false` default in this
commit, these calls are now fine without a `try_partial` argument.

The only other use of `#curl_download` in brew is
`SPDX#download_latest_license_data!`. These calls were previously
using `try_partial: false` but we can now omit this argument with
the new `false` default (aligning with the above).
2022-04-22 14:23:08 -04:00
cnnrmnn
b406e0b35a Update call sites 2021-05-14 09:53:29 -04:00
Kenneth Chew
edead95768
utils/spdx: correctly detect non-deprecated licenses with plus 2021-02-23 16:28:24 -05:00
Nanda H Krishna
7dc8025934
Merge pull request #10626 from nandahkrishna/refactor-github-api
utils/github: split GitHub module
2021-02-18 01:20:01 +05:30
nandahkrishna
f7c8810214
utils/github/api: remove 'api' from method names 2021-02-17 23:47:05 +05:30
Mike McQuaid
c13d7e6723
Fix brew style 2021-02-16 09:25:34 +00:00
nandahkrishna
56e0c3d9e8
Update GitHub API usage 2021-02-15 22:38:27 +05:30
Mike McQuaid
4c1b2630dc
Fix sorbet errors. 2020-12-28 13:34:07 +00:00
Rylan Polster
24523f8225 utils/spdx: allow other license symbols 2020-10-22 10:01:40 -04:00
Markus Reiter
12e173cd50 Inline type annotations for SPDX. 2020-10-10 15:33:15 +02:00
Markus Reiter
ff653571b1 Create Utils::Curl module and explicitly include it. 2020-10-10 15:23:03 +02:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Markus Reiter
8b07c0ef12 Document SPDX. 2020-08-26 09:16:05 +02:00
Rylan Polster
6eb07d70f0 formula: convert license array to hash 2020-08-20 10:26:37 -04:00
Rylan Polster
1a321dab62 keep license array support 2020-08-19 12:48:50 -04:00
Rylan Polster
90d9454d1e utils/spdx: add support for complex expressions
Co-authored-by: Seeker <meaningseeking@protonmail.com>
2020-08-19 12:47:58 -04:00
Seeker
f345f554c8 update-license-data: fix latest_tag error
Add latest_tag method to utils/spdx
2020-08-10 11:32:07 -07:00
Seeker
6ecef73131 test: add spdx spec 2020-08-06 11:14:24 -07:00
Seeker
753b8621df utils: add SPDX module 2020-08-06 10:16:23 -07:00