metafiles: simplify #copy? further

This commit is contained in:
Jack Nagel 2014-06-07 23:40:26 -05:00
parent 07257f2f48
commit 6d0f0cb195
2 changed files with 6 additions and 12 deletions

View File

@ -378,7 +378,7 @@ class Pathname
def install_metafiles from=Pathname.pwd def install_metafiles from=Pathname.pwd
Pathname(from).children.each do |p| Pathname(from).children.each do |p|
next if p.directory? next if p.directory?
next unless Metafiles.copy?(p) next unless Metafiles.copy?(p.basename.to_s)
# Some software symlinks these files (see help2man.rb) # Some software symlinks these files (see help2man.rb)
filename = p.resolved_path filename = p.resolved_path
# Some software links metafiles together, so by the time we iterate to one of them # Some software links metafiles together, so by the time we iterate to one of them

View File

@ -10,16 +10,10 @@ class Metafiles
!copy?(file) !copy?(file)
end end
def self.copy?(path) def self.copy?(file)
path = path.to_s.downcase file = file.downcase
ext = File.extname(path) ext = File.extname(file)
file = File.basename(file, ext) if EXTENSIONS.include?(ext)
if EXTENSIONS.include?(ext) BASENAMES.include?(file)
basename = File.basename(path, ext)
else
basename = File.basename(path)
end
return BASENAMES.include?(basename)
end end
end end