Impressive work.<br><br><div class="gmail_quote">On Wed, May 21, 2008 at 12:26 PM, Magnus Holm <<a href="mailto:judofyr@gmail.com">judofyr@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
===<br>
1. Camping on Rack<br>
===<br>
<br>
I've just finished rewriting Camping to use Rack in the "core". I got rid of<br>
(a little less) than 1kB in camping.rb and removed lots of un-necessary files<br>
(lib/server/*.rb, fastcgi.rb & mongrel.rb).<br>
<br>
bin/camping does now only provide WEBrick, Mongrel and console-support and<br>
should only be used in development. It uses Rack::ShowExceptions to catch<br>
error outside the app and I've also written a middleware for faking<br>
X-Sendfile. For production you should create a rackup-file or setup Rack in<br>
some other way:<br>
<br>
#!/usr/bin/env rackup<br>
# Auto-detects CGI & FastCGI<br>
# Start mongrel with: ./<a href="http://blog.ru" target="_blank">blog.ru</a> -s mongrel -p 3301<br>
require 'blog'<br>
Blog.create<br>
run Blog<br>
<br>
Some notes:<br>
* Branch: <a href="http://github.com/judofyr/camping/commits/rack" target="_blank">http://github.com/judofyr/camping/commits/rack</a><br>
* You have to rename camping-unabridged.rb to camping.rb in order to run apps.<br>
* You're app is also a Rack-app (aka respond_to?(:call))<br>
* I'm using Rack::Request (@request) and Rack::Response (@response)<br>
* Status, headers and body must be set using @status, @headers and @body,<br>
not @response.status, @response.headers or @response.body<br>
* @headers is a Rack::Utils::HeaderHash<br>
* @root, @input and @cookies behaves equally; @env is gone<br>
* You can delete cookies with @response.delete_cookie("key")<br>
* Set cookies with @cookies.key = ":)" or @response.set_cookie("key", ":)")<br>
* You can also pass a Hash when you're setting cookies:<br>
@cookes.key = {:value => ":)", :expires => Time.now + 3600, :path => '/app'}<br>
* I've removed #qsp, #un and #escape. Use Rack::Utils instead<br>
* This should close #104, #130 and #153<br>
</blockquote><div><br>These API changes sound reasonable to me.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
===<br>
2. ORM-agnostic?<br>
===<br>
<br>
What about making Camping ORM-agnostic? If it's only AR which requires glue,<br>
we can just rename camping/db.rb to camping/ar.rb - if not we have to add<br>
camping/og.rb, camping/dm.rb, camping/sequel.rb etc too.<br>
</blockquote><div><br>Fine w/ me.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
===<br>
3. Cookie Sessions as default<br>
===<br>
<br>
What do you think about using Cookie Sessions instead of database-based by<br>
default (in camping/sessions.rb)? It's much lighter and makes it simpler to<br>
create apps without database. It also helps making Camping ORM-agnostic.<br>
<br>
I've fixed this in the cookie_session-branch (requires Rack) available at<br>
<a href="http://github.com/judofyr/camping/commits/cookie_session" target="_blank">http://github.com/judofyr/camping/commits/cookie_session</a> (highly based on<br>
Jenna's work)<br>
</blockquote><div><br>As long as you organize the code such that it's easy to switch between session storage schemes, I think this is fine. <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
===<br>
4. Renaming camping-unabridged.rb to camping.rb?<br>
===<br>
<br>
I haven't touched camping.rb at all, do we really need to prove that it's a<br>
micro-framework? It just makes development/releasing harder. Let's just forget<br>
about the abridged version and rename camping-unabridged.rb to camping.rb!<br>
</blockquote><div><br>Perlvert that I am, I respected the 4KB obfuscation. (Maybe that's just me. ;-)<br> </div><br></div>