Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (30 sloc) 1.36 KB
This is an automatic reloading version of the rackup command that's shipped with
Rack. It can be used as an alternative to the complex reloading logic provided
by web frameworks or in environments that don't support application reloading.
The shotgun command starts one of Rack's supported servers (e.g., mongrel, thin,
webrick) and listens for requests but does not load any part of the actual
application. Each time a request is received, it forks, loads the application in
the child process, processes the request, and exits the child process. The
result is clean, application-wide reloading of all source files and templates on
each request.
gem install shotgun
Starting a server with a rackup file:
Using Thin and starting on port 6000 instead of 9393 (default):
shotgun --server=thin --port=6000
Running Sinatra apps:
shotgun hello.rb
See 'shotgun --help' for more advanced usage.
The reloading system in Ian Bicking's webware framework served as inspiration
for the approach taken in Shotgun. Ian lays down the pros and cons of this
approach in the following article:
Something went wrong with that request. Please try again.