Merge pull request #2106 from naoty/exclude-executable-metafiles
Exclude executables from metafiles
This commit is contained in:
commit
3d0d5d631e
@ -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 {
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user