Permalink
Browse files

Remove the Rails adapter, it was never useful

darcs-hash:20070511153111-4fc50-c8f032d1b9084934ddbb8347aba54ef97e59e9bf.gz
  • Loading branch information...
1 parent 7f889ec commit a7d2cb664863a9477abf4c7b87d74a4b8dde03b6 @chneukirchen committed May 11, 2007
Showing with 0 additions and 65 deletions.
  1. +0 −65 lib/rack/adapter/rails.rb
@@ -1,65 +0,0 @@
-unless defined? RAILS_ROOT
- raise "Rails' environment has to be loaded before using Rack::Adapter::Rails"
-end
-
-require "dispatcher"
-
-module Rack
- module Adapter
- # TODO: Extract this
- class Rails < Cascade
- def initialize
- file = Rack::File.new(::File.join(RAILS_ROOT, "public"))
- dispatcher = RailsDispatcher.new
-
- super([file, dispatcher])
- end
- end
-
- class RailsDispatcher
- def call(env)
- response = dispatch(CGIStub.new(env))
- headers = response.headers
- status = headers.delete("Status")
-
- [ status, headers, response.body ]
- end
-
- protected
-
- def dispatch(cgi)
- session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS
-
- request = ActionController::CgiRequest.new(cgi, session_options)
- response = ActionController::CgiResponse.new(cgi)
-
- Dispatcher.send(:prepare_application)
-
- controller = ActionController::Routing::Routes.recognize(request)
- controller.process(request, response)
-
- return response
- end
-
- class RailsDispatcher::CGIStub
- def initialize(env)
- @request = Request.new(env)
- end
-
- def env_table() @request.env end
- def params() @request.params end
- def cookies() @request.cookies end
- def query_string() @request.query_string end
-
- def [](key)
- # FIXME: This is probably just wrong
- @request.env[key] || @request.cookies[key]
- end
-
- def key?(key)
- self[key] ? true : false
- end
- end
- end
- end
-end

0 comments on commit a7d2cb6

Please sign in to comment.