hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Day Camp at Mongrel National Park #

by why in inspect

Zed and I worked over the weekend on smoothing out the divide between Camping (the 4k web framework) and Mongrel (the slim new Ruby web server mentioned last week.) In just a few days, Mongrel has caught the scent and is totally Campnivorous. Development gems await you.

 gem install mongrel camping --source code.whytheluckystiff.net

The Mongrel gem requires a build environment, there are no OSX or Windows binaries yet. You will find two examples in Mongrel’s examples/camping directory. Tepee is a dead-simple versioning wiki which requires the acts_as_versioned gem.

Here’s the relevant handler which is executed with CampingHandler.new(Tepee), if the app is contained in the module Tepee.

 class CampingHandler < Mongrel::HttpHandler
   def initialize(klass)
     @klass = klass
   end
   def process(request, response)
     body = StringIO.new(request.body)
     controller = @klass.run(body, request.params)
     response.start(controller.status) do |head, out|
       controller.headers.each do |k, v|
         [*v].each do |vi|
           head[k] = vi
         end
       end
       out << controller.body
     end
   end
 end

You can then mount these handlers quite readily. Zed’s moving along with handsome stride, so if you’ve got a machine to build this on, do not delay.

said on 30 Jan 2006 at 17:45

Why does it require a build environment?

This is what RubyInline is for. None of this lameness about unsupported platforms because the author doesn’t have a compiler for it.

said on 30 Jan 2006 at 18:51

drbrain: RubyInline still needs a compiler last time I checked.

said on 30 Jan 2006 at 23:36

Someone please make a Windows version!

said on 30 Jan 2006 at 23:38

Tepee also requires redcloth.

Corollary: Mongrel is damn fast.

said on 30 Jan 2006 at 23:44

Wait, I can build one myself, right?

said on 31 Jan 2006 at 00:02

It wants something to define size_t on Windows. I gave it ctypes.h. I compiled with VC8 , but get a “Ruby tried to do something bad” when trying to run the simple test. sigh

said on 31 Jan 2006 at 03:56

Ruby’s being naaaughty. Why?

said on 31 Jan 2006 at 15:22

“Wait, I can build one myself, right?”

On Mac OSX with devel tools installed, I just ran
sudo gem install mongrel --source 
code.whytheluckystiff.net

and I was up and running.
said on 09 Feb 2006 at 12:19

Excellent. Will build later.

Yeah but Windows please too.

Comments are closed for this entry.