SlideShare a Scribd company logo
Padrino
the Godfather of Sinatra
Padrino
the Godfather of Sinatra


          ?
Padrino - the Godfather of Sinatra
Padrino - the Godfather of Sinatra
Padrino - the Godfather of Sinatra
Why?
Quiz
SASS ?
SASS
Syntactically Awesome Stylesheets
SASS
CoffeeScript ?
CoffeeScript
sprockets ?
sprockets
Rack-based asset packaging
Too complicated
Simple is GOOD
Data
services
 (mobile , API)
       +
  DB backend
Data flow

 HTTP request

process by RUBY
  HTTP response
Rack
Rack = HTTP model

           env {}

    def ca# ( env )
[ status , { headers } , [body] ]
Rack application
Rack

Webservers

RACK app
Frameworks
Rack tools
Rack tools
Rack tools
config.ru
Rack is GOOD !
• Renee
• Presto
• Hebo
• RESTrack
TOO CROWDED
YARF
YARF
Yet Another Rack Framework
https://github.com/zh/yarf
Sinatra
Padrino - the Godfather of Sinatra
Sinatra
Sinatra is REAL !


http://www.sinatrarb.com/wild.html
But...
Padrino - the Godfather of Sinatra
my own
link_to :confirm
Missing pieces

• Generators - Gemfile, config.ru etc.
• Helpers - link_to(), image_tag()
• Mailer
• Admin interface - a.l.a Django
Too simple is BAD
Padrino
gem install padrino
YARF
Yet Another Rack Framework
Padrino = Sinatra++
Padrino - the Godfather of Sinatra
Container (   )
Modular (   )
$ padrino ...
Generators
$ padrino g project myproj
$ padrino g project myproj
 -s jquery -c sass -e erb
$ padrino g project myproj
 -s jquery -c sass -e erb
 -d activerecord -a sqlite
$ padrino g project myproj
 -s jquery -c sass -e erb
 -d activerecord -a sqlite
 -t rspec -m mocha
Agnostic (           )
Component    Default    Alias       Options
                                activerecord
  ORM         none       -d
                                 , mongoid

 Renderer     haml       -e         erb,slim

                                   jquery,
  Script      none       -s
                                 prototype
                                 sass , less ,
  Style       none       -c
                                  compass

   Test       none       -t     rspec, bacon
Many generators

• Project generator
• Controller generator
• Model generator
• Migration generator
• Admin generator
padrino g admin
Multiple
  Apps
by design
Interesting files


• Gemfile - bundle install
• config/apps.rb - Padrino.mount( ... ).to( ... )
• config/boot.rb - logger , locale
• app/app.rb - core application install
Helpers


• Tags:   input_tag :text, :class => ‘demo’

• Assets: stylesheet_link_tag ‘layout’
• Format: escape_html( ) , truncate( )
• Links: link_to ... , :confirm => ‘Are you sure?’
Mailer

• Configure: app/app.rb
• Generate: $ pd g mailer Sample register
• [views]/mailers/sample/register.plain.erb
• Deliver: deliver(:sample, :register, “foo@bar”)
• Tests: set :delivery_method, :test
Simple mailer (   )
Multipart

Attachments
Dev Friendly


• Reloader - disable :reload to stop it
• Auto load paths - lib/*
• $ padrino gen | start | stop | console | rake
Friendly



•             - http://jp.padrino.com/

• @udzura ( Uchio Kondo )
Padrino inside Sinatra
Helpers




Routing
Mailer in Sinatra
I18n
Padrino is GOOD !
Questions?

More Related Content

Padrino - the Godfather of Sinatra