Padrino is Agnostic
RubyHiroba 2013
Takeshi 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 framework
built on Sinatra
“Structured Sinatra”
require 'sinatra/base'
 
class App < Sinatra::Base
get '/' do
'Hello world!'
end
end
 
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 Structure
sample_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 App
module SampleProject
class App < Padrino::Application
register Padrino::Rendering
register Padrino::Helpers
enable :sessions
 
get '/' do
'Hello world!'
end
end
end
$ vim app/app.rb
$ padrino s
$ curl http://localhost:3000/
class App < Sinatra::Base
get '/' do
'Hello world!'
end
end
Sinatra
Comparison App File
Padrino
module SampleProject
class App < Padrino::Application
register Padrino::Rendering
register Padrino::Helpers
enable :sessions
 
get '/' do
'Hello world!'
end
end
end
Philosophy
Simple to use
Simple to hack
Developer freedom
Coding should be fun!
Only have a very few layer
between We and the Padrino.
Major Feature
Agnostic
Generators
Mounting Multiple Apps
Admin Interface
... and much more
Major Feature
Agnostic
Generators
Mounting Multiple Apps
Admin 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
Agnostic
DatabaseWrapper
- 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 Info
Adding New Components
http://www.padrinorb.com/guides/adding-new-components

Padrino is agnostic

  • 1.
    Padrino is Agnostic RubyHiroba2013 Takeshi Yabe / @tyabe
  • 2.
    account: { twitter: "@tyabe", github:"tyabe" }, name: "Takeshi Yabe", organization : [ "Shibuya.rb", "Yokohama.rb", "RubyKajaTeam" ] About Me?
  • 3.
  • 4.
    What is Padrino? WebMVC framework built on Sinatra “Structured Sinatra”
  • 5.
    require 'sinatra/base'   class App< Sinatra::Base get '/' do 'Hello world!' end end   App.run! host: 'localhost', port: 3000 $ gem install sinatra $ vim app.rb $ ruby app.rb $ curl http://localhost:3000/ Example Sinatra App
  • 6.
    Padrino App Structure $gem install padrino $ padrino g project sample_project
  • 7.
    Padrino App Structure sample_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
  • 8.
    Example Padrino App moduleSampleProject class App < Padrino::Application register Padrino::Rendering register Padrino::Helpers enable :sessions   get '/' do 'Hello world!' end end end $ vim app/app.rb $ padrino s $ curl http://localhost:3000/
  • 9.
    class App <Sinatra::Base get '/' do 'Hello world!' end end Sinatra Comparison App File Padrino module SampleProject class App < Padrino::Application register Padrino::Rendering register Padrino::Helpers enable :sessions   get '/' do 'Hello world!' end end end
  • 10.
    Philosophy Simple to use Simpleto hack Developer freedom Coding should be fun! Only have a very few layer between We and the Padrino.
  • 11.
    Major Feature Agnostic Generators Mounting MultipleApps Admin Interface ... and much more
  • 12.
    Major Feature Agnostic Generators Mounting MultipleApps Admin Interface ... and much more
  • 13.
  • 14.
    Be not boundby specific thought. What does Agnostic mean? Caution! this might lead to misunderstanding. my poor english has limitations... :-c
  • 15.
    Agnostic DatabaseWrapper - 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
  • 16.
  • 17.
    $ padrino gproject [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
  • 18.
  • 19.
    Like a Rails(withRSpec) $ padrino g project example -d activerecord -t rspec -s jquery -e erb -c scss
  • 20.
    Very Simple Project $padrino g project example -d minirecord -t minitest -s rightjs -e slim -c compass
  • 21.
    Javascript Lover(?) $ padrinog project example -d mongoid -t riot -s mootools -e liquid -c less
  • 22.
    Suppin $ padrino gproject example -e none You can use all of the innate skills of any and all already mastered modules!
  • 23.
    Let's Enjoy Padrino! Thanks @tyabe More Info Adding New Components http://www.padrinorb.com/guides/adding-new-components