<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,6 @@
 == 0.8.0 Dodgy Dentist release
+ * List supported adapters in command usage.
+ * Add file adapter to built-in adapter, serve static files in current directory.
  * Allow disabling signal handling in Server with :signals =&gt; false
  * Make Server.new arguments more flexible, can now specify any of host, port, app or hash options.
  * Add --backend option to specified which backend to use, closes #55</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -1,20 +1,27 @@
 module Rack
   class AdapterNotFound &lt; RuntimeError; end
-  
-  module Adapter
+
+  # Hash used to guess which adapter to use in &lt;tt&gt;Adapter.for&lt;/tt&gt;.
+  # Framework name =&gt; file unique to this framework.
+  # +nil+ for value to never guess.
+  ADAPTERS = {
+    :rails   =&gt; &quot;config/environment.rb&quot;,
+    :ramaze  =&gt; &quot;start.rb&quot;,
+    :merb    =&gt; &quot;config/init.rb&quot;,
+    :halcyon =&gt; 'runner.ru',
+    :file    =&gt; nil
+  }
+    
+  module Adapter    
     # Guess which adapter to use based on the directory structure
     # or file content.
     # Returns a symbol representing the name of the adapter to use
     # to load the application under &lt;tt&gt;dir/&lt;/tt&gt;.
     def self.guess(dir)
-      case
-      when ::File.exist?(&quot;#{dir}/config/environment.rb&quot;) then :rails
-      when ::File.exist?(&quot;#{dir}/start.rb&quot;)              then :ramaze
-      when ::File.exist?(&quot;#{dir}/config/init.rb&quot;)        then :merb
-      when ::File.exist?(&quot;#{dir}/runner.ru&quot;)             then :halcyon
-      else
-        raise AdapterNotFound, &quot;No adapter found for #{dir}&quot;
+      ADAPTERS.each_pair do |adapter, file|
+        return adapter if file &amp;&amp; ::File.exist?(::File.join(dir, file))
       end
+      raise AdapterNotFound, &quot;No adapter found for #{dir}&quot;
     end
     
     # Loads an adapter identified by +name+ using +options+ hash.
@@ -50,6 +57,9 @@ module Rack
         
         return Halcyon::Runner.new
       
+      when :file
+        return Rack::File.new(options[:chdir])
+      
       else
         raise AdapterNotFound, &quot;Adapter not found: #{name}&quot;
         </diff>
      <filename>lib/rack/adapter/loader.rb</filename>
    </modified>
    <modified>
      <diff>@@ -62,17 +62,16 @@ module Thin
         opts.on(&quot;-p&quot;, &quot;--port PORT&quot;, &quot;use PORT (default: #{@options[:port]})&quot;)          { |port| @options[:port] = port.to_i }
         opts.on(&quot;-S&quot;, &quot;--socket FILE&quot;, &quot;bind to unix domain socket&quot;)                    { |file| @options[:socket] = file }
         opts.on(&quot;-y&quot;, &quot;--swiftiply [KEY]&quot;, &quot;Run using swiftiply&quot;)                       { |key| @options[:swiftiply] = key }
-        opts.on(&quot;-A&quot;, &quot;--adapter NAME&quot;, &quot;Rack adapter to use &quot; +                       
-                                        &quot;(default: auto-detected)&quot;)                     { |name| @options[:adapter] = name }
-        opts.on(&quot;-b&quot;, &quot;--backend CLASS&quot;, &quot;Backend to use, full classname&quot;)              { |name| @options[:backend] = name }
-        opts.on(&quot;-c&quot;, &quot;--chdir DIR&quot;, &quot;Change to dir before starting&quot;)                   { |dir| @options[:chdir] = File.expand_path(dir) }
+        opts.on(&quot;-A&quot;, &quot;--adapter NAME&quot;, &quot;Rack adapter to use (default: autodetect)&quot;,
+                                        &quot;(#{Rack::ADAPTERS.keys.join(', ')})&quot;)          { |name| @options[:adapter] = name }
         opts.on(&quot;-r&quot;, &quot;--rackup FILE&quot;, &quot;Load a Rack config file instead of &quot; +
-                                       &quot;Rails adapter&quot;)                                 { |file| @options[:rackup] = file }
+                                       &quot;Rack adapter&quot;)                                  { |file| @options[:rackup] = file }
+        opts.on(&quot;-c&quot;, &quot;--chdir DIR&quot;, &quot;Change to dir before starting&quot;)                   { |dir| @options[:chdir] = File.expand_path(dir) }
         opts.on(      &quot;--stats PATH&quot;, &quot;Mount the Stats adapter under PATH&quot;)             { |path| @options[:stats] = path }
         
         opts.separator &quot;&quot;
-        opts.separator &quot;Rails options:&quot;
-        opts.on(&quot;-e&quot;, &quot;--environment ENV&quot;, &quot;Rails environment &quot; +                       
+        opts.separator &quot;Adapter options:&quot;
+        opts.on(&quot;-e&quot;, &quot;--environment ENV&quot;, &quot;Framework environment &quot; +                       
                                            &quot;(default: #{@options[:environment]})&quot;)      { |env| @options[:environment] = env }
         opts.on(      &quot;--prefix PATH&quot;, &quot;Mount the app under PATH (start with /)&quot;)       { |path| @options[:prefix] = path }
         
@@ -100,6 +99,7 @@ module Thin
         opts.separator &quot;&quot;
         opts.separator &quot;Tuning options:&quot;
         
+        opts.on(&quot;-b&quot;, &quot;--backend CLASS&quot;, &quot;Backend to use, full classname&quot;)              { |name| @options[:backend] = name }
         opts.on(&quot;-t&quot;, &quot;--timeout SEC&quot;, &quot;Request or command timeout in sec &quot; +            
                                        &quot;(default: #{@options[:timeout]})&quot;)              { |sec| @options[:timeout] = sec.to_i }
         opts.on(      &quot;--max-conns NUM&quot;, &quot;Maximum number of connections &quot; +</diff>
      <filename>lib/thin/runner.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@ describe Rack::Adapter do
     Rack::Adapter.guess(@rails_path).should == :rails
   end
   
-  it &quot;should raise error when can't guess from dir&quot; do
+  it &quot;should return nil when can't guess from dir&quot; do
     proc { Rack::Adapter.guess('.') }.should raise_error(Rack::AdapterNotFound)
   end
   
@@ -18,6 +18,11 @@ describe Rack::Adapter do
     Rack::Adapter.for(:rails, :chdir =&gt; @rails_path)
   end
   
+  it &quot;should load File adapter&quot; do
+    Rack::File.should_receive(:new)
+    Rack::Adapter.for(:file)
+  end
+  
   it &quot;should raise error when adapter can't be found&quot; do
     proc { Rack::Adapter.for(:fart, {}) }.should raise_error(Rack::AdapterNotFound)
   end</diff>
      <filename>spec/rack/loader_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f3c09c3075e413c48e076a52ea0016a0250a53da</id>
    </parent>
  </parents>
  <author>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </author>
  <url>http://github.com/macournoyer/thin/commit/dc472b681619c0134db30e7d68b2edbfb1a02076</url>
  <id>dc472b681619c0134db30e7d68b2edbfb1a02076</id>
  <committed-date>2008-04-05T11:52:25-07:00</committed-date>
  <authored-date>2008-04-05T11:52:25-07:00</authored-date>
  <message>Refactor Rack loader.
List supported adapters in command usage.
Add file adapter to built-in adapter, serve static files in current directory.</message>
  <tree>9282fe22e4104fb25a5352343ca1817837669c0d</tree>
  <committer>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </committer>
</commit>
