diff options
| author | Jack Nagel | 2014-06-07 23:40:26 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-06-07 23:40:28 -0500 |
| commit | 6d0f0cb195a0e3db68c33a65f09ad482af6ecb95 (patch) | |
| tree | 71219de786a66a12c4c9e015656e89e341a568d3 | |
| parent | 07257f2f4861449f3446a06d5eed2b36f4deda65 (diff) | |
| download | brew-6d0f0cb195a0e3db68c33a65f09ad482af6ecb95.tar.bz2 | |
metafiles: simplify #copy? further
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/metafiles.rb | 16 |
2 files changed, 6 insertions, 12 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index f04c6a810..2a2790c12 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -378,7 +378,7 @@ class Pathname def install_metafiles from=Pathname.pwd Pathname(from).children.each do |p| 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) filename = p.resolved_path # Some software links metafiles together, so by the time we iterate to one of them diff --git a/Library/Homebrew/metafiles.rb b/Library/Homebrew/metafiles.rb index a6a265292..c0a920912 100644 --- a/Library/Homebrew/metafiles.rb +++ b/Library/Homebrew/metafiles.rb @@ -10,16 +10,10 @@ class Metafiles !copy?(file) end - def self.copy?(path) - path = path.to_s.downcase - ext = File.extname(path) - - if EXTENSIONS.include?(ext) - basename = File.basename(path, ext) - else - basename = File.basename(path) - end - - return BASENAMES.include?(basename) + def self.copy?(file) + file = file.downcase + ext = File.extname(file) + file = File.basename(file, ext) if EXTENSIONS.include?(ext) + BASENAMES.include?(file) end end |
