Module: Metafiles Private

Defined in:
Library/Homebrew/metafiles.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Helper for checking if a file is considered a metadata file.

Constant Summary collapse

LICENSES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Set.new(%w[copying copyright license licence]).freeze
EXTENSIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

https://github.com/github/markup#markups

Set.new(%w[
  .adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn
  .org .pod .rdoc .rst .rtf .textile .txt .wiki
]).freeze
BASENAMES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Set.new(%w[about authors changelog changes history news notes notice readme todo]).freeze

Class Method Summary collapse

Class Method Details

.copy?(file) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

24
25
26
27
28
29
30
31
# File 'Library/Homebrew/metafiles.rb', line 24

def copy?(file)
  file = file.downcase
  return true if LICENSES.include? file.split(/\.|-/).first

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

.list?(file) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

18
19
20
21
22
# File 'Library/Homebrew/metafiles.rb', line 18

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

  !copy?(file)
end