https://gist.github.com/steakknife/b318a570803b08c1548c7f51c18c0753
Dual-licensed: MIT or DWFTYL
Listen
fires up afsevent_watch
for every directory watched- Puma is a threaded server, restarting it doesn't restart the Ruby process
- The development server + spring uses
Listen
to hot-reload code (models, views, controllers, etc.) - Restarting the server doesn't call
#stop
on theListen
instances - Tons and tons of
fsevent_watch
appear untilfork()
fails
- Call
#stop
on allListen
instances (including yours), to kill off unneededfsevent_watch
- Add all the other files included in this gist as per their names
- Add this to your
config/puma.rb
# config/puma.rb
#...
# FSEvent cleanup -- begin
# let puma find custom, project-included puma plugins
lib = File.expand_path('lib')
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include(lib)
# kill off fsevent_watch in development
plugin :fsevent_cleanup
# FSEvent cleanup -- end
Notes
- Works with MRI
- Won't work with JRuby unless ObjectSpace is enabled
- Might not work on Rubinius
- Don't use
bin/rails s
usebin/bundle exec puma
because Rails + Puma +rails c
is broken (both try to writetmp/pids/server.pid
, rails doesn't like threaded servers restarting themselves)