Fix Keg#find so we don't have to deal with it everywhere

lol inheritance
This commit is contained in:
Jack Nagel 2014-03-27 17:05:17 -05:00
parent 1f0d424459
commit cb9ee747e0
3 changed files with 8 additions and 7 deletions

View File

@ -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?

View File

@ -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

View File

@ -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