Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More CaskLoader improvements. #16621

Merged
merged 10 commits into from Feb 9, 2024

Conversation

reitermarkus
Copy link
Member

@reitermarkus reitermarkus commented Feb 8, 2024

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

@reitermarkus reitermarkus requested review from Bo98 and apainintheneck and removed request for Bo98 February 8, 2024 15:32
Copy link
Contributor

@apainintheneck apainintheneck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Always nice to remove some code.

Comment on lines -259 to +263
(!CoreTap.instance.installed? && Homebrew::API::Formula.all_formulae.key?(path.basename))
(!CoreTap.instance.installed? && Homebrew::API::Formula.all_formulae.key?(path.basename.to_s))
paths << formula_path
end
if cask_path.exist? ||
(!CoreCaskTap.instance.installed? && Homebrew::API::Cask.all_casks.key?(path.basename))
(!CoreCaskTap.instance.installed? && Homebrew::API::Cask.all_casks.key?(path.basename.to_s))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this somehow got coerced to strings before. Otherwise, I'm not really sure how this ever worked.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's because we have a Pathname#to_str monkey-patch.

Library/Homebrew/cask/cask_loader.rb Outdated Show resolved Hide resolved
Comment on lines 117 to +118
@path = path
@tap = Homebrew::API.tap_from_source_download(path)
@tap = Tap.from_path(path) || Homebrew::API.tap_from_source_download(path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might even be a touch faster here. The Homebrew::API.tap_from_source_download method is quite slow when it gets called a lot in commands like brew readall. This change in logic means it will get called less in that scenario though I plan on opening a PR soon to move from Pathname#relative_path_from in that method to a regex to speed things up anyway.

@reitermarkus reitermarkus merged commit e90b53b into Homebrew:master Feb 9, 2024
24 checks passed
@reitermarkus reitermarkus deleted the cask-loader-improvements branch February 9, 2024 16:46
@github-actions github-actions bot added the outdated PR was locked due to age label Mar 11, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants