Reputation: 1414
When I modify the code and have to restart server to see results. Have any way out?
Upvotes: 12
Views: 4443
Reputation: 17416
Better way is to use reloader from sinatra-contrib gem (also from Sinatra FAQ): First install sinatra-contrib gem, then ensure your application .rb file starts with these lines:
require 'sinatra'
require 'sinatra/reloader' if development?
And then any modified config files will be reloaded (no need to restart server!)
Upvotes: 2
Reputation: 2237
If you use Phusion Passenger, you can put this file in the application’s root folder
tmp/always_restart.txt
and it will restart on every request.
http://www.modrails.com/documentation/Users%20guide%20Apache.html ( section 8.7 )
Upvotes: 5
Reputation: 333026
There are a few options, detailed in the Sinatra FAQ. The simplest appears to be to use shotgun
, which you can install and invoke as follows:
$ sudo gem install shotgun
$ shotgun myapp.rb
or if you use define your app by inheriting from Sinatra::Base
and use a config.ru
file:
$ shotgun config.ru -p 4567
Upvotes: 29