diff options
| author | Adam Vandenberg | 2012-09-09 13:19:53 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2012-11-11 10:27:03 -0800 |
| commit | 4b72e444613509b3102a94de1d1029a9318fcbad (patch) | |
| tree | e721a0f1810d016d601957031ce289c880afc368 /Library/Homebrew/metafiles.rb | |
| parent | ff55e7d82e7087567c9a370817d25e1542ff31f9 (diff) | |
| download | brew-4b72e444613509b3102a94de1d1029a9318fcbad.tar.bz2 | |
Use a class for FORMULA_META_FILES
* lets more text types get picked up
* better filter for `brew list`
Diffstat (limited to 'Library/Homebrew/metafiles.rb')
| -rw-r--r-- | Library/Homebrew/metafiles.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Library/Homebrew/metafiles.rb b/Library/Homebrew/metafiles.rb new file mode 100644 index 000000000..f73cb36fa --- /dev/null +++ b/Library/Homebrew/metafiles.rb @@ -0,0 +1,36 @@ +class Metafiles + + def initialize + @exts = %w[.txt .md .html] + @metafiles = %w[readme changelog changes copying license licence copyright authors] + 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 + +private + + def include? p + p = p.to_s # Might be a pathname + p = p.downcase + path = Pathname.new(p) + if @exts.include? path.extname + p = path.basename(path.extname) + else + p = path.basename + end + p = p.to_s + return @metafiles.include? p + end + +end |
