<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>rails-mini/edgy.rb</filename>
    </added>
    <added>
      <filename>rails-mini/funky.rb</filename>
    </added>
    <added>
      <filename>rails-mini/public/javascripts/controls.js</filename>
    </added>
    <added>
      <filename>rails-mini/public/javascripts/dragdrop.js</filename>
    </added>
    <added>
      <filename>rails-mini/public/javascripts/effects.js</filename>
    </added>
    <added>
      <filename>rails-mini/public/javascripts/prototype.js</filename>
    </added>
    <added>
      <filename>rails-mini/rjs.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -38,12 +38,36 @@ ActionController::Base.view_paths = [File.join(File.dirname(__FILE__), &quot;views&quot;)]
 
 # Make Thin Happy
 class LifoAdapter
+  def initialize(options={})
+    @file_server = Rack::File.new(::File.join(&quot;public&quot;))
+  end
+  
+  # TODO refactor this in File#can_serve?(path) ??
+  def file_exist?(path)
+    full_path = ::File.join(@file_server.root, Rack::Utils.unescape(path))
+    ::File.file?(full_path) &amp;&amp; ::File.readable?(full_path)
+  end
+  
+  def serve_file(env)
+    @file_server.call(env)
+  end
+  
   def call(env)
-    rack_response = Rack::Response.new
-    rack_request = Rack::Request.new(env)    
-    cgi = Rack::Adapter::Rails::CGIWrapper.new(rack_request, rack_response)
-    ActionController::Dispatcher.dispatch(cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, rack_response)    
-    rack_response.finish
+    path        = env['PATH_INFO'].chomp('/')
+    cached_path = (path.empty? ? 'index' : path) + ActionController::Base.page_cache_extension
+    
+    if file_exist?(path)              # Serve the file if it's there
+      serve_file(env)
+    elsif file_exist?(cached_path)    # Serve the page cache if it's there
+      env['PATH_INFO'] = cached_path
+      serve_file(env)
+    else
+      rack_response = Rack::Response.new
+      rack_request = Rack::Request.new(env)    
+      cgi = Rack::Adapter::Rails::CGIWrapper.new(rack_request, rack_response)
+      ActionController::Dispatcher.dispatch(cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, rack_response)    
+      rack_response.finish
+    end
   end
 end
 </diff>
      <filename>rails-mini/tinyrails.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>bf9c6663b9ed869f1f2a8fd6842c6f219db9e030</id>
    </parent>
  </parents>
  <author>
    <name>Pratik Naik</name>
    <email>pratiknaik@gmail.com</email>
  </author>
  <url>http://github.com/lifo/fabs/commit/fae67add1d34ef576b68f10c3ed49d7fe8c52be9</url>
  <id>fae67add1d34ef576b68f10c3ed49d7fe8c52be9</id>
  <committed-date>2008-03-30T11:47:01-07:00</committed-date>
  <authored-date>2008-03-30T11:47:01-07:00</authored-date>
  <message>Make it work with /public dir and all that crap</message>
  <tree>60ff04eb946ab258f057e0cbd8317bd73b7273ee</tree>
  <committer>
    <name>Pratik Naik</name>
    <email>pratiknaik@gmail.com</email>
  </committer>
</commit>
