2012-09-09 13:19:53 -07:00
|
|
|
class Metafiles
|
|
|
|
|
|
|
|
def initialize
|
2012-11-11 10:55:08 -08:00
|
|
|
@exts = %w[.md .html .rtf .txt]
|
|
|
|
@metafiles = %w[
|
|
|
|
about authors changelog changes copying copyright history license
|
|
|
|
licence news notes notice readme todo]
|
2012-09-09 13:19:53 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
def + other
|
|
|
|
@metafiles + other
|
|
|
|
end
|
|
|
|
|
|
|
|
def should_copy? file
|
|
|
|
include? file
|
|
|
|
end
|
|
|
|
|
|
|
|
def should_list? file
|
|
|
|
return false if %w[.DS_Store INSTALL_RECEIPT.json].include? file
|
|
|
|
not include? file
|
|
|
|
end
|
|
|
|
|
2013-04-07 00:49:56 -05:00
|
|
|
private
|
2012-09-09 13:19:53 -07:00
|
|
|
|
2014-06-07 17:45:13 -05:00
|
|
|
def include?(path)
|
|
|
|
path = path.to_s.downcase
|
|
|
|
ext = File.extname(path)
|
|
|
|
|
|
|
|
if EXTENSIONS.include?(ext)
|
|
|
|
file = File.basename(path, ext)
|
2012-09-09 13:19:53 -07:00
|
|
|
else
|
2014-06-07 17:45:13 -05:00
|
|
|
file = File.basename(path)
|
2012-09-09 13:19:53 -07:00
|
|
|
end
|
|
|
|
|
2014-06-07 17:45:13 -05:00
|
|
|
return @metafiles.include?(file)
|
|
|
|
end
|
2012-09-09 13:19:53 -07:00
|
|
|
end
|