SBoudrias/mem-fs-editor — pull request #16 by blai (2014-12-19 07:29:43+00:00)
Title: Unified glob usage across copy/delete fore better directory support.

@SBoudrias This PR contains breaking change!

This PR attempts to address a list of issues I found around copy/delete.

* #15
* Currently, `fs.delete` only deletes files that is buffered in `mem-fs` store. It seems like [this is intentional](https://github.com/SBoudrias/mem-fs-editor/blob/master/test/delete.js#L24), but I found this a little cumbersome in many Yeoman generator use cases. So the new implementation will delete both uncommitted files in store, as well as physical files that has not been read into the store. **This is a breaking change**
* Currently, `copy` only support `from` to be either a file, or a glob pattern that uses `*`. But [not all glob patterns use `*`](https://github.com/isaacs/node-glob#globhasmagicpattern-options). The new implementation supports `from` to be the following:
1. a path that map to an existing file
2. a path that map to an existing directory, in which case, `from` is converted to a glob pattern `form + '/**`
3. a glob pattern, user can also optionally pass in a `options.globOptions` object to customize the glob pattern matching behavior
* Currently, `delete` does not support glob pattern. The new implementation make this possible. And `options.globOptions` is also made available here.
* When calling `copy` with `from` being a glob pattern, and `to` being `/a/b/c.is.a.dir/` will throw exception. Some directory does contain `.` in its name.
* Currently, calling `copy` with `from = '/foo/a/**'` and `to = '/bar'`, and if the only file under `/foo/a/` is `/foo/a/b/c.txt` then what's end up in `/bar` would be, `/bar/c.txt`. But later if we create one more file under `/foo/a/` (e.g. `/foo/a/d/e.txt`), and rerun the Yeoman generator again, the program will try copy these files into `/bar/b/c.txt` and `/bar/d/e/txt`. This behavior may not meet the average expectation.