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

Adds logging to cask loader #14514

Merged

Conversation

apainintheneck
Copy link
Contributor

  • 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?

The idea here is to make it easier to debug any cask loading problems in the future. We already have similar logging in place in Formulary.

Changes

  • extend Context to get debug? method
  • create FromDefaultTapPathLoader to handle expected loading option
    • Note: This is a common case and it allows it to be logged as well.
  • log cask loader used when --debug

Examples

Without --debug:

$ brew install -n --cask 1password
==> Would install 1 cask:
1password

With --debug:

$ brew install -n --cask "$(brew --repo)/Library/Taps/homebrew/homebrew-cask/casks/1password.rb" --debug
/usr/local/Homebrew/Library/Homebrew/brew.rb (Cask::CaskLoader::FromTapPathLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/casks/1password.rb
==> Would install 1 cask:
1password
/u/l/Homebrew (add-logging-to-cask-loader|✔) $ brew install -n --cask homebrew/cask/1password --debug
/usr/local/Homebrew/Library/Homebrew/brew.rb (Cask::CaskLoader::FromTapLoader): loading homebrew/cask/1password
==> Would install 1 cask:
1password
/u/l/Homebrew (add-logging-to-cask-loader|✔) $ brew install -n --cask 1password --debug
/usr/local/Homebrew/Library/Homebrew/brew.rb (Cask::CaskLoader::FromDefaultTapPathLoader): loading 1password
==> Would install 1 cask:
1password

- extend Context to get `debug?` method
- create FromDefaultTapPathLoader to handle
  expected loading option
- log cask loader used when --debug
@apainintheneck apainintheneck added the cask Homebrew Cask label Feb 5, 2023
@BrewTestBot
Copy link
Member

Review period will end on 2023-02-07 at 00:00:00 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Feb 5, 2023
Copy link
Member

@Rylan12 Rylan12 left a comment

Choose a reason for hiding this comment

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

Thanks, looks good! This will be helpful

@MikeMcQuaid MikeMcQuaid added the critical Critical change which should be shipped as soon as possible. label Feb 6, 2023
@MikeMcQuaid
Copy link
Member

Love this, thanks @apainintheneck!

@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Feb 6, 2023
@BrewTestBot
Copy link
Member

Review period skipped due to critical label.

@MikeMcQuaid MikeMcQuaid merged commit bdc22fe into Homebrew:master Feb 6, 2023
@apainintheneck apainintheneck deleted the add-logging-to-cask-loader branch February 11, 2023 19:08
@github-actions github-actions bot added the outdated PR was locked due to age label Mar 14, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cask Homebrew Cask critical Critical change which should be shipped as soon as possible. outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants