Spec-Zone.ru › Homebrew

Exception: FormulaConflictError Private

Inherits:
RuntimeError
  • Object
  • RuntimeError
  • FormulaConflictError
show all
Defined in:
exceptions.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Raised when a formula conflicts with another one.

Instance Attribute Summary collapse

  • #conflicts ⇒ Array<Formula::FormulaConflict> readonly private
  • #formula ⇒ Formula readonly private

Instance Method Summary collapse

  • #conflict_message(conflict) ⇒ String private
  • #initialize(formula, conflicts) ⇒ void constructor private
  • #message ⇒ String private

Constructor Details

#initialize(formula, conflicts) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • formula (Formula)
  • conflicts (Array<Formula::FormulaConflict>)


536
537
538
539
540
# File 'exceptions.rb', line 536

def initialize(formula, conflicts)
  @formula = formula
  @conflicts = conflicts
  super message
end

Instance Attribute Details

#conflicts ⇒ Array<Formula::FormulaConflict> (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Array<Formula::FormulaConflict>)


533
534
535
# File 'exceptions.rb', line 533

def conflicts
  @conflicts
end

#formula ⇒ Formula (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Formula)


530
531
532
# File 'exceptions.rb', line 530

def formula
  @formula
end

Instance Method Details

#conflict_message(conflict) ⇒ String

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • conflict (Formula::FormulaConflict)

Returns:

  • (String)


543
544
545
546
547
548
# File 'exceptions.rb', line 543

def conflict_message(conflict)
  message = []
  message << "#{conflict.name}"
  message << ": because #{conflict.reason}" if conflict.reason
  message.join
end

#message ⇒ String

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (String)


551
552
553
554
555
556
557
558
559
560
561
562
563
564
# File 'exceptions.rb', line 551

def message
  message = []
  message << "Cannot install #{formula.full_name} because conflicting formulae are installed."
  message.concat conflicts.map { |c| conflict_message(c) } << ""
  message << <<~EOS
    Please `brew unlink #{conflicts.map(&:name) * ""}` before continuing.
    Unlinking removes a formula's symlinks from #{HOMEBREW_PREFIX}. You can
    link the formula again after the install finishes. You can `--force` this
    install, but the build may fail or cause obscure side effects in the
    resulting software.
  EOS
  message.join("\n")
end

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/FormulaConflictError.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API