destroytoday.com

Reloading Ruby with Sinatra::Reloader

For a while, I didn’t work on the Ruby side of Cushion dev, so now that I’m back in the weeds (or actually the most pristine part of the codebase), I quickly grew tired of restarting the Ruby service whenever I made a change. A while back, I tried using Shotgun to reload Ruby automatically, but I vaguely remember there being an issue with it. While browsing the Sinatra docs, I came across Sinatra::Reloader, which automatically reloads Sinatra, and because it’s part of the official Sinatra::Contrib collection, it actually works flawlessly. Now, any Ruby change auto-updates the service, so I don’t need to restart it manually every time I make a Ruby change—the way it should be.