Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build a Plugin or Gem?

Typically I create a plugin when I have a module that I know I'm going to need over again in my other projects, however, they could also be packaged as gems.

When should I be building a gem over creating a plugin? Is there any criteria for making the call?

like image 399
Codebeef Avatar asked Jan 13 '09 20:01

Codebeef


2 Answers

Plugins are becoming obsolete now that you can manage gems via the "config.gem" statement in environment.rb. Gems are available system-wide (not just in one app), and are versioned unlike plugins.

I've converted all of my plugins to gems recently. Easy to do and well worth it.

like image 100
Matt Darby Avatar answered Sep 21 '22 10:09

Matt Darby


Rails seems to be moving towards the gem direction. I have converted most of my plugins to gems now. Gems are easier to manage and fit better in the Ruby eco-system. Why do we need two separate systems anyway?

There is still a problem with gems however: it is not possible to add rake tasks to a Rails application from a gem. Probably the same holds for generators, although I'm not sure. If you use these in your plugin, migrating to a gem is not yet possible. Hopefully this gets fixed soon.

like image 41
wvb Avatar answered Sep 22 '22 10:09

wvb