Marcelo de Moraes Serpa
2009-Oct-07 22:07 UTC
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2009-Oct-07 22:12 UTC
Re: Best way to share a plugin between different Rails application
> 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...