mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Fix Keg#find so we don't have to deal with it everywhere
lol inheritance
This commit is contained in:
parent
1f0d424459
commit
cb9ee747e0
@ -84,7 +84,7 @@ module Homebrew extend self
|
||||
end
|
||||
|
||||
index = 0
|
||||
Pathname.new(keg).find do |pn|
|
||||
keg.find do |pn|
|
||||
if pn.symlink? && (link = pn.readlink).absolute?
|
||||
if link.to_s.start_with?(string)
|
||||
opoo "Absolute symlink starting with #{string}:" if index.zero?
|
||||
|
@ -104,7 +104,11 @@ class Keg < Pathname
|
||||
end
|
||||
|
||||
def basename
|
||||
Pathname.new(self.to_s).basename
|
||||
Pathname.new(self).basename
|
||||
end
|
||||
|
||||
def find(*args, &block)
|
||||
Pathname.new(self).find(*args, &block)
|
||||
end
|
||||
|
||||
def link mode=OpenStruct.new
|
||||
@ -197,10 +201,7 @@ class Keg < Pathname
|
||||
end
|
||||
|
||||
def delete_pyc_files!
|
||||
Pathname.new(self).find do |pn|
|
||||
next if pn.extname != '.pyc'
|
||||
pn.delete
|
||||
end
|
||||
find { |pn| pn.delete if pn.extname == ".pyc" }
|
||||
end
|
||||
|
||||
protected
|
||||
|
@ -157,7 +157,7 @@ class Keg
|
||||
script_files = []
|
||||
|
||||
# find all files with shebangs
|
||||
Pathname.new(self).find do |pn|
|
||||
find do |pn|
|
||||
next if pn.symlink? or pn.directory?
|
||||
script_files << pn if pn.text_executable?
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user