Rack   a framework to roll your own
Upcoming SlideShare
Loading in...5
×
 

Rack a framework to roll your own

on

  • 351 views

https://github.com/nishantmodak/chotu ...

https://github.com/nishantmodak/chotu

https://github.com/nishantmodak/ruby-talk-au/

( Ruby Conf Australia 2014 )

What is common between Rails, Sinatra and numerous other Ruby frameworks?

They are built on top of Rack or have Rack interfaces for allowing application servers to connect to them.

A deep-dive of sorts on Rack and see what it takes to build a framework, helping us understand these better and ultimately rolling our own.

Almost anyone doing a Ruby app ends up using Rack in one way or the other without ever realising the magic and simplicity that it provides. This session should help decoding that and provide ways on writing your own frameworks.

In involved live coding a framework that is very similar in structure to rails but is bare bones.

Statistics

Views

Total Views
351
Views on SlideShare
343
Embed Views
8

Actions

Likes
0
Downloads
0
Comments
0

2 Embeds 8

http://localhost 7
http://www.slideee.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Rack   a framework to roll your own Rack a framework to roll your own Presentation Transcript

  • RACK a framework to t roll your own Revealing Hour Creations @nishantmodak revealinghour.in
  • Donald Knuth Email is a wonderful thing for people whose role in life is to be on top of things. But not for me; my role is to be on the bottom of things. http://www-cs-faculty.stanford.edu/~knuth/email.html
  • What is Rack? SERVER SERVER APPLICATION / FRAMEWORK
  • What is Rack? 1. Web Server Interface 2. Tool for composing web applications 3. Collection of middleware utilities
  • RACK
  • config.ru $ rackup
  • Middleware HTTP INTERMEDIARIES APP
  • HTTP APPLICATION M I D D L E W A R E
  • DSL use, run, map lib/builder.rb
  • DEMO 1. MyRackApp 2. Middlewares - use / run / map 3. Rack Code
  • Rack::Builder
  • > rake middleware
  • SERVER MIDDLEWARE MIDDLEWARE FRAMEWORK MIDDLEWARE ROUTING MIDDLEWARE APPLICATION APPLICATION
  • Yay! Full Stack Developers!
  • WHY ANOTHER FRAMEWORK ?
  • Yes, We CAN !
  • CRUDingly awful
  • Maybe - fearware - too bloated - too simple - over default ing -
  • Maybe - fearware - too bloated - too simple - over default ing - troll your own framework
  • justrails.rb ➔ Controllers ➔ Routing ➔ Views ➔ Models
  • 1_application
  • 2_Controllers - Conventions - URL Matching - Autoloading
  • Conventions 1. <host>/products/index 2. ProductsController#index 3. products_controller 4. <app>/application/controllers
  • Autoloading - const_get - const_missing - $LOAD_PATH
  • 3_View Interface to several Ruby template engines
  • 3_View Interface to several Ruby template engines
  • 4_Methods as Rack Applications
  • 5_Routing
  • Options? ➔ Middlewares ➔ Action* , Active* ➔ Inheritance
  • References - edgeguides.rubyonrails.org/rails_on_rack.html - rebuilding-rails.com - Sinatra, Rails, Thin
  • Thank You!