Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby
tag: v0.1.10

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
example
lib
spec
.gitignore
LICENSE
MIDDLEWARE_LIST
README.textile
Rakefile
TODO
VERSION
pancake.gemspec

README.textile

This read me is getting thrown to get there in little bits of time snatched between other bits of snatched time… it will be magnificient, eventually… please bare with it…

Whats this then

A tool for making pancake stacks. Where, as you know, pancake == ruby web thing.

It essentially takes the awesome rack and rack router and mixes it with flour and water and eggs to bind it together into a pancake thin layer of goodness providing a structured way of orgnaising (stacking) your assortment of ruby web things. In doing so, it allows you to provide each of your ruby web things (lets call them “middlewares”) with some underlying contextual functionality.

Why stack pancakes?

Well, simply put, reuse! I’m building something… and what do you know i need another forum/asset manager/bla thing etc. Typically I can:

  • Write/include the functionality directly in to my current app.
  • Add a second app, theme it up similarly and use apache/nginx/other configs to glue it up, and perhaps come up with a devious approach for auth with some cunning SSO… or not

What we’d like to facilitate with pancake is you take your existing much loved forum/asset manager/bla thing etc and mount it into pancake, sharing auth and other contextual information between apps.

Insert helpful diagram here…

Getting Started

You’ll need to have installed (as well as your usual ruby stuffs)…

  • wycats-thor
  • Carllerches rack router

Installing

  $sudo gem install hassox-pancake

Create your own stack

  $pancake-gen stack yummy-app

Does it work?

(I’ve used curl here, feel free to use your point your browser to http://localhost:9292/ instead)


$cd yummy-app/lib/yummy-app
$rackup config.ru
Loading Development Environment

Now in your browser, visit http://localhost:9292/
Or, with curl like here:


$curl -I localhost:9292
127.0.0.1 – - [26/Jul/2009 15:42:55] “HEAD / HTTP/1.1” 404 9 0.0011
HTTP/1.1 404 Not Found
Connection: close
Date: Sun, 26 Jul 2009 05:42:55 GMT
Content-Type: text/plain
Content-Length: 9

You should see ‘NOT FOUND’ in your browser window and something like this appear in your rackup console window.

  127.0.0.1 - - [26/Jul/2009 15:42:55] "GET / HTTP/1.1" 404 9 0.0011

That 404 is good news! The stack is running.. we just haven’t cooked any pancakes yet, theres nothing to find. Next step add something…

Routing

Edit config/router.rb with:


home = lambda {|e| [200,{"Content-Type" => “text/plain”, “Content-Length” => "12"}, “Welcome home” ]}

YummyApp.add_routes do |r| r.map “/”, :to => home end


Now, restart the server (^C) and try again:

$rackup config.ru
Loading Development Environment

Reload you page and you should see “Welcome home”.
And, in your console window, rack should log the request like so:

127.0.0.1 – - [26/Jul/2009 16:16:23] “GET / HTTP/1.1” 200 12 0.0012
127.0.0.1 – - [26/Jul/2009 16:16:23] “GET /favicon.ico HTTP/1.1” 200 12 0.0012

Whats next:

Well we don’t want to be writing our apps as lambdas jemmied into the router, instead next we start to build stacks, out of other middlewares… merbs, other pancake stacks, some sinatra, more rack ups or what ever.

To be continued…

Something went wrong with that request. Please try again.