Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Padrino

 Padrino

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

Avatar for Stoyan Zhekov

Stoyan Zhekov

June 25, 2013
Tweet

More Decks by Stoyan Zhekov

Other Decks in Programming

Transcript

  1. def ca# ( env ) env {} [ status ,

    { headers } , [body] ] Rack = HTTP model
  2. Missing pieces • Generators - Gemfile, config.ru etc. • Helpers

    - link_to(), image_tag() • Mailer • Admin interface - a.l.a Django ͚͍ܽͯΔ෦෼
  3. $ padrino g project myproj -s jquery -c sass -e

    erb -d activerecord -a sqlite
  4. $ padrino g project myproj -s jquery -c sass -e

    erb -d activerecord -a sqlite -t rspec -m mocha
  5. 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 (ෆՄ஌࿦ऀ)
  6. Many generators • Project generator • Controller generator • Model

    generator • Migration generator •Admin generator
  7. Interesting files • Gemfile - bundle install • config/apps.rb -

    Padrino.mount( ... ).to( ... ) • config/boot.rb - logger , locale • app/app.rb - core application install
  8. Helpers • Tags: input_tag :text, :class => ‘demo’ • Assets:

    stylesheet_link_tag ‘layout’ • Format: escape_html( ) , truncate( ) • Links: link_to ... , :confirm => ‘Are you sure?’
  9. 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
  10. Dev Friendly • Reloader - disable :reload to stop it

    • Auto load paths - lib/* • $ padrino gen | start | stop | console | rake