Closed professor closed 7 months ago
Very excited for this to land
One note: this doesn't seem to cover the case where an autoload path is added and none of the previously registered package.yml
files is changed.
I just added an initializer to a pack and had to stop spring manually.
One note: this doesn't seem to cover the case where an autoload path is added and none of the previously registered
package.yml
files is changed.I just added an initializer to a pack and had to stop spring manually.
Thanks for the comment!
We want to clarify the expectation. Did you add a new autoload path or a new file in the autoload path?
We noticed that Spring has a limitation on only watching files it knows about when initialized. New files, including ruby files, will not cause Spring to reload.
We noticed that Spring has a limitation on only watching files it knows about when initialized. New files, including ruby files, will not cause Spring to reload.
Mmmh, was that with or without https://github.com/rails/spring-watcher-listen ? Listen
, according to its documentation, can detect added files in watched directories.
Detects file modification, addition and removal.
https://github.com/guard/listen?tab=readme-ov-file#features
And here's the code in spring-watcher-listen
that listens to additions: https://github.com/rails/spring-watcher-listen/blob/996d29e8f9b38fb642dd6b496ed600e941bd7de1/lib/spring/watcher/listen.rb#L62 ... I wonder if that's only for directories outside of Rails.root
? Curious.
Did you add a new autoload path or a new file in the autoload path?
If I remember correctly, I added a pack with new ruby files and didn't modify any existing package.yml files. In general - why would we expect this mechanism to be able to pick up new autoload paths from newly added packages? We only respect package.yml
files that were present at application startup, no?
I wonder if we could listen to additions of package.yml files... but it seems that would require a custom spring watcher, or modifications to spring-watcher-listen
.
The other PR says this was closed because it "started to need more and more gem dependencies". I don't see those in the diff. Can you expand on the problem you encountered?
When a pack moves, we want spring to update the loaded classes so that packwerk prints correct results
Fixes #81