# Engines, Plugins, Gems and Components

**URL:** <https://www.ruby-forum.com/t/engines-plugins-gems-and-components/82620>\
**Category:** Rails\
**Created:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/engines-plugins-gems-and-components/82620 "2007-01-19T16:31:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/engines-plugins-gems-and-components/82620/1 "2007-01-19T16:31:45Z")

</div>

Is there a complete document out there that describes the differences,  
preferences, and logic between each of the Ruby/Rails extension modules?

Why/when would I use one over the other? and what’s the reasoning behind  
having so many choices? I want to write some modular Rails code, both  
to submit, and for in house libraries, but with all the choices, I don’t  
which way to go.

Thanks  
Matt

---

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [September 25, 2007, 10:30pm UTC](https://www.ruby-forum.com/t/engines-plugins-gems-and-components/82620/2 "2007-09-25T22:30:57Z")

</div>

> If you code only makes sense in terms of a Rails application, or  
> overrides/enhances some features of Rails, you’re probably better  
> creating a plugin (or a plugin ‘stub’ that loads a gem, if you’re  
> feeling fancy). Because plugins are ‘simpler’ than Gems, they can be  
> included into an app easily (svn externals are particularly useful) and  
> so there’s a little bit less to worry about with deployment.

Instead of svn:externals, take a look at using Piston to manage your  
plugins: [Managing Rails Plugins with Piston](http://www.rubyinside.com/advent2006/12-piston.html)

–  
Rick O.  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [September 25, 2007, 10:46pm UTC](https://www.ruby-forum.com/t/engines-plugins-gems-and-components/82620/3 "2007-09-25T22:46:17Z")

</div>

On 1/13/07, matt [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Matt  
> Gems are ruby libraries:  
> [http://rubygems.org/](http://rubygems.org/)

Rails Plugins provide a way to modify the rails framework or add new  
features to it:  
[http://nubyonrails.com/articles/2006/05/04/the-complete-guide-to-rails-plugins-part-i](http://nubyonrails.com/articles/2006/05/04/the-complete-guide-to-rails-plugins-part-i)

Engines are rails plugins that tack on other neato features:  
[http://rails-engines.org/](http://rails-engines.org/)

Components never really caught on, plugins/engines replaced any desire  
for them.

–  
Rick O.  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [September 25, 2007, 10:47pm UTC](https://www.ruby-forum.com/t/engines-plugins-gems-and-components/82620/4 "2007-09-25T22:47:44Z")

</div>

James,

Thanks for the insight! I really didn’t mean for you to write an  
article on the spot, but it is much appreciated. I’ve been trying to  
capture some of these responses, so that the group as a whole can  
redirect questions to specific answers, and minimize the extra traffic  
on the mailing list.

Thanks again James

Matt

---

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [September 25, 2007, 10:51pm UTC](https://www.ruby-forum.com/t/engines-plugins-gems-and-components/82620/5 "2007-09-25T22:51:30Z")

</div>

matt wrote:

> So I take it that there isn’t a document/article that  
> compares/contrasts?  
> pros/cons?  
> when to use/not to use ?  
> rationale of using one over the other?

Presumably you’re talking about when to write one type of reusable  
library as opposed to another? There are no clear-cut “pros/cons” to  
either since their appropriateness depends on what exactly you’re  
trying to share. However:

If you’re writing a Ruby library that could be used for projects beyond  
Rails, make a Gem; it’s the de-facto standard for distributing Ruby  
libs. Gems have nice features like being able to load a specific  
version, and automatically installing dependencies, but are most  
typically installed as part a system’s global Ruby library set, rather  
than being associated with a particular application. If you go this  
route when writing enhancements for Rails apps, it can add another  
hop-skip-step to your deployment (i.e. ensuring that all the  
appropriate gems are either installed or unpacked into your app for  
each target machine).

If you code only makes sense in terms of a Rails application, or  
overrides/enhances some features of Rails, you’re probably better  
creating a plugin (or a plugin ‘stub’ that loads a gem, if you’re  
feeling fancy). Because plugins are ‘simpler’ than Gems, they can be  
included into an app easily (svn externals are particularly useful) and  
so there’s a little bit less to worry about with deployment.

If you want to share Rails-specific things like controllers, routes,  
migrations and such, write a plugin and request that users install the  
engines plugin along side it, since it makes sharing such things quite  
easy when appropriate.

HTH

James

---

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [September 25, 2007, 10:46pm UTC](https://www.ruby-forum.com/t/engines-plugins-gems-and-components/82620/6 "2007-09-25T22:46:33Z")

</div>

So I take it that there isn’t a document/article that  
compares/contrasts?  
pros/cons?  
when to use/not to use ?  
rationale of using one over the other?

Matt
