rtomayko / rack-contrib

Moved to http://github.com/rack/rack-contrib/

This URL has Read+Write access

rtomayko (author)
Sat Jan 10 18:03:22 -0800 2009
commit  e24eeb7f8f9c2d348c67d7e2e5378bdf020a2b6a
tree    6d0bfbd9d1955b54c9f045a91f3ecea12b9e585b
parent  af0d3d137bc39f13221bf16130628b007f007cd2
name age message
file .gitignore Mon Dec 08 21:22:46 -0800 2008 Add gemspec for github builds and clean up Rake... [Ryan Tomayko]
file COPYING Sun Nov 30 21:28:09 -0800 2008 boilerplate files; rack/contrib.rb and spec_rac... [Ryan Tomayko]
file DEAD Sat Jan 10 18:04:40 -0800 2009 rtomayko's rack-contrib is DEAD See: http://... [Ryan Tomayko]
file README.rdoc Tue Dec 09 10:38:28 -0800 2008 ContentLength has been merged into rack core '5... [josh]
file Rakefile Mon Dec 08 21:22:57 -0800 2008 Flesh out README a bit; rename to README.rdoc [Ryan Tomayko]
directory lib/ Thu Dec 18 17:07:21 -0800 2008 Add 'times' option to run the profiled app more... [jeremy]
file rack-contrib.gemspec Tue Dec 09 14:30:10 -0800 2008 Remove content length from gemspec [jeremy]
directory test/ Thu Dec 18 17:07:21 -0800 2008 Add 'times' option to run the profiled app more... [jeremy]
README.rdoc

Contributed Rack Middleware and Utilities

This package includes a variety of add-on components for Rack, a Ruby web server interface:

  • Rack::ETag - Automatically sets the ETag header on all String bodies.
  • Rack::JSONP - Adds JSON-P support by stripping out the callback param and padding the response with the appropriate callback format.
  • Rack::LighttpdScriptNameFix - Fixes how lighttpd sets the SCRIPT_NAME and PATH_INFO variables in certain configurations.
  • Rack::Locale - Detects the client locale using the Accept-Language request header and sets a rack.locale variable in the environment.
  • Rack::MailExceptions - Rescues exceptions raised from the app and sends a useful email with the exception, stacktrace, and contents of the environment.
  • Rack::PostBodyContentTypeParser - Adds support for JSON request bodies. The Rack parameter hash is populated by deserializing the JSON data provided in the request body when the Content-Type is application/json.
  • Rack::Profiler - Uses ruby-prof to measure request time.
  • Rack::Sendfile - Enables X-Sendfile support for bodies that can be served from file.
  • Rack::TimeZone - Detects the clients timezone using JavaScript and sets a variable in Rack’s environment with the offset from UTC.

Use

Git is the quickest way to the rack-contrib sources:

  git clone git://github.com/rtomayko/rack-contrib.git

Gems are currently available from GitHub clones:

  gem install rtomayko-rack-contrib --source=http://gems.github.com/

Requiring ‘rack/contrib’ will add autoloads to the Rack modules for all of the components included. The following example shows what a simple rackup (+config.ru+) file might look like:

  require 'rack'
  require 'rack/contrib'

  use Rack::Profiler if ENV['RACK_ENV'] == 'development'

  use Rack::ETag
  use Rack::MailExceptions

  run theapp

Links

rack-contrib on GitHub:<github.com/rtomayko/rack-contrib>
Rack:<rack.rubyforge.org/>
Rack On GitHub:<github.org/chneukirchen/rack>
rack-devel mailing list:<groups.google.com/group/rack-devel>