70
Padrino the Godfather of Sinatra

Padrino - the Godfather of Sinatra

Embed Size (px)

DESCRIPTION

Padrino is a ruby framework built upon the Sinatra web library.

Citation preview

Page 1: Padrino - the Godfather of Sinatra

Padrinothe Godfather of Sinatra

Page 2: Padrino - the Godfather of Sinatra

Padrinothe Godfather of Sinatra

?

Page 3: Padrino - the Godfather of Sinatra
Page 4: Padrino - the Godfather of Sinatra
Page 5: Padrino - the Godfather of Sinatra
Page 6: Padrino - the Godfather of Sinatra

Why?なぜですか?

Page 7: Padrino - the Godfather of Sinatra

Quizクイズ

Page 8: Padrino - the Godfather of Sinatra

SASS ?

Page 10: Padrino - the Godfather of Sinatra

SASS

Page 11: Padrino - the Godfather of Sinatra

CoffeeScript ?

Page 12: Padrino - the Godfather of Sinatra

CoffeeScript

Page 13: Padrino - the Godfather of Sinatra

sprockets ?

Page 14: Padrino - the Godfather of Sinatra

sprocketsRack-based asset packaging

Page 15: Padrino - the Godfather of Sinatra

Too complicated

Page 16: Padrino - the Godfather of Sinatra

Simple is GOODシンプルが良いです。

Page 17: Padrino - the Godfather of Sinatra

Data services(mobile , API)

+DB backend

Page 18: Padrino - the Godfather of Sinatra

process by RUBY

HTTP request

HTTP response

Data flow

Page 19: Padrino - the Godfather of Sinatra

Rack

Page 20: Padrino - the Godfather of Sinatra

def ca# ( env )

env {}

[ status , { headers } , [body] ]

Rack = HTTP model

Page 21: Padrino - the Godfather of Sinatra

Rack application

Page 22: Padrino - the Godfather of Sinatra

RACK app

Webservers

Frameworks

Rack

Page 23: Padrino - the Godfather of Sinatra

Rack tools

Page 24: Padrino - the Godfather of Sinatra

Rack tools

Page 25: Padrino - the Godfather of Sinatra

Rack tools

Page 26: Padrino - the Godfather of Sinatra

config.ru

Page 27: Padrino - the Godfather of Sinatra

Rack is GOOD !

Page 28: Padrino - the Godfather of Sinatra

• Renee

• Presto

• Hebo

• RESTrack

Page 29: Padrino - the Godfather of Sinatra

TOO CROWDED

Page 30: Padrino - the Godfather of Sinatra

YARF

Page 31: Padrino - the Godfather of Sinatra

YARFYet Another Rack Framework

Page 32: Padrino - the Godfather of Sinatra

https://github.com/zh/yarf

Page 33: Padrino - the Godfather of Sinatra

Sinatra

Page 34: Padrino - the Godfather of Sinatra
Page 35: Padrino - the Godfather of Sinatra

Sinatra

Page 36: Padrino - the Godfather of Sinatra

Sinatra is REAL !本物です。

http://www.sinatrarb.com/wild.html

Page 37: Padrino - the Godfather of Sinatra

But...だけど。。。

Page 38: Padrino - the Godfather of Sinatra
Page 39: Padrino - the Godfather of Sinatra

my own link_to :confirm

Page 40: Padrino - the Godfather of Sinatra

Missing pieces

• Generators - Gemfile, config.ru etc.

• Helpers - link_to(), image_tag()

• Mailer

• Admin interface - a.l.a Django

欠けている部分

Page 41: Padrino - the Godfather of Sinatra

Too simple is BADあまりにもシンプル悪いです

Page 42: Padrino - the Godfather of Sinatra

Padrinogem install padrino

Page 43: Padrino - the Godfather of Sinatra

YARFYet Another Rack Framework

Page 44: Padrino - the Godfather of Sinatra

Padrino = Sinatra++

Page 45: Padrino - the Godfather of Sinatra
Page 46: Padrino - the Godfather of Sinatra

Container (コンテナ)

Page 47: Padrino - the Godfather of Sinatra

Modular (モジュール)

Page 48: Padrino - the Godfather of Sinatra

$ padrino ...

Page 49: Padrino - the Godfather of Sinatra

Generators

Page 50: Padrino - the Godfather of Sinatra

$ padrino g project myproj

Page 51: Padrino - the Godfather of Sinatra

$ padrino g project myproj-s jquery -c sass -e erb

Page 52: Padrino - the Godfather of Sinatra

$ padrino g project myproj-s jquery -c sass -e erb

-d activerecord -a sqlite

Page 53: Padrino - the Godfather of Sinatra

$ padrino g project myproj-s jquery -c sass -e erb

-d activerecord -a sqlite

-t rspec -m mocha

Page 54: Padrino - the Godfather of Sinatra

Component Default Alias Options

ORM none -d activerecord, mongoid

Renderer haml -e erb,slim

Script none -s jquery, prototype

Style none -c sass , less , compass

Test none -t rspec, bacon

Agnostic (不可知論者)

Page 55: Padrino - the Godfather of Sinatra

Many generators

• Project generator

• Controller generator

• Model generator

• Migration generator

•Admin generator

Page 56: Padrino - the Godfather of Sinatra

padrino g admin

Page 57: Padrino - the Godfather of Sinatra

MultipleApps

by design

Page 58: Padrino - the Godfather of Sinatra

Interesting files

• Gemfile - bundle install

• config/apps.rb - Padrino.mount( ... ).to( ... )

• config/boot.rb - logger , locale

• app/app.rb - core application install

Page 59: Padrino - the Godfather of Sinatra

Helpers

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

• Assets: stylesheet_link_tag ‘layout’

• Format: escape_html( ) , truncate( )

• Links: link_to ... , :confirm => ‘Are you sure?’

Page 60: Padrino - the Godfather of Sinatra

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

Page 61: Padrino - the Godfather of Sinatra

Simple mailer (簡単)

Page 62: Padrino - the Godfather of Sinatra

Multipart

Attachments

Page 63: Padrino - the Godfather of Sinatra

Dev Friendly

• Reloader - disable :reload to stop it

• Auto load paths - lib/*

• $ padrino gen | start | stop | console | rake

Page 64: Padrino - the Godfather of Sinatra

日本人 Friendly

• 日本語サイト - http://jp.padrino.com/

• @udzura ( Uchio Kondo )

Page 65: Padrino - the Godfather of Sinatra

Padrino inside Sinatra

Page 66: Padrino - the Godfather of Sinatra

Helpers

Routing

Page 67: Padrino - the Godfather of Sinatra

Mailer in Sinatra

Page 68: Padrino - the Godfather of Sinatra

I18n

Page 69: Padrino - the Godfather of Sinatra

Padrino is GOOD !

Page 70: Padrino - the Godfather of Sinatra

Questions?回答