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

WTF: Rails App Templates

samant
June 21, 2012

WTF: Rails App Templates

samant

June 21, 2012
Tweet

More Decks by samant

Other Decks in Programming

Transcript

  1. What ? • Ruby files to automatically add gems/css/javascripts/... and

    set up your rails app (environment, DB, git, deploy, data seeds, layouts, views, ...)
  2. Why ? • Easy project set up for new developers

    • Quickly get an app up and running • Get rid of boring and repetitive tasks to get all basics stuff working on new apps • Global productivity increase even if could be time consuming at the beginning
  3. How? • Rails template generators • Rails templates • Git

    • Combination of all these possibilities Rails template generator Rails app template Rails app Git
  4. Rails template generators Write templates using generators Tools • App

    drone (http://drone.bz/new) • Rails apps composer (https://github.com/RailsApps/rails_apps_composer) • Rails wizard (https://github.com/intridea/rails_wizard) • Rails templater (https://github.com/kfaustino/rails-templater) • Thesilverspoon (https://github.com/ptotemy/thesilverspoon) • Appscrolls (http://appscrolls.org/)
  5. Rails template generators Pro's • Modularity, an infinity of combination

    • A lot of basic recipes already available • Still editable by yourself • Need small changes when updating to new version • No need to master the gem to use the recipe Con's • Generator-specific recipes • Recipes still missing • Possibility of incompatibilities between recipes • Recipes needs to be trusted • Could lead to weaknesses in gem and system knowledge for developers • Time consuming if completely handwritten
  6. Rails templates Write templates by yourself Tools • Rails generators

    based on Thor Pro's • Handle the complete process Con's • Monolithic piece of code • Lot of work • Not so easy to maintain on the long run
  7. Rails templates Links • http://m.onkey.org/rails-templates • http://asciicasts.com/episodes/148-app-templates-in-rails-2-3 • http://railscasts.com/episodes/148-app-templates-in-rails-2-3 •

    http://everydayrails.com/2011/02/28/rails-3-application-templates.html • http://guides.rubyonrails.org/generators.html • http://edgeguides.rubyonrails.org/rails_application_templates.html • https://github.com/RailsApps/rails3-application-templates
  8. Git Use git repository containing basic app Tools • Git

    Pro's • Easiest way to get a fully set up rails app • Finest and widest configuration possibilities than other methods Con's • Not modular at all • Lot of work • Not so easy to maintain on the long run
  9. Examples • Generated template (via Drone.bz) • Existing template (http://railsapps.github.com/tutorial-rails-bootstrap-

    devise-cancan.html) • Handwritten template rails new belighted_base_app --builder=http://drone.bz/1047034f-c1aa-4926-b632-eccf1ed977ab.rb rails new rails3-bootstrap-devise-cancan -m https://raw.github.com/RailsApps/rails3-application- templates/master/rails3-bootstrap-devise-cancan-template.rb -T rails new belighted_test -m https://gist.github. com/raw/2958576/a060d3dc6070e730bd03bf921360f113b2409bfe/belighted_template.rb