Rails Plugins Eric Pugh Clinton Nixon Andy Gregorowicz OSCON 2007
The Plan <ul><li>Intro </li></ul><ul><li>Plugins </li></ul><ul><li>Gems into Plugins </li></ul><ul><li>Packaging Gems </li...
Why Plugins? <ul><li>Share code between applications in discrete chunks. </li></ul><ul><ul><li>Models </li></ul></ul><ul><...
acts_as_nxt Available at http://acts-as-nxt.rubyforge.org
Managing Plugins <ul><li>Add a new source of plugins </li></ul><ul><ul><li>./script/plugin source http://svn.rubaidh.com/p...
Piston for plugin management <ul><li>Add a new plugin </li></ul><ul><ul><li>piston import  http://svn.rubaidh.com/plugins/...
Things to be aware of! <ul><li>Plugins load alphabetically!  Plugins that depend on Plugins can break..  The “flare” plugi...
Best Practices <ul><li>Watch out for plugin overload! </li></ul><ul><li>Relying on remote repositories can slow SVN down <...
You’ve got Questions?  We’ve got Answers!
Upcoming SlideShare
Loading in …5
×

Rails Plugins 1 Plugin

893 views

Published on

Published in: Technology, Art & Photos
  • Be the first to comment

  • Be the first to like this

Rails Plugins 1 Plugin

  1. 1. Rails Plugins Eric Pugh Clinton Nixon Andy Gregorowicz OSCON 2007
  2. 2. The Plan <ul><li>Intro </li></ul><ul><li>Plugins </li></ul><ul><li>Gems into Plugins </li></ul><ul><li>Packaging Gems </li></ul><ul><li>Future Directions </li></ul><ul><li>Questions </li></ul>
  3. 3. Why Plugins? <ul><li>Share code between applications in discrete chunks. </li></ul><ul><ul><li>Models </li></ul></ul><ul><ul><li>View Helpers </li></ul></ul><ul><ul><li>Controllers </li></ul></ul><ul><ul><li>Rake Tasks </li></ul></ul><ul><ul><li>Public folder content: Images, Stylesheets, Javascript </li></ul></ul>At 37signals we usually use five or six plugins in each app. — David Heinemeier Hansson at Canada on Rails
  4. 4. acts_as_nxt Available at http://acts-as-nxt.rubyforge.org
  5. 5. Managing Plugins <ul><li>Add a new source of plugins </li></ul><ul><ul><li>./script/plugin source http://svn.rubaidh.com/plugins/trunk </li></ul></ul><ul><li>Install from known sources </li></ul><ul><ul><li>./script/plugin install google_analytics </li></ul></ul><ul><li>Install from URL </li></ul><ul><ul><li>./script/plugin install http://svn.rubaidh.com/plugins/trunk/google_analytics </li></ul></ul><ul><li>Install from URL using svn:externals (track updates!) </li></ul><ul><ul><li>./script/plugin install -x http://svn.rubaidh.com/plugins/trunk/google_analytics </li></ul></ul>
  6. 6. Piston for plugin management <ul><li>Add a new plugin </li></ul><ul><ul><li>piston import http://svn.rubaidh.com/plugins/trunk/google_analytics vendor/plugins/google_analytics </li></ul></ul><ul><ul><li>svn commit vendor/plugins </li></ul></ul><ul><li>Check Status of Plugins </li></ul><ul><ul><li>piston status vendor/plugins/google_analytics </li></ul></ul><ul><li>Update plugin on demand </li></ul><ul><ul><li>piston update vendor/plugins/google_analytics </li></ul></ul><ul><li>Lock the plugin to a revision </li></ul><ul><ul><li>piston lock vendor/plugins/google_analytics </li></ul></ul>
  7. 7. Things to be aware of! <ul><li>Plugins load alphabetically! Plugins that depend on Plugins can break.. The “flare” plugin depends on “solr-ruby” so you need to override the load order </li></ul><ul><ul><li>config.plugins = ['solr-ruby-rails-0.0.3', 'flare', 'rspec', 'rspec_on_rails'] </li></ul></ul><ul><li>Test and retest when adding plugins, small changes can have big impacts on your system! </li></ul>
  8. 8. Best Practices <ul><li>Watch out for plugin overload! </li></ul><ul><li>Relying on remote repositories can slow SVN down </li></ul><ul><li>“ Engines”, and old style approach to plugins combining controllers, models, and views are bad, and rapidly disappearing </li></ul><ul><li>Plugins depending on plugins leads to head-aches </li></ul><ul><li>Don’t pull your code out into plugins too early… </li></ul><ul><li>Treat your plugins like you treat your apps: </li></ul><ul><ul><li>versioning, testing, continous integration </li></ul></ul>
  9. 9. You’ve got Questions? We’ve got Answers!

×