<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>sample.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,37 +1,53 @@
-# Start w/ thin start -r invisible.rb
-require 'tenjin'
+require &quot;rubygems&quot;
+require &quot;thin&quot;
+require &quot;markaby&quot;
 
-module ::Invisible
-  class Adapter
-    def initialize
-      @template = Tenjin::Engine.new(:postfix=&gt;'.rbhtml', :layout=&gt;'../layout.rbhtml', :path=&gt;'home')
-      @file = Rack::File.new('public')
-    end  
-    def call(env)
-      path = env['PATH_INFO']
-      if path.include?('.')
-        @file.call(env)
-      else
-        _, controller, action = env['PATH_INFO'].split('/')
-        Invisible.const_get(&quot;#{(controller || 'home').capitalize}Controller&quot;).new(@template, env).call(action || 'index')
-      end
-    end
+class Invisible
+  def initialize(&amp;block)
+    @actions = []
+    @layouts = {}
+    instance_eval(&amp;block)
+  end
+  
+  def process(method, route, &amp;block)
+    @actions &lt;&lt; [method.to_s, route, block]
+  end
+  def get(route, &amp;b);  process(&quot;get&quot;,  route, &amp;b) end
+  def post(route, &amp;b); process(&quot;post&quot;, route, &amp;b) end
+  
+  def render(status=200, options_and_headers={}, &amp;block)
+    layout  = @layouts[options_and_headers.delete(:layout) || :default]
+    content = Markaby::Builder.new.capture(&amp;block)
+    content = Markaby::Builder.new({ :content =&gt; content }, nil, &amp;layout).to_s
+    [status, options_and_headers, content]
   end
-  class Controller
-    def initialize(template, env)
-      @template, @status, @env, @headers = template, 200, env, {'Content-Type' =&gt; 'text/html'}
+  
+  def layout(name=:default, &amp;block)
+    @layouts[name] = block
+  end
+  
+  def call(env)
+    params = nil
+    action = @actions.detect { |method, route, _| env[&quot;REQUEST_METHOD&quot;].downcase == method &amp;&amp; params = env[&quot;PATH_INFO&quot;].match(route) }
+    
+    if action
+      action.last.call(*params[1..-1])
+    else
+      [404, {}, &quot;Not found&quot;]
     end
-    def call(action)
-      send(action)
-      render(action) unless @body
-      [@status, @headers.merge('Content-Length'=&gt;@body.size.to_s), [@body]]
+  end
+  
+  def run(*args)
+    app = self
+    Thin::Server.start(*args) do
+      use Rack::ShowExceptions
+      use Rack::CommonLogger
+      run app
     end
-    protected
-      def render(action=nil)
-        @body = @template.render(action.to_sym, instance_variables.inject({}) {|h,v| h[v[1..-1]] = instance_variable_get(v); h})
-      end
+  end
+  
+  def self.run(*args, &amp;block)
+    new(&amp;block).run(*args)
   end
 end
 
-require 'app/controllers'
-run Invisible::Adapter.new
\ No newline at end of file</diff>
      <filename>invisible.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>app/controllers.rb</filename>
    </removed>
    <removed>
      <filename>home/index.rbhtml</filename>
    </removed>
    <removed>
      <filename>layout.rbhtml</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>b038e8526a54cd0cbc66aa8968429c76479a17b2</id>
    </parent>
  </parents>
  <author>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </author>
  <url>http://github.com/macournoyer/invisible/commit/4a00c623562bceaa74b78f24bb9af9bde97311e2</url>
  <id>4a00c623562bceaa74b78f24bb9af9bde97311e2</id>
  <committed-date>2008-07-19T20:57:12-07:00</committed-date>
  <authored-date>2008-07-19T20:57:12-07:00</authored-date>
  <message>Full rewrite to be more like Sinatra</message>
  <tree>083262d744878fd811b2e228a6ecfdc9ea349675</tree>
  <committer>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </committer>
</commit>
