Best way to share a plugin between different Rails application

Hello list,

Ok, so this issue might be a topic for a design pattern that has already been discussed a lot around the Rails community, but the information I found is too disperse, and I would like some specific advice if possible.

I have a project that consists of several Rails applications. Actually we got this project with the “please save me” metadata. We are refactoring it to follow best practices and have a better maintenance factor.

So, each rails app, from the client perspective, is a “module”. Each app implements a different part of the system, but still needs artifacts from the others (higher-level artifacts, that are common between all of them), and here’s where the problem lies, everything is duplicated across all these apps: models, controllers, helpers, views, migrations. A true maintenance hell.

So, what I’m politely asking here is, the ways to solve this Wet problem, i.e, DRYing it up.

The way I thought to approach the problem so far is to use Rails engine *to package all the artifacts (models, controllers, migrations, and any other class/asset) in one Rails plugin. So far so good. It is a good proven solution, since Rails engine has been around for quite some time and has proven to work well.

What I still don’t know is how to share this plugin among the apps. I see two ways:

  1. As a git submodule. So, the plugin would be in vendor/plugins, but as a git submodule;
  2. In a central location, still version-controlled of course, but the sharing wouldn’t be done via git submoduling, but instead, I would tell each application to load this additional plugin from this outside location.

I would like some advice on this, any suggestion/idea is very welcome!

Thanks,

Marcelo.

What I still don't know is how to share this plugin among the apps. I see
two ways:

1) As a git submodule. So, the plugin would be in vendor/plugins, but as a
git submodule;
2) In a central location, still version-controlled of course, but the
sharing wouldn't be done via git submoduling, but instead, I would tell each
application to load this additional plugin from this outside location.

3) braid. http://github.com/evilchelu/braid

I'm not sure it really matters though...