codereading / rack

a modular Ruby webserver interface
http://rack.rubyforge.org/
Other
18 stars 2 forks source link

Automatic Code Reloading for Rack Applications #2

Open stuartellis opened 12 years ago

stuartellis commented 12 years ago

If you are writing a Rack or Sinatra application then it's worth knowing about the code reloaders...

These reload your code on every request (like Rails does in development), so that you can just save and refresh your browser to run the latest version.

Sinatra has a reloader in sinatra-contrib:

https://github.com/sinatra/sinatra-contrib/blob/master/lib/sinatra/reloader.rb

Shotgun works for any Rack application (but isn't compatible with JRuby):

https://github.com/rtomayko/shotgun

bernardoamc commented 12 years ago

Nice to know about this, thanks for sharing!

stuartellis commented 12 years ago

For completeness - Rack also includes a middleware for code reloading:

https://github.com/codereading/rack/blob/rack-1.4/lib/rack/reloader.rb

I quite like Shotgun because it doesn't require you to add anything to your own code.

samnang commented 12 years ago

Thank @stuartellis, good to know Shotgun doesn't work on JRuby.

An interesting article here: http://rkh.im/code-reloading

ericgj commented 12 years ago

thanks @stuartellis, very practical info I just put to good use!

and thanks @samnang for the rkh article which is a great walkthrough of various reloading techniques and pitfalls.