Every repository with this icon (
Every repository with this icon (
tree a902d7330fb7db2afe7a5b3120b6563c43a4b896
parent 990088fecabd19afad296d323f534424652e9de2
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
LICENSE | Sat Aug 01 08:14:24 -0700 2009 | |
| |
MIDDLEWARE_LIST | Sun Jun 07 06:04:47 -0700 2009 | |
| |
README.textile | Mon Aug 03 13:44:28 -0700 2009 | |
| |
Rakefile | Sat Jul 25 23:17:50 -0700 2009 | |
| |
TODO | Sat Aug 01 07:50:58 -0700 2009 | |
| |
bin/ | Mon Jul 13 16:44:29 -0700 2009 | |
| |
example/ | Thu Jul 23 15:09:19 -0700 2009 | |
| |
lib/ | ||
| |
pancake.gemspec | ||
| |
spec/ |
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…








