Teach Pathname how to scan for metafiles

This commit is contained in:
Adam Vandenberg 2012-11-11 10:45:58 -08:00
parent 4b72e44461
commit 489ebd78d6
2 changed files with 16 additions and 12 deletions

View File

@ -144,22 +144,11 @@ def install f
end
# Find and link metafiles
install_meta_files Pathname.pwd, f.prefix
f.prefix.install_metafiles Pathname.pwd
end
end
end
def install_meta_files src_path, dst_path
src_path.children.each do |p|
next if p.directory?
next unless FORMULA_META_FILES.should_copy? p
# Some software symlinks these files (see help2man.rb)
filename = p.resolved_path
filename.chmod 0644
dst_path.install filename
end
end
def fixopt f
path = if f.linked_keg.directory? and f.linked_keg.symlink?
f.linked_keg.realpath

View File

@ -373,6 +373,21 @@ class Pathname
EOS
end
def install_metafiles from=nil
# Default to current path, and make sure we have a pathname, not a string
from = "." if from.nil?
from = Pathname.new(from.to_s)
from.children.each do |p|
next if p.directory?
next unless FORMULA_META_FILES.should_copy? p
# Some software symlinks these files (see help2man.rb)
filename = p.resolved_path
filename.chmod 0644
self.install filename
end
end
end
# sets $n and $d so you can observe creation of stuff