Exception: Keg::ConflictError Private

Inherits:
LinkError
  • Object
show all
Extended by:
T::Sig
Defined in:
keg.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.

Error for when a file already exists or belongs to another keg.

Instance Attribute Summary

Attributes inherited from LinkError

#dst, #keg, #src

Instance Method Summary collapse

Methods inherited from LinkError

#initialize

Constructor Details

This class inherits a constructor from Keg::LinkError

Instance Method Details

#suggestionString

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:



47
48
49
50
51
52
53
54
55
56
# File 'keg.rb', line 47

def suggestion
  conflict = Keg.for(dst)
rescue NotAKegError, Errno::ENOENT
  "already exists. You may want to remove it:\n  rm '#{dst}'\n"
else
  <<~EOS
    is a symlink belonging to #{conflict.name}. You can unlink it:
      brew unlink #{conflict.name}
  EOS
end

#to_sString

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:



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'keg.rb', line 59

def to_s
  s = []
  s << "Could not symlink #{src}"
  s << "Target #{dst}" << suggestion
  s << <<~EOS
    To force the link and overwrite all conflicting files:
      brew link --overwrite #{keg.name}

    To list all files that would be deleted:
      brew link --overwrite --dry-run #{keg.name}
  EOS
  s.join("\n")
end