Upload
takeshi-yabe
View
264
Download
1
Tags:
Embed Size (px)
DESCRIPTION
RubyHiroba 2013 での発表資料です
Citation preview
Padrino is AgnosticRubyHiroba 2013Takeshi Yabe / @tyabe
account: { twitter: "@tyabe", github: "tyabe" },name: "Takeshi Yabe",organization : [ "Shibuya.rb", "Yokohama.rb", "RubyKajaTeam" ]
About Me?
It’s Me!
Padrino Contributer
What is Padrino?
Web MVC frameworkbuilt on Sinatra
“Structured Sinatra”
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
Padrino App Structure
$ gem install padrino$ padrino g project sample_project
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
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/
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
Philosophy
Simple to useSimple to hackDeveloper freedomCoding should be fun!
Only have a very few layer between We and the Padrino.
Major Feature
AgnosticGeneratorsMounting Multiple AppsAdmin Interface
... and much more
Major Feature
AgnosticGeneratorsMounting Multiple AppsAdmin Interface
... and much more
What does Agnostic mean?
Be not bound by specific thought.
What does Agnostic mean?
Caution! this might lead to misunderstanding.my poor english has limitations... :-c
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
Usage
$ 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
example
Like a Rails(with RSpec)
$ padrino g project example \-d activerecord \-t rspec \-s jquery \-e erb \-c scss
Very Simple Project
$ padrino g project example \-d minirecord \-t minitest \-s rightjs \-e slim \-c compass
Javascript Lover(?)
$ padrino g project example \-d mongoid \-t riot \-s mootools \-e liquid \-c less
Suppin
$ padrino g project example \-e none
You can use all of the innate skills of any and all already mastered modules!
Let's Enjoy Padrino !Thanks
@tyabe
More InfoAdding New Componentshttp://www.padrinorb.com/guides/adding-new-components