Hoist top-level directory list into a constant
This commit is contained in:
parent
c92971f475
commit
f8183d9510
@ -187,9 +187,9 @@ def check_for_other_package_managers
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_for_broken_symlinks
|
def check_for_broken_symlinks
|
||||||
|
require 'keg'
|
||||||
broken_symlinks = []
|
broken_symlinks = []
|
||||||
%w[lib include sbin bin etc share].each do |d|
|
Keg::PRUNEABLE_DIRECTORIES.map { |d| HOMEBREW_PREFIX/d }.each do |d|
|
||||||
d = HOMEBREW_PREFIX/d
|
|
||||||
next unless d.directory?
|
next unless d.directory?
|
||||||
d.find do |pn|
|
d.find do |pn|
|
||||||
broken_symlinks << pn if pn.symlink? and pn.readlink.expand_path.to_s =~ /^#{HOMEBREW_PREFIX}/ and not pn.exist?
|
broken_symlinks << pn if pn.symlink? and pn.readlink.expand_path.to_s =~ /^#{HOMEBREW_PREFIX}/ and not pn.exist?
|
||||||
|
|||||||
@ -9,7 +9,7 @@ module Homebrew extend self
|
|||||||
$d = 0
|
$d = 0
|
||||||
dirs = []
|
dirs = []
|
||||||
|
|
||||||
%w[bin sbin etc lib include share Library/LinkedKegs].map{ |d| HOMEBREW_PREFIX+d }.each do |path|
|
Keg::PRUNEABLE_DIRECTORIES.map{ |d| HOMEBREW_PREFIX/d }.each do |path|
|
||||||
next unless path.directory?
|
next unless path.directory?
|
||||||
path.find do |path|
|
path.find do |path|
|
||||||
path.extend ObserverPathnameExtension
|
path.extend ObserverPathnameExtension
|
||||||
|
|||||||
@ -10,6 +10,8 @@ class Keg < Pathname
|
|||||||
# locale-specific directories have the form language[_territory][.codeset][@modifier]
|
# locale-specific directories have the form language[_territory][.codeset][@modifier]
|
||||||
LOCALEDIR_RX = /(locale|man)\/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?/
|
LOCALEDIR_RX = /(locale|man)\/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?/
|
||||||
INFOFILE_RX = %r[info/([^.].*?\.info|dir)$]
|
INFOFILE_RX = %r[info/([^.].*?\.info|dir)$]
|
||||||
|
TOP_LEVEL_DIRECTORIES = %w[bin etc include lib sbin share var]
|
||||||
|
PRUNEABLE_DIRECTORIES = %w[bin etc include lib sbin share Library/LinkedKegs]
|
||||||
|
|
||||||
# if path is a file in a keg then this will return the containing Keg object
|
# if path is a file in a keg then this will return the containing Keg object
|
||||||
def self.for path
|
def self.for path
|
||||||
@ -31,7 +33,7 @@ class Keg < Pathname
|
|||||||
# of files and directories linked
|
# of files and directories linked
|
||||||
$n=$d=0
|
$n=$d=0
|
||||||
|
|
||||||
%w[bin etc lib include sbin share var].map{ |d| self/d }.each do |src|
|
TOP_LEVEL_DIRECTORIES.map{ |d| self/d }.each do |src|
|
||||||
next unless src.exist?
|
next unless src.exist?
|
||||||
src.find do |src|
|
src.find do |src|
|
||||||
next if src == self
|
next if src == self
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user