Add ant-like globbing feature (some/recursive/path/**/to/dir and some/path/*/within/directory) #12

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

conf commented Apr 18, 2012

Examples:
some/path/*/to/dir expands items recursively from some/path/
some/path/
/to/dir expands items only within some/path/ directory

Shein Alexey Added ant-like globbing feature.
Examples:
some/path/**/to/dir expands items recursively from some/path/
some/path/*/to/dir expands items only within some/path/ directory
51e20d6

conf commented Apr 18, 2012

This can be handy if you need, say, to exclude some files from coverage in PHPUnit only by directory name, for example, if you have module structure like this (as Magento does)

├── Module
│   ├── etc
│   ├── Helper
│   ├── Model
│   ├── Objects
│   ├── sql
│   └── Test

you can't exclude Test or sql folder from coverage by pattern. With my patch you can do it easily this way:

        <whitelist addUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">app/code/local</directory>
            <exclude>
                <directory suffix=".php">app/code/local/**/Test/</directory>
                <directory suffix=".php">app/code/local/**/sql/</directory>
            </exclude>
        </whitelist>

where app/code/local directory contains various modules with the structure described above.

I have started to migrate my projects from File_Iterator to FinderFacade / Symfony's Finder and do not want to add new features to File_Iterator. Thank you for your contribution, though.

conf commented Apr 18, 2012

It's a pity.
If you're not against the idea itself, I could try to implement it there :)

It's already implemented there :)

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