1.

How Do I Make My Sinatra App Reload On Changes?

Answer»

FIRST off, in-process code RELOADING in Ruby is hard and having a solution that works for EVERY SCENARIO is technically impossible.

Which is why we recommend you to do out-of-process reloading.

First you need to install rerun if you haven’t already:

$ gem install rerun

Now if you start your Sinatra app LIKE this:

$ ruby app.rb

All you have to do for reloading is instead do this:

$ rerun 'ruby app.rb'

If you are for instance using rackup, instead do the following:

$ rerun 'rackup'

First off, in-process code reloading in Ruby is hard and having a solution that works for every scenario is technically impossible.

Which is why we recommend you to do out-of-process reloading.

First you need to install rerun if you haven’t already:

$ gem install rerun

Now if you start your Sinatra app like this:

$ ruby app.rb

All you have to do for reloading is instead do this:

$ rerun 'ruby app.rb'

If you are for instance using rackup, instead do the following:

$ rerun 'rackup'



Discussion

No Comment Found