You are on page 1of 68

Padrino

Presentation by Uchio Kondo (@udzura)


2011/10/21(Fri)
Preferred Infrastructure Inc.

(@udzura)

Rubyist()

Groovy

Haskell

: Rack, Sinatra, Padrino


Rails3, TDD, Linux,

works

http://blog.udzura.jp/

Padrino

Padrino framework contributor

Padrino framework JP

RubyGems: rack-session-dbm

RubyGems: rspec-padrino

http://udzura.jp

: Sinatra

: What's going on Padrino?

: Extending Sinatra in deep


~Sinatra Ecosystem~

Extra Session: Blog Tutorial

Sinatra

Padrino

Sinatra

0.0.1 on 2007-09(only on repo)

0.1.0 on 2007-10

http://rubygems.org/gems/sinatra/versions

https://github.com/sinatra/sinatra/blob/0.0.1/lib/sinatra
/dsl.rb

Dancer, Mojolitious::Lite

Juno

loli

Scalatra, Graffiti

1.0 was released

2010-05

1.0

Sinatra::Base

Sinatra

gihyo.jp

41Sinatra 1.0

42Sinatra

http://gihyo.jp/dev/serial/01/ruby/0041

@tsuyoshikawa

sinatra_more gem

2009

sinatra_more moved to Padrino

Padrino 2009-11
2010-02sinatra_moreREADMEPadrino

https://github.com/nesquena/sinatra_more/commit/2ee59c6c709a90c7723a86d62c0542114bd02b09#README.rdoc

sinatra_more Padrino team

Sinatra

1.0 2010-03

1.1.0 2010-10

1.2.0 2011-03

1.2.6 2011-05

1.3.0/1.2.7 2011-10(new!)

310

Padrino

0.9.0 2010-02

0.9sub gem

0.10.0 2011-07

0.10.3 Sinatra 1.3

0.10.4 0.10.5
(...)

Sinatra/Padrino[PR]

Sinatra 1.3.0 & Padrino 0.10.3

(1): http://l.udr.me/oPFtQI

(2): http://l.udr.me/ruLxHN

(Sinatra)Stream API, (Padrino)JRuby/Rubinius


Sinatrasta

big_band, renee Sinatra

udzura
[PR]

Padrino

: http://jp.padrinorb.com

: http://www.padrinorb.com

Guide

Sinatra

Sinatra

Viewmodel
spec_helper.rbGemfilebundler

Padrino

SinatraSinatra

The goal for this framework is to match the essence of Sinatra and make it
suitable for increasingly complex applications that require the use of forms,
mail delivery, localization, helpers, caching, etc
For our team, coding is an art form and Sinatra best enables this concept
because of these core principles:
* Clean
* Compact
* Fast
* Creative
* Concise
The Padrino framework is the perfect solution for your small projects as
well as for your larger project requirements!

Sinatra

2API

use

register

Agnostic

Modularity

Light-weight

Agnostic

ORM

Adapter

Template Engine

Testing Framework/Mocking

JavaScript/CSS Framework

Modularity

Padrino
Sinatra

register/use Sinatra way

Lightweight

PadrinoSinatra

* http://www.padrinorb.com/blog/padrino-0-10-0-routingupgrades-rbx-and-jruby-support-and-minor-breaking-changes

Padrino

Rails
ActionController
Mongoid

ActiveRecord

Erubis

mocha

RSpec

ERB
Haml

RspecRails

Sinatra

Sinatra Family

Rails
ActionController
Mongoid

ActiveRecord

Erubis

mocha

RSpec

ERB
Haml

RspecRails

Sinatra

Padrino

Sinatra

RailsMVC

Helper

RailsMVC

Rails ActionController + routes.rb

Sinatra Sinatra DSL

Padrino Sinatra DSL

Padrino::Rouiting

Helper

Rails

content_for

form_for

stylesheet_link_tag

Format Helpers

Padrino::Helpers

Mailer

DSL

deliver

Mail gem

Padrino::Mailer

Cache

Page cache/Fragment cache

Padrino::Cache

Padrino::Logger::Rack

0.10.5

F5

Scaffold

ModelScaffoldCRUD

Model

Django

padrino

padrino rake test

TDD
machinistcapybara

TokyuRubyKaigi 04

10/29

http://regional.rubykaigi.org/tokyu04

Sinatra
Sinatra
PadrinoRails

PadrinoOK

Padrino

Extending Sinatra
as a super-simple Rack-based framework

The Sinatra Ecosystem

SinatraAPI

use

Rack Middleware

register

Sinatra::Base

helpers, set, use,

use

Rack config DSL

config.ru

Rack

App#call(env)

[status_code, {Header => foo}, [bodies]]

Class/Module

Rack Middleware

Initialize app

Rack

Super Simple Rack Middleware

Rack Middleware

OmniAuth

Warden

Rack::Rewrite

Rack::Protection
(1.3 Sinatra)

Rack::Recaptcha

Jpmobile::Rack::* ()

Rack gem
/

register

register Module`self.registered`

app.class_eval

send :include, send :extend,

Padrino::RoutingSinatra
get/post/put/delete

Sinatra::Base.route

!!!!!!

RackRack

Rails

helper
register

Sinatra

Sinatra

use/register

post-Rails

: Rails
: Sinatra/RackModular

cf.

cho45

Sinatra

: rack-protection
:
sinatra/base.rb1,646(...)

:
API

Sinatra

Yet Another Extending

plugin
The Plugin Generator allows you to create Padrino projects based on a template file that
contains all the necessary actions needed to create the project. Plugins can also be
executed within an existing Padrino application. The plugin generator provides a simple
DSL in addition with leveraging Thor to make generating projects a breeze!

Generator DSL
padrino-recipe

https://github.com/padrino/padrino-recipes/tree/master/plugins
Pull request welcome!

Rack/Sinatra/Padrino

Rack
Sinatra

rack-contrib

https://github.com/rack/rack-contrib

sinatra-contrib

https://github.com/sinatra/sinatra-contrib

padrino-contrib

https://github.com/padrino/padrino-contrib

gem

PadrinoSinatra

PadrinoSinatra

PadrinoSinatra

Sinatra

Rails

@rails

Sinatra is a fun!

Padrino helps you a lot!

Padrino

__END__

misc

https://gist.github.com/1302918

http://www.slideshare.net/udzura/startpadrino