Check for metafiles only in the root directory

This commit is contained in:
Naoto Kaneko 2017-02-24 17:44:27 +09:00
parent 56a0afe579
commit ccc9b2dc6d
2 changed files with 6 additions and 3 deletions

View File

@ -207,9 +207,8 @@ class Keg
alias eql? ==
def empty_installation?
Pathname.glob("#{path}/**/*") do |file|
return false if file.executable?
next if file.directory?
Pathname.glob("#{path}/*") do |file|
return false if file.directory? && !file.children.reject(&:ds_store?).empty?
basename = file.basename.to_s
next if Metafiles.copy?(basename)
next if %w[.DS_Store INSTALL_RECEIPT.json].include?(basename)

View File

@ -59,6 +59,10 @@ class LinkTests < LinkTestCase
(@keg/"bin").rmtree
assert_predicate @keg, :empty_installation?
(@keg/"bin").mkpath
touch @keg.join("bin", "todo")
refute_predicate @keg, :empty_installation?
end
def test_linking_keg