brew/Library/Homebrew/metafiles.rb

26 lines
572 B
Ruby
Raw Normal View History

class Metafiles
2014-06-07 17:45:13 -05:00
EXTENSIONS = %w[.md .html .rtf .txt]
BASENAMES = %w[
about authors changelog changes copying copyright history license licence
news notes notice readme todo
]
def should_list? file
return false if %w[.DS_Store INSTALL_RECEIPT.json].include? file
!copy?(file)
end
def should_copy?(path)
path = path.to_s.downcase
ext = File.extname(path)
if EXTENSIONS.include?(ext)
2014-06-07 17:45:13 -05:00
basename = File.basename(path, ext)
else
2014-06-07 17:45:13 -05:00
basename = File.basename(path)
end
2014-06-07 17:45:13 -05:00
return BASENAMES.include?(basename)
end
end