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

Mountable Engines - Lonestar Ruby 2012

peakpg
August 11, 2012

Mountable Engines - Lonestar Ruby 2012

An indepth look at how to create and design Engines for Rails, to take advantage of the reusable and modular nature of the framework.

peakpg

August 11, 2012
Tweet

More Decks by peakpg

Other Decks in Programming

Transcript

  1. Agenda • Why I care about Engines • What are they? • Building

    one • Learning to configure • Making installation easy • Using the Asset Pipeline • Working with other Engines
  2. Route Helpers <%= main_app.root_url %> # => / <%= another.root_url

    %> # => /another <%= another.page_path(@page) %> # => /another/pages/1
  3. From Gem to Project $ rake another:install:migrations • Copies all files

    from db/migrate into a project • Won’t overwrite • Retimestamps
  4. Write a Readme gem "another" $ bundle install $ rake

    another:install:migrations $ rake db:migrate mount Another::Engine => "/another"
  5. Solving Dependencies • Minimize dependencies • Follow rational versioning policy: o  Rubygems

    ‘recommended’ o  Major.Minor.Build (i.e. 3.5.4) §  Major – Backwards incompatible §  Minor – Backwards compatible, new features §  Build – Backwards compatible, details • Robustness Principle – Be liberal in what you accept o  ~> 2.0 better than ~>2.0.0