Module: Metafiles Private
- Defined in:
- metafiles.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Helper for checking if a file is considered a metadata file.
Constant Summary collapse
- LICENSES =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
T.let(Set.new(%w[copyingcopyrightlicenselicence]).freeze, T::Set[String])
- EXTENSIONS =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
T.let(Set.new(%w[.adoc.asc.asciidoc.creole.html.markdown.md.mdown.mediawiki.mkdn.org.pod.rdoc.rst.rtf.textile.txt.wiki]).freeze, T::Set[String])
- BASENAMES =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
T.let(Set.new(%w[aboutauthorschangelogchangeshistorynewsnotesnoticereadmetodo]).freeze, T::Set[String])
Class Method Summary collapse
- .copy?(file) ⇒ Boolean private
- .list?(file) ⇒ Boolean private
Class Method Details
.copy?(file) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
26 27 28 29 30 31 32 33 34 35 | # File 'metafiles.rb', line 26 def copy?(file) file = file.downcase license = file.split(/\.|-/).first return false unless license return true if LICENSES.include?(license) 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. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
19 20 21 22 23 | # File 'metafiles.rb', line 19 def list?(file) return false if %w[.DS_StoreINSTALL_RECEIPT.json].include?(file) !copy?(file) end |
© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/Metafiles.html