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

look for Brewfile in HOMEBREW_USER_CONFIG_HOME #1549

Merged
merged 4 commits into from
Jan 27, 2025

Conversation

rrotter
Copy link
Contributor

@rrotter rrotter commented Jan 2, 2025

Indirectly support XDG_CONFIG_HOME by leaning on brew's support for it.

when --global is set, we'll get the brewfile from:

  • $HOMEBREW_BUNDLE_FILE_GLOBAL if set
  • $XDG_CONFIG_HOME/homebrew/Brewfile (if XDG_CONFIG_HOME is set and file exists)
  • $HOME/.homebrew/Brewfile (if XDG_CONFIG_HOME is not set, and file exists)
  • ~/.Brewfile (unconditional fallback, but if this doesn't exist either, we should probably use $HOMEBREW_USER_CONFIG_HOME/Brewfile as the new default [edit: per feedback])

Starting this as a draft because:

When --global is set, use `$HOMEBREW_USER_CONFIG_HOME/Brewfile` if
it exists before falling back to `~/.Brewfile`.
@MikeMcQuaid
Copy link
Member

  • $HOME/.homebrew/Brewfile (if XDG_CONFIG_HOME is not set, and file exists)
  • but if this doesn't exist either, we should probably use $HOMEBREW_USER_CONFIG_HOME/Brewfile as the new default

This is the only part I'm 👎🏻 on, I don't see any users wanting this.

  • looking for feedback on what the fallback default should be if no file exists

The current location.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Code mostly makes sense so far. I'd be 👍🏻 on supporting behaviour change if XDG_CONFIG_HOME is set and otherwise I'd like to leave everything as-is. Thanks!

Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Jan 25, 2025
@rrotter rrotter marked this pull request as ready for review January 25, 2025 05:15
@rrotter
Copy link
Contributor Author

rrotter commented Jan 25, 2025

Updated help text, added spec.

@github-actions github-actions bot removed the stale label Jan 25, 2025
cmd/bundle.rb Outdated Show resolved Hide resolved
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks @rrotter, great work!

@MikeMcQuaid MikeMcQuaid merged commit e6dfce5 into Homebrew:master Jan 27, 2025
7 checks passed
@rrotter
Copy link
Contributor Author

rrotter commented Jan 27, 2025

@MikeMcQuaid, thanks. I went through several iterations on the help text before committing this. Not at all bothered that you decided to tweak it, but I just want to point out that I specifically avoided mentioning $HOMEBREW_USER_CONFIG_HOME in the help text (even though it's in the PR title) because it's a brew internal variable which can't be set by the user:

https://github.com/Homebrew/brew/blob/9fd2b27a353726b2ea1641b9b0477d5cc25ac595/bin/brew#L172-L177

MikeMcQuaid added a commit that referenced this pull request Jan 27, 2025
- address #1549 (comment)
  by referencing `XDG_CONFIG_HOME` rather than
  `HOMEBREW_USER_CONFIG_HOME` (and internal variable).
- Use environment variable names consistently.
@MikeMcQuaid
Copy link
Member

Thanks @rrotter, my bad. Fixing in #1579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants