-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Replace listen
gem with fswatch-rb
#37269
Comments
@fxn @matthewd @rafaelfranca I'll love to get your thoughts on this. |
FWIW, I'm ready to do the work but just wanted to see if the Rails team is open this change. |
I'm torn.
I do... the current list of dependencies in https://guides.rubyonrails.org/getting_started.html#installing-rails is: Ruby, SQLite3. Admittedly, that seems to be missing Webpack... nonetheless, adding an entry to that list seems like a pretty big deal to me. OTOH, I would like to use a stronger library for this feature -- the current implementation has not been without problems. And given the platform weirdnesses inherent in the problem-space, it does seem safer to lean on a library that's not ruby-specific. OTOOH, I have some questions around the licensing of these libraries, given that libfswatch is GPL. Given how narrow our usage of Listen is, perhaps we could support both, using fswatch if it seems to be present in the bundle, and listen otherwise. A different, somewhat dirtier, thought: as we do effectively require NodeJS to be present for development, and NodeJS has a built-in file watching API... 🤷🏻♂️ |
There are other dependencies like libxml2 for nokogiri and selenium for selenium-webdriver. One thing we could do is to bundle fswatch as a native extension which is similar to what
I think it should be OK since Rails will not actually be distributing it unless we pull it in as a native extension?
I thought about making the notifier in |
I would like to ensure |
Resolved by #37896. |
@ioquatix Sorry for creating the issue initially. I couldn't figure out a good solution for the Listen's darwin adapter so I focused on alternatives. It turns out, it was much easier to resolve the problem with the darwin adapter than to introduce a new dependency within Rails. |
The |
Background story #26158
I recently switched to a macbook pro as my primary development machine and noticed 40+
fsevent_watch
processes running after starting the Rails server for one of my projects. This is primarily due to thelisten
gem spinning up a fsevent_watch process for each directory that it is asked to monitor.While looking into the alternatives, I discovered https://github.com/emcrisostomo/fswatch/ which has cross platform support. Also, there is a Ruby bindings gem available https://github.com/t3hk0d3/fswatch-rb. With
fswatch-rb
, it is quite trivial for us to replace the use of thelisten
gem inActiveSupport
and at the same time resolve the problem of having too many processes run on macOS machines.The only downside here is that
fswatch
becomes a development dependency for all platforms but I don't see that as too big of a problem.The text was updated successfully, but these errors were encountered: