No comments? I'm going to merge it then :-) //Magnus Holm
On Thu, Jun 11, 2009 at 23:03, Magnus Holm<[email protected]> wrote: > Hey guys, I had some unfinished stuff in my working directory which I've now > pushed out to the rackification-branch at my fork. Even though I have > push-permissions to why's repo, I still like the idea that we should all > decide which ways Camping should go, and this includes quite a bit of code: > > == Cleanup of blog.rb > http://github.com/judofyr/camping/commit/957c907cc925ab8c58ddff94f4bc6ddd27f7285f > Just making it simpler and not so magically. > > == Removal of tepee.rb and campsh.rb > http://github.com/judofyr/camping/commit/3c87b0a6f028bb315ddb2196a1f09d5ba640b865 > Currently these are not working 100% correctly so until we clean these up, I > think it's a good idea to remove them to avoid confusion. They're still > hidden in Git's history, so it's more like hiding them than removing them. > > == Add Camping.use > http://github.com/judofyr/camping/commit/0d21c240963226bb40038de3fe0f111928889215 > This allows the user to inject middlewares so they become a part of the app: > module App > use Somemiddleware, 123, 456 > # Equals to adding Somemiddleware.new(App, 123, 456) on the "outside". > use Stackable, :yes => "they are" > end > > == Session refactoring > http://github.com/judofyr/camping/commit/332e0a190a6bbf1af7e8d7812ec3f816727efc38 > Okay, this is larger one: > Now that we can inject middleware, we can make Camping::Session simply "use > Rack::Session::Cookie". This means a smaller Camping (lib/camping that is, > not camping.rb) and less code to maintain. I've also added a "secret" method > to change the secret key (the name may be a little too generic though): > module App > include Camping::Session > secret "Hello!" > end > However, in order to use Rack::Session::Cookie I had to change some internal > stuff. First of all, @env is now the Hash passed into #call (earlier this > was a Camping::h...@env]). This is because all the rack.session stuff require > changing the originial @env in order to save sessions...@state is also now > set in Base#initialize and is always based on rack.session. This means that > any middleware who sets env['rack.session'] to some Hash will make Camping > pick it up and put it in @state. In Base#to_a (which is used to finialize > stuff) there's a simple "@env['rack.session'] = @state" to save the > sessions. > I've also removed Camping::ARSession, since I didn't feel like rewriting it > as a Rack middleware. Please call out if it's missed. > > == Simplify things that Rack gives us for free > http://github.com/judofyr/camping/commit/a7cff36813b899b48fe0d196d2ea54bd7377e6e5 > Rack now parses nested params and we can now safely assume SCRIPT_NAME and > REQUEST_METHOD to be set thanks to the Rack spec. Saves us some bytes. > camping.rb is at 2999 bytes after these patches. > -- > So what do you think? Any obvious things I'm missing? Yeah, I know I've > probably broken some backward compatibility, but remember that 1.9 is after > all a preview release, and 2.0 *is* a major update. > Have a look and don't be afraid to call out the stupid parts :-) > > //Magnus Holm (who now has no excuse for not starting on the docs) > _______________________________________________ Camping-list mailing list [email protected] http://rubyforge.org/mailman/listinfo/camping-list

