-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to exclude a subdir from groups target directory? #53
Comments
Hey, may I humbly suggest to RTFM :) Under the Groups section of the Readme there's an explanation on how to define groups. You can do that by supplying a block as well, which will then yield each source file (check the rdoc on the public api of that) to that block, so you could check the path of the file and reject all those that are in your subdirectory. Hope this helps! |
I did RTFM. And I know about the block and it's seems to me a rather inefficient approach. I was hoping there might be a better way and if not, I would suggest that there should be. May I humbly suggest you refrain from using RTFM as an answer :) |
Oh, sorry, since you did not mention the block syntax for group definition, I figured you missed out on it :) Unfortunately, adding your proposed syntax would require SimpleCov to extend/monkey patch Ruby's String literals to be aware of Path names and also to add the "-" method to String which, even though this method does not exist in MRI right now, would be a very bad practice IMHO since it is a very low-level method name and might be added in future Ruby versions to Strings. What would be possible would be to create a Subclass for String that has those features, which would result in something like add_group "Foo", SrcPath('lib/foo') - SrcPath('lib/foo/bar') I think this looks rather clumsy though and adds unneccessary complexity through obscurity, since the block version might be almost the same, though in a bit more expressive way: add_group("Foo") {|src| src.filename.include?('lib/foo') and not src.filename.include?('lib/foo/bar') } |
Thanks. Actually I should have peaked at the code a bit more myself. I assumed that the "filter" argument was doing some sort of It also means that Note though you could do:
Allowing something like:
Or you could take it even further to handle fnmatch globs too:
Food for thought. Thanks again. |
Yeah, makes sense - maybe this should get refactored to use Ruby's built-in path functionalities like you mentioned. Reopening this as a reminder to investigate :) |
Closing as stale. Please reopen if this is still an issue. (And take a look at #340 ) |
How does one exclude a subdir from a group?
so to speak.
The text was updated successfully, but these errors were encountered: