[Rake-devel] [PATCH] Better pattern support for FileList
Tilman Sauerbeck
tilman at code-monkey.de
Sat Aug 12 14:37:56 EDT 2006
Jim Weirich [2006-08-12 14:24]:
> Tilman Sauerbeck wrote:
> > Tilman Sauerbeck [2006-08-12 19:04]:
> >> Note that I didn't actually test the unit test that I added, cause I'm
> >> too lazy to install rcov right now :P
> >
> > That tought me!
> >
> > The patch is useless, as Dir.glob will not find files that don't exist
> > ;)
> >
> > Looks like we do have to check for braces and brackets and stuff :(
>
> yeah, I noticed that too. I'm working through it right now.
I hope you're not done yet. I attached a fixed patch.
Regards,
Tilman
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
-------------- next part --------------
Index: test/test_filelist.rb
===================================================================
--- test/test_filelist.rb (revision 565)
+++ test/test_filelist.rb (working copy)
@@ -106,6 +106,25 @@
].sort, fl.sort
end
+ def test_bracket_patterns
+ touch "testdata/foo.c"
+ touch "testdata/foo.h"
+
+ fl = FileList.new
+ fl.include("testdata/foo.[ch]")
+ assert_equal 2, fl.size
+ assert fl.include?("testdata/foo.c")
+ assert fl.include?("testdata/foo.h")
+ end
+
+ def test_brace_patterns
+ fl = FileList.new
+ fl.include("testdata/{xyz,abc}.c")
+ assert_equal 2, fl.size
+ assert fl.include?("testdata/xyz.c")
+ assert fl.include?("testdata/abc.c")
+ end
+
def test_reject
fl = FileList.new
fl.include %w(testdata/x.c testdata/abc.c testdata/xyz.c testdata/existing)
Index: lib/rake.rb
===================================================================
--- lib/rake.rb (revision 565)
+++ lib/rake.rb (working copy)
@@ -1133,7 +1133,7 @@
def resolve_add(fn)
case fn
- when %r{[*?]}
+ when %r{[*?]}, %r{\[.*\]}, %r{\{.*\}}
add_matching(fn)
else
self << fn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/rake-devel/attachments/20060812/69530785/attachment.bin
More information about the Rake-devel
mailing list