23
Padrino is Agnostic RubyHiroba 2013 Takeshi Yabe / @tyabe

Padrino is agnostic

Embed Size (px)

DESCRIPTION

RubyHiroba 2013 での発表資料です

Citation preview

Page 1: Padrino is agnostic

Padrino is AgnosticRubyHiroba 2013Takeshi Yabe / @tyabe

Page 2: Padrino is agnostic

account: { twitter: "@tyabe", github: "tyabe" },name: "Takeshi Yabe",organization : [ "Shibuya.rb", "Yokohama.rb", "RubyKajaTeam" ]

About Me?

Page 3: Padrino is agnostic

It’s Me!

Padrino Contributer

Page 4: Padrino is agnostic

What is Padrino?

Web MVC frameworkbuilt on Sinatra

“Structured Sinatra”

Page 5: Padrino is agnostic

require 'sinatra/base' class App < Sinatra::Base get '/' do 'Hello world!' endend App.run! host: 'localhost', port: 3000

$ gem install sinatra$ vim app.rb

$ ruby app.rb$ curl http://localhost:3000/

Example Sinatra App

Page 6: Padrino is agnostic

Padrino App Structure

$ gem install padrino$ padrino g project sample_project

Page 7: Padrino is agnostic

Padrino App Structuresample_project!"" Gemfile!"" Rakefile!"" app#   !"" app.rb#   !"" controllers#   !"" helpers#   $"" views#   $"" layouts!"" config#   !"" apps.rb#   !"" boot.rb#   $"" database.rb!"" config.ru!"" public#   !"" favicon.ico#   !"" images#   !"" javascripts#   $"" stylesheets$"" tmp

Page 8: Padrino is agnostic

Example Padrino Appmodule SampleProject class App < Padrino::Application register Padrino::Rendering register Padrino::Helpers enable :sessions  get '/' do 'Hello world!' end endend

$ vim app/app.rb

$ padrino s$ curl http://localhost:3000/

Page 9: Padrino is agnostic

class App < Sinatra::Base get '/' do 'Hello world!' endend

Sinatra

Comparison App File

Padrino

module SampleProject class App < Padrino::Application register Padrino::Rendering register Padrino::Helpers enable :sessions  get '/' do 'Hello world!' end endend

Page 10: Padrino is agnostic

Philosophy

Simple to useSimple to hackDeveloper freedomCoding should be fun!

Only have a very few layer between We and the Padrino.

Page 11: Padrino is agnostic

Major Feature

AgnosticGeneratorsMounting Multiple AppsAdmin Interface

... and much more

Page 12: Padrino is agnostic

Major Feature

AgnosticGeneratorsMounting Multiple AppsAdmin Interface

... and much more

Page 13: Padrino is agnostic

What does Agnostic mean?

Page 14: Padrino is agnostic

Be not bound by specific thought.

What does Agnostic mean?

Caution! this might lead to misunderstanding.my poor english has limitations... :-c

Page 15: Padrino is agnostic

AgnosticDatabaseWrapper- ActiveRecord- MiniRecord- DataMapper- Sequel- MongoMapper- Mongoid- Mongomatic- Ohm- Coachrest- Ripple

Renderer- Haml- Erb- Liquid- Slim

Javascripts- JQuery- Prototype- Rightjs- MooTools- ExtCore- Dojo

Stylesheets- Less- Sass- Compass- Scss

And tests, mocks

Page 16: Padrino is agnostic

Usage

Page 17: Padrino is agnostic

$ padrino g project [name] [options]

Options: -d, [--orm=ORM] # Default: none -t, [--test=TEST] # Default: none -m, [--mock=MOCK] # Default: none -s, [--script=SCRIPT] # Default: none -e, [--renderer=RENDERER] # Default: slim -c, [--stylesheet=STYLESHEET] # Default: none

Specify the options in the project generator

Page 18: Padrino is agnostic

example

Page 19: Padrino is agnostic

Like a Rails(with RSpec)

$ padrino g project example \-d activerecord \-t rspec \-s jquery \-e erb \-c scss

Page 20: Padrino is agnostic

Very Simple Project

$ padrino g project example \-d minirecord \-t minitest \-s rightjs \-e slim \-c compass

Page 21: Padrino is agnostic

Javascript Lover(?)

$ padrino g project example \-d mongoid \-t riot \-s mootools \-e liquid \-c less

Page 22: Padrino is agnostic

Suppin

$ padrino g project example \-e none

You can use all of the innate skills of any and all already mastered modules!

Page 23: Padrino is agnostic

Let's Enjoy Padrino !Thanks

@tyabe

More InfoAdding New Componentshttp://www.padrinorb.com/guides/adding-new-components