How to get Sinatra to auto-reload the file after each change?

后端 未结 9 469
梦谈多话
梦谈多话 2020-12-07 09:39

I am using

# my_app.rb
load \'index.rb\'

and start the sever like this

ruby my_app.rb

but it never relo

9条回答
  •  猫巷女王i
    2020-12-07 09:59

    gem install sinatra-reloader

    require 'sinatra'
    require 'sinatra/reloader'
    

    Note: it will reload only sinatra handlers (and, maybe some sinatra server configuration commands), but not custom files, which you have to reload manually.

    UPD after 9 years: seems like it is already possible to reload other files using also_reload, dont_reload and after_reload -- https://github.com/sinatra/sinatra/pull/1150

提交回复
热议问题