• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
721
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • Title slide

Transcript

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