Merge pull request #2106 from naoty/exclude-executable-metafiles

Exclude executables from metafiles
This commit is contained in:
Mike McQuaid 2017-02-27 08:18:11 +00:00 committed by GitHub
commit 3d0d5d631e
4 changed files with 17 additions and 2 deletions

View File

@ -457,6 +457,10 @@ class Pathname
end
end
def ds_store?
basename.to_s == ".DS_Store"
end
# https://bugs.ruby-lang.org/issues/9915
if RUBY_VERSION == "2.0.0"
prepend Module.new {

View File

@ -207,8 +207,8 @@ class Keg
alias eql? ==
def empty_installation?
Pathname.glob("#{path}/**/*") do |file|
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

@ -60,6 +60,10 @@ describe Keg do
(keg/"bin").rmtree
expect(keg).to be_an_empty_installation
(keg/"bin").mkpath
touch keg.join("bin", "todo")
expect(keg).not_to be_an_empty_installation
end
specify "#oldname_opt_record" do

View File

@ -284,6 +284,13 @@ describe Pathname do
expect(dst/dir.basename).to be_a_directory
end
end
describe "#ds_store?" do
it "returns whether a file is .DS_Store or not" do
expect(file).not_to be_ds_store
expect(file/".DS_Store").to be_ds_store
end
end
end
describe FileUtils do