2012-09-09 13:19:53 -07:00
|
|
|
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
|
|
|
|
]
|
2012-09-09 13:19:53 -07:00
|
|
|
|
|
|
|
def should_list? file
|
|
|
|
return false if %w[.DS_Store INSTALL_RECEIPT.json].include? file
|
2014-06-07 17:47:45 -05:00
|
|
|
!copy?(file)
|
2012-09-09 13:19:53 -07:00
|
|
|
end
|
|
|
|
|
2014-06-07 17:47:45 -05:00
|
|
|
def should_copy?(path)
|
2014-06-07 17:45:13 -05:00
|
|
|
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)
|
2012-09-09 13:19:53 -07:00
|
|
|
else
|
2014-06-07 17:45:13 -05:00
|
|
|
basename = File.basename(path)
|
2012-09-09 13:19:53 -07:00
|
|
|
end
|
|
|
|
|
2014-06-07 17:45:13 -05:00
|
|
|
return BASENAMES.include?(basename)
|
2014-06-07 17:45:13 -05:00
|
|
|
end
|
2012-09-09 13:19:53 -07:00
|
|
|
end
|