19 Commits

Author SHA1 Message Date
Sam Ford
cf22382921
Curl: use typed: strict
This upgrades `utils/curl.rb` to `typed: strict`, which requires
a number of changes to pass `brew typecheck`. The most
straightforward are adding type signatures to methods, adding type
annotations (e.g., `T.let`) to variables that need them, and ensuring
that methods always use the expected return type.

I had to refactor areas where we call a `Utils::Curl` method and use
array destructuring on a `SystemCommand::Result` return value
(e.g., `output, errors, status = curl_output(...)`), as Sorbet
doesn't understand implicit array conversion. As suggested by Markus,
I've switched these areas to use `#stdout`, `#stderr`, and `#status`.
This requires the use of an intermediate variable (`result`) in some
cases but this was a fairly straightforward substitution.

I also had to refactor how `Cask::URL::BlockDSL::PageWithURL` works.
It currently uses `page.extend PageWithURL` to add a `url` attribute
but this reworks it to subclass `SimpleDelegator` and use an
`initialize` method instead. This achieves the same goal but in a way
that Sorbet can understand.
2025-01-14 08:14:39 -05:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Douglas Eichelberger
26eda5a303
git grep -l '^describe' | xargs gsed -i 's|^describe|RSpec.describe|g' 2024-02-19 13:57:27 +00:00
Mike McQuaid
4436a663f2
download_strategies/curl_spec: fix test. 2023-10-21 09:41:35 +01:00
Rui Chen
4232cb6c90
curl_spec: update test
Signed-off-by: Rui Chen <rui@chenrui.dev>
2023-10-20 20:46:22 -04:00
Rui Chen
d31f4e4697
fix: update UA regex
Signed-off-by: Rui Chen <rui@chenrui.dev>
2023-09-09 22:47:47 -04:00
Bo Anderson
6d8b033eff
Significantly improve fetch speed of bottles 2023-06-22 15:08:16 +01:00
Markus Reiter
9885fbc129
Fix failing test. 2023-05-19 14:07:06 +02:00
Markus Reiter
353818f508
Rename curl_head to curl_headers. 2023-05-06 03:41:35 +02:00
Douglas Eichelberger
9075cbae62 brew style --fix 2023-04-21 09:58:50 -07:00
Douglas Eichelberger
ac1e6ded9a git grep -l '# typed: false' | xargs gsed -i 's|# typed: false||g' 2023-04-21 09:57:47 -07:00
Markus Reiter
fbf474a3fd
Add curl_head method. 2023-04-06 10:22:24 +02:00
Issy Long
3a83b5492c
rubocop: Clean up Style/BlockDelimiters excludes and autofix offenses
- The defaults of using "do ... end" for multi-line blocks everywhere is
  good, better than switching everything to braces everywhere.
2023-03-08 23:54:22 +00:00
Issy Long
734a651f93
rubocop: Enable Layout/MultilineMethodCallIndentation & fix offenses
- Part of trying to reduce the number of `Excludes:` we have in our
  RuboCop configs.
- The fixes here all seemed reasonable, with some minimal tweaks for
  line length and less floatiness. Apart from `test/dev-cmd/bottle_spec.rb`
  where RuboCop wanted to do some ridiculously floaty indentation and there
  wasn't an obvious alternative place to break the lines, so I opted for
  in-line disables instead.
2023-03-03 22:18:51 +00:00
Gordon Bleux
bcfd20e1b9 change cURL download behaviour for HOMEBREW_ARTIFACT_DOMAIN.
instead of prefixing and/or replacing data in URLs, the
*HOMEBREW_ARTIFACT_DOMAIN* environment variable only replaces
the bottle base URL. this causes URLs from Casks and other assets
to be no longer affected by this feature.

closes #13226
closes #13222
closes #13227
2022-06-11 08:24:50 +02:00
Gordon Bleux
b2796ec7fb docs: clarify application of HOMEBREW_ARTIFACT_DOMAIN
bottle URLs are treated differently than any other URL.
this change clarifies the resulting URLs in the manpage.

closes #13222
2022-05-23 09:20:16 +02:00
cnnrmnn
8ef2d2ecc4 Update tests 2021-05-13 12:54:17 -04:00
Issy Long
ead84825a6
test: Fix all RSpec/RepeatedExampleGroupDescription offenses 2021-02-21 14:06:24 +00:00
Rylan Polster
d5d7b6c3db
style: remove RSpec/MultipleDescribes violations
Co-authored-by: Nanda H Krishna <nanda.harishankar@gmail.com>
2021-02-01 20:30:51 -05:00