padrino - the godfather of sinatra

Post on 17-May-2015

30.972 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

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

TRANSCRIPT

Padrinothe Godfather of Sinatra

Padrinothe Godfather of Sinatra

?

Why?なぜですか?

Quizクイズ

SASS ?

SASS

CoffeeScript ?

CoffeeScript

sprockets ?

sprocketsRack-based asset packaging

Too complicated

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

Data services(mobile , API)

+DB backend

process by RUBY

HTTP request

HTTP response

Data flow

Rack

def ca# ( env )

env {}

[ status , { headers } , [body] ]

Rack = HTTP model

Rack application

RACK app

Webservers

Frameworks

Rack

Rack tools

Rack tools

Rack tools

config.ru

Rack is GOOD !

• Renee

• Presto

• Hebo

• RESTrack

TOO CROWDED

YARF

YARFYet Another Rack Framework

https://github.com/zh/yarf

Sinatra

Sinatra

Sinatra is REAL !本物です。

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

But...だけど。。。

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あまりにもシンプル悪いです

Padrinogem install padrino

YARFYet Another Rack Framework

Padrino = 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

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 (不可知論者)

Many generators

• Project generator

• Controller generator

• Model generator

• Migration generator

•Admin generator

padrino g admin

MultipleApps

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?回答

top related