Skip to content

Commit

Permalink
brew_installer: fix use of force flag
Browse files Browse the repository at this point in the history
Fixes passing `brew bundle --force` to:
- make formula installation run `brew install <formula> --force --overwrite`
- run 'brew link --overwrite <formula>' to force relinking of an unlinked non-keg by default (i.e. link: nil)
  • Loading branch information
yelsa committed Sep 29, 2024
1 parent b82ff87 commit 0127d30
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/bundle/brew_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def self.preinstall(name, no_upgrade: false, verbose: false, **options)
new(name, options).preinstall(no_upgrade:, verbose:)
end

def self.install(name, preinstall: true, no_upgrade: false, verbose: false, **options)
new(name, options).install(preinstall:, no_upgrade:, verbose:)
def self.install(name, preinstall: true, no_upgrade: false, verbose: false, force: false, **options)
new(name, options).install(preinstall:, no_upgrade:, verbose:, force:)
end

def initialize(name, options = {})
Expand Down Expand Up @@ -112,7 +112,7 @@ def link_change_state!(verbose: false, force: false)
when nil
if unlinked_and_not_keg_only?
puts "Linking #{@name} formula." if verbose
link_args = "link"
link_args = ["link"]
link_args << "--overwrite" if force
Bundle.system(HOMEBREW_BREW_FILE, *link_args, @name, verbose:)
elsif linked_and_keg_only?
Expand Down

0 comments on commit 0127d30

Please sign in to comment.