Eliminate FORMULA_META_FILES constant

This commit is contained in:
Jack Nagel 2014-06-07 17:49:07 -05:00
parent fef866aae4
commit fcacb25cd5
4 changed files with 8 additions and 7 deletions

View File

@ -1,3 +1,5 @@
require "metafiles"
module Homebrew extend self
def list
@ -100,7 +102,7 @@ class PrettyListing
else
print_dir pn
end
elsif FORMULA_META_FILES.should_list? pn.basename.to_s
elsif Metafiles.list?(pn.basename.to_s)
puts pn
end
end

View File

@ -1,6 +1,7 @@
require 'pathname'
require 'mach'
require 'resource'
require 'metafiles'
# we enhance pathname to make our code more readable
class Pathname
@ -381,7 +382,7 @@ class Pathname
from.children.each do |p|
next if p.directory?
next unless FORMULA_META_FILES.should_copy? p
next unless Metafiles.copy?(p)
# Some software symlinks these files (see help2man.rb)
filename = p.resolved_path
# Some software links metafiles together, so by the time we iterate to one of them

View File

@ -94,8 +94,6 @@ module Homebrew extend self
alias_method :failed?, :failed
end
require 'metafiles'
FORMULA_META_FILES = Metafiles.new
ISSUES_URL = "https://github.com/Homebrew/homebrew/wiki/troubleshooting"
HOMEBREW_PULL_OR_COMMIT_URL_REGEX = 'https:\/\/github.com\/(\w+)\/homebrew(-\w+)?\/(pull\/(\d+)|commit\/\w{4,40})'

View File

@ -5,12 +5,12 @@ class Metafiles
news notes notice readme todo
]
def should_list? file
return false if %w[.DS_Store INSTALL_RECEIPT.json].include? file
def self.list?(file)
return false if %w[.DS_Store INSTALL_RECEIPT.json].include?(file)
!copy?(file)
end
def should_copy?(path)
def self.copy?(path)
path = path.to_s.downcase
ext = File.extname(path)