Dir.glob should be able receive a flag for finding dirs starting with a dot #104

Closed
wants to merge 4 commits into
from

Conversation

Projects
None yet
5 participants
Contributor

marano commented Sep 16, 2011

Dir[] glob receives a flag for finding dirs starting with a dot.

Example:
If '/one/.dotdir/three.rb' exists

Dir.glob(['/one/*/'], File::FNM_DOTMATCH).should == ['/one/.dotdir/three.rb']

Collaborator

jfirebaugh commented Apr 17, 2012

Can you rebase this on current master? I'm having trouble merging and getting the specs you added to pass.

Also, it's better if you create a unique branch for each pull request. As you can see, commits from your previous PRs are showing up here. Except for #103, they've already been merged, and I think we can subsume #103 into this one.

Collaborator

eventualbuddha commented Dec 18, 2013

I've volunteered to update fakefs a little bit and triage the existing pull requests. This one was small enough that I decided to try to merge it myself. I managed to work through the conflicts but found a problem. The test added to check that File::FNM_DOTMATCH works does not actually assert what Dir.glob really returns. See the diff below for the updated test. You can see my WIP branch at eventualbuddha/marano/issue_104.

diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb
index 9f411b6..9419a0e 100644
--- a/test/fakefs_test.rb
+++ b/test/fakefs_test.rb
@@ -1046,7 +1046,9 @@ class FakeFSTest < Test::Unit::TestCase
   def test_dir_glob_can_be_overridden_to_match_dot_dirs
     FileUtils.mkdir_p '/one/.dotdir'
     File.open('/one/.dotdir/three.rb', 'w')
-    assert_equal ['/one/.dotdir/three.rb'], Dir.glob(['/one/**/*'], File::FNM_DOTMATCH)
+    assert_equal \
+      ['/one/.', '/one/..', '/one/.dotdir', '/one/.dotdir/.', '/one/.dotdir/..', '/one/.dotdir/three.rb'],
+      Dir.glob(['/one/**/*'], File::FNM_DOTMATCH)
   end

   if RUBY_VERSION >= "1.9"
Collaborator

eventualbuddha commented Jul 2, 2014

Closing until/unless someone wants to take this up.

This is still broken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment