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
|
end
|
||||||
|
|
||||||
index = 0
|
index = 0
|
||||||
Pathname.new(keg).find do |pn|
|
keg.find do |pn|
|
||||||
if pn.symlink? && (link = pn.readlink).absolute?
|
if pn.symlink? && (link = pn.readlink).absolute?
|
||||||
if link.to_s.start_with?(string)
|
if link.to_s.start_with?(string)
|
||||||
opoo "Absolute symlink starting with #{string}:" if index.zero?
|
opoo "Absolute symlink starting with #{string}:" if index.zero?
|
||||||
|
@ -104,7 +104,11 @@ class Keg < Pathname
|
|||||||
end
|
end
|
||||||
|
|
||||||
def basename
|
def basename
|
||||||
Pathname.new(self.to_s).basename
|
Pathname.new(self).basename
|
||||||
|
end
|
||||||
|
|
||||||
|
def find(*args, &block)
|
||||||
|
Pathname.new(self).find(*args, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def link mode=OpenStruct.new
|
def link mode=OpenStruct.new
|
||||||
@ -197,10 +201,7 @@ class Keg < Pathname
|
|||||||
end
|
end
|
||||||
|
|
||||||
def delete_pyc_files!
|
def delete_pyc_files!
|
||||||
Pathname.new(self).find do |pn|
|
find { |pn| pn.delete if pn.extname == ".pyc" }
|
||||||
next if pn.extname != '.pyc'
|
|
||||||
pn.delete
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
@ -157,7 +157,7 @@ class Keg
|
|||||||
script_files = []
|
script_files = []
|
||||||
|
|
||||||
# find all files with shebangs
|
# find all files with shebangs
|
||||||
Pathname.new(self).find do |pn|
|
find do |pn|
|
||||||
next if pn.symlink? or pn.directory?
|
next if pn.symlink? or pn.directory?
|
||||||
script_files << pn if pn.text_executable?
|
script_files << pn if pn.text_executable?
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user