Browse files

Integrate Rack::Static

darcs-hash:20070311140658-4fc50-bc01fedf758eef91af2bc8a88fd90495c21713de.gz
  • Loading branch information...
1 parent bfae003 commit e276c2d9f53d4b70954761979b8a1d931c3e47b2 @chneukirchen committed Mar 11, 2007
Showing with 7 additions and 6 deletions.
  1. +1 −1 AUTHORS
  2. +2 −0 README
  3. +1 −0 lib/rack.rb
  4. +3 −5 lib/rack/static.rb
View
2 AUTHORS
@@ -1,5 +1,5 @@
* Christian Neukirchen <chneukirchen@gmail.com>
* Rails adapter: Christoffer Sawicki <christoffer.sawicki@gmail.com>
* HTTP authentication: Tim Fletcher <twoggle@gmail.com>
-* Cookie sessions: Luc Heinrich <luc@honk-honk.com>
+* Cookie sessions, Static handler: Luc Heinrich <luc@honk-honk.com>
* Official Logo: Armin Ronacher
View
2 README
@@ -101,8 +101,10 @@ at my site:
* XXX: Second public release 0.2.
* Bug fixes in the Camping handler.
+ * Improved Rack::Response.
* HTTP Basic authentication.
* Cookie Sessions.
+ * Static file handler.
== Contact
View
1 lib/rack.rb
@@ -29,6 +29,7 @@ def self.version
autoload :Recursive, "rack/recursive"
autoload :Reloader, "rack/reloader"
autoload :ShowExceptions, "rack/showexceptions"
+ autoload :Static, "rack/static"
autoload :URLMap, "rack/urlmap"
autoload :Utils, "rack/utils"
View
8 lib/rack/static.rb
@@ -2,7 +2,7 @@ module Rack
# The Rack::Static middleware intercepts requests for static files
# (javascript files, images, stylesheets, etc) based on the url prefixes
- # passed in the options, and serve them using a Rack::File object. This
+ # passed in the options, and serves them using a Rack::File object. This
# allows a Rack stack to serve both static and dynamic content.
#
# Examples:
@@ -16,10 +16,9 @@ module Rack
class Static
- def initialize(app, options={})
+ def initialize(app, options={})
@app = app
- @urls = options[:urls] || Array.new
- @urls << "/favicon.ico"
+ @urls = options[:urls] || ["/favicon.ico"]
root = options[:root] || Dir.pwd
@file_server = Rack::File.new(root)
end
@@ -36,5 +35,4 @@ def call(env)
end
end
-
end

0 comments on commit e276c2d

Please sign in to comment.