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

Support link: :overwrite option #1455

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yelsa
Copy link
Contributor

@yelsa yelsa commented Sep 30, 2024

  • set link: :overwrite per formula
  • uses brew link --overwrite to force linking and overwrite all conflicting files
  • use the linked? and keg_only? predicates available from Formula
  • --force should only be passed when it's keg-only
  • check linked/unlinked state to avoid re-calling brew link / brew unlink

Closes #1062
Resolves #1116 (comment), #1116 (comment)

- set `link: :overwrite` per formula to use `brew link --overwrite` to force linking and overwrite all conflicting files
- use the linked? and keg_only? predicates available from Formula
- `--force` should only be passed when it's keg-only
- check linked/unlinked state to avoid re-calling `brew link`\`brew unlink`
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 @yelsa! Looking good so far.

# 'brew install --with-rmtp', 'brew services restart' on version changes
brew "denji/nginx/nginx-full", args: ["with-rmtp"], restart_service: :changed
# 'brew install --with-rmtp', 'brew link --overwrite', 'brew services restart' on version changes
brew "denji/nginx/nginx-full", link: :overwrite, args: ["with-rmtp"], restart_service: :changed
Copy link
Member

Choose a reason for hiding this comment

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

Not sure about this DSL; having true/false/:overwrite as valid values is a bit confusing. Thoughts about link_overwrite: true instead?

end
end

if cmd
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if cmd
if cmd.present?

when true
unless linked_and_keg_only?
puts "Force-linking #{@name} formula." if verbose
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a behaviour, maybe messaging, change? Can you detail the expected changes in behaviour/messaging? Thanks!

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.

feature request: support brew link --overwrite
2 participants