Skip to content
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

Sane no longer populating dirRegistry on ready event? #39

Open
DavidSouther opened this issue Jan 9, 2015 · 8 comments
Open

Sane no longer populating dirRegistry on ready event? #39

DavidSouther opened this issue Jan 9, 2015 · 8 comments

Comments

@DavidSouther
Copy link

In 0.5.4, I could walk the watcher.dirRegistry to see what files had already been found when ready fired. Is this no longer the case?

@amasad
Copy link
Owner

amasad commented Jan 9, 2015

It should still be there if you're using the NodeWatcher class. However, it's an internal property and maybe missing if you're using other watching backends (e.g. watchman)

@DavidSouther
Copy link
Author

The property is there in NodeWatcher, but it only has directories, not the actual found files.

@DavidSouther
Copy link
Author

Oh man... I just went through the history and realized how far behind my dependency actually was.

@DavidSouther
Copy link
Author

I'd had to hack together a sane-specific implementation of Gaze's gaze.watched(cb) mechanism.

@DavidSouther
Copy link
Author

My root and globs are

'~/devel/rupert/stassets/test/cascade', [
  '~/devel/rupert/stassets/test/assets/**/*template.{html,jade}',
  '~/devel/rupert/stassets/test/cascade/**/*template.{html,jade}' 
]

@DavidSouther
Copy link
Author

Huh... If I completely remove the glob option, sane behaves as before. Perhaps sane should assume an empty options object?

@amasad
Copy link
Owner

amasad commented Jan 9, 2015

dirRegistery has always been about registries. Sane doesn't keep a record of files watched, because it doesn't watch files and that's part of what makes it performant. The only way to check if the file is watched, is to check if it's directory is in dirRegistery and then check if satisfies the globs. However, if you want this to be a supported feature and not break in the future, let's make it into a watched method.

@DavidSouther
Copy link
Author

However, if you want this to be a supported feature and not break in the future, let's make it into a watched method.

I really do, an I do this at the moment in https://github.com/RupertJS/stassets/blob/master/lib/Watchers/Asset/mirror.coffee#L112-L142

The user story is that there is a glob of files which will immediately be compiled, and will be recompiled any time there is a change. I call it a mirror here, because watching the files isn't actually a useful thing. Having an always up to date list of the current files is the important piece.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants