sinatra - Rack::Reloader not picking up changes -
consider config.ru file:
require 'sinatra' use rack::reloader, 0 '/' 'hi' end run sinatra::application i start command line thin start. application runs , shows hi when hit localhost:3000. if change hi hello, save file, , reload page, change not appear: page still says hi.
why rack::reloader not work in case? can change make work?
see here detailed explanation of what's happening. essentialy everytime file changed, rack::reloader re-requires it.
unfortunately sinatra, if redefine route second time (which happens when re-require), sinatra ignores new definition since get '/' end defined!
what need reset defined routes have well:
# inside app.rb require 'sinatra' require 'rack' configure :development sinatra::application.reset! use rack::reloader end '/' 'hi' end note takes few seconds (5s on machine) changes reloaded , recommend take look @ alternatives here
Comments
Post a Comment