-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
conflicts_with :formula
for casks
- Loading branch information
Showing
9 changed files
with
85 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# typed: true | ||
# frozen_string_literal: true | ||
|
||
# Used to track formulae that cannot be installed at the same time. | ||
FormulaConflict = Struct.new(:name, :reason) do | ||
def conflict_message | ||
message = [] | ||
message << " #{name}" | ||
message << ": because #{reason}" if reason | ||
message.join | ||
end | ||
|
||
def conflicts?(formula_or_cask) | ||
f = Formulary.factory(name) | ||
rescue TapFormulaUnavailableError | ||
# If the formula name is a fully-qualified name let's silently | ||
# ignore it as we don't care about things used in taps that aren't | ||
# currently tapped. | ||
false | ||
rescue FormulaUnavailableError => e | ||
# If the formula name doesn't exist any more then complain but don't | ||
# stop installation from continuing. | ||
official_tap, filename = if formula_or_cask.is_a?(Formula) | ||
["homebrew-core", formula_or_cask.path.basename] | ||
else | ||
["homebrew-cask", formula_or_cask.sourcefile_path.basename] | ||
end | ||
opoo <<~EOS | ||
#{formula_or_cask}: #{e.message} | ||
'conflicts_with "#{name}"' should be removed from #{filename}. | ||
EOS | ||
|
||
raise if Homebrew::EnvConfig.developer? | ||
|
||
$stderr.puts "Please report this issue to the #{formula_or_cask.tap} tap " \ | ||
"(not Homebrew/brew or Homebrew/#{official_tap})!" | ||
false | ||
else | ||
f.linked_keg.exist? && f.opt_prefix.exist? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters