Module: Metafiles

Defined in:
Library/Homebrew/metafiles.rb

Constant Summary collapse

EXTENSIONS =
Set.new %w[
  .adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn
  .org .pod .rdoc .rst .rtf .textile .txt .wiki
].freeze
BASENAMES =
Set.new %w[
  about authors changelog changes copying copyright history license licence
  news notes notice readme todo
].freeze

Class Method Summary collapse

Class Method Details

.copy?(file) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
# File 'Library/Homebrew/metafiles.rb', line 21

def copy?(file)
  file = file.downcase
  ext  = File.extname(file)
  file = File.basename(file, ext) if EXTENSIONS.include?(ext)
  BASENAMES.include?(file)
end

.list?(file) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'Library/Homebrew/metafiles.rb', line 16

def list?(file)
  return false if %w[.DS_Store INSTALL_RECEIPT.json].include?(file)
  !copy?(file)
end