aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-03-27 17:05:17 -0500
committerJack Nagel2014-03-27 17:06:05 -0500
commitf788e398302f74f77c32e242a243d539908d942d (patch)
tree2a88eeaa71d46c2fa98bacb87f34677b3d41190d
parent1fbca91e17a358ca95ccfba0660642b649e33ce9 (diff)
downloadhomebrew-f788e398302f74f77c32e242a243d539908d942d.tar.bz2
Fix Keg#find so we don't have to deal with it everywhere
lol inheritance
-rw-r--r--Library/Homebrew/cmd/bottle.rb2
-rw-r--r--Library/Homebrew/keg.rb11
-rw-r--r--Library/Homebrew/keg_fix_install_names.rb2
3 files changed, 8 insertions, 7 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb
index 5f7df309e..790051117 100644
--- a/Library/Homebrew/cmd/bottle.rb
+++ b/Library/Homebrew/cmd/bottle.rb
@@ -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?
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 5beb7dc06..c72c1da04 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -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
diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb
index 777a5ed00..f490a9c79 100644
--- a/Library/Homebrew/keg_fix_install_names.rb
+++ b/Library/Homebrew/keg_fix_install_names.rb
@@ -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