gaze icon indicating copy to clipboard operation
gaze copied to clipboard

Test for creating file in subdirectories

Open floatdrop opened this issue 10 years ago • 16 comments

Hi. Turns out, that if you have empty subfolder - it will not be watched by gaze. Steps for manual reproducing are in this issue.

Test in patch actually hangs, because add event in not emitted.

floatdrop avatar Apr 20 '14 08:04 floatdrop

This is a tricky one. Since the pattern **/*.js doesn't initially match folder/subfolder, the folder is not watched and therefore doesn't monitor valid added events from within that folder.

Some options we have:

  1. Keep this behavior. If you want to get added events for unmatched folders, you need to specifically watch them.
  2. Watch every potential folder. For the pattern **/*.js, we detect and watch all folders that match **/*. This is pretty wasteful though and not full proof.
  3. Utilize a different file watching mechanism, such as fsevent, either in tandem or instead of. This would require a bit of work to get working consistently.
  4. Another idea?

shama avatar Apr 21 '14 02:04 shama

Option 2 sounds most like the "expected behaviour" to me. Perhaps make it opt-in to alleviate the wastefulness?

gaze('**/*.js', { matchEmptyDirs: true }, function() { });

lukehorvat avatar May 31 '14 05:05 lukehorvat

I would like #2, with lukehorvat's suggestion if the wastefullness becomes an issue (this is happening in development environments, not production).

DavidSouther avatar Jun 26 '14 22:06 DavidSouther

Option 2 sounds like the thing. You could use "!" in the glob to exclude specific subdirs.

thebuilder avatar Jul 29 '14 07:07 thebuilder

I, too, would like to see the second option. It's rather impractical to use gulp tools such as gulp-watch without this functionality!

nmagerko avatar Aug 18 '14 20:08 nmagerko

:+1: to see this merged.

demisx avatar Aug 31 '14 16:08 demisx

:+1:

artch avatar Oct 06 '14 08:10 artch

@demisx @artch this PR does not contains fix, so merging it will not solve this problem. Just to make it clear.

floatdrop avatar Oct 06 '14 08:10 floatdrop

@floatdrop Sure. This :+1: meant to go for option 2 in @shama's post above.

artch avatar Oct 06 '14 08:10 artch

I agree with @nmagerko - watching for new files should be considered an essential feature...

pyronaur avatar Oct 21 '14 11:10 pyronaur

+1 especially annoying with gulp-watch

psi-4ward avatar Oct 27 '14 13:10 psi-4ward

+1 for option 2. I would expect / to match any files that could ever potentially match that pattern.

YourDeveloperFriend avatar Nov 25 '14 21:11 YourDeveloperFriend

@shama any progress on this? Can I help?

dgieselaar avatar Dec 03 '14 22:12 dgieselaar

Thanks for the offer! All my focus right now is on getting https://github.com/shama/navelgazer integrated as it will make implementing option 2 above much easier and fix a number of other issues.

Testing and reporting issues on navelgazer would be much appreciated.

shama avatar Dec 03 '14 22:12 shama

Since it's been a while since this was last updated, just curious if any progress has been made on handling new files/directories?

brian428 avatar Feb 23 '15 16:02 brian428

@brian428 Feel free to check out the navelgazer branch for progress. I'll be continuing to work on that branch until it's stable.

Although I think @floatdrop and eventually gulp are switching to chokidar. It uses fsevents which watches entire folder trees so it doesn't have this limitation. They've also just recently added file patterns. So definitely worth checking out if this issue is a big problem for you now.

shama avatar Feb 23 '15 16:02 shama