views:

87

answers:

1

I have a rails app with core features (layout, users, messaging etc) and 3 different versions that add their own unique features on top of the core set. Each of them are currently in separate directories and deployed separately at the moment.

When I make a change to the core features, I have to copy them by hand at the moment into each of the apps and its very messy.

I'd like to make the 3 folders just be the core app so I can pull in changes via git, and have the unique features via engine in the plugins folder. This way I can keep one version of the core features and keep the unique features separate.

Is this a feasible approach to solving this problem?

I have never used Engines before and just finding out about them w/ Rails 2.3.

+3  A: 

I don't know if rails engines are the solution here, but let me tell you how we solve this problem in one of our projects.

We have a core project, and two projects that pretty much use most of the same data (mostly rails models). Here is how we have it set up:

3 git repos:
- core project
- sub project 1
- sub project 2

core project is a totally normal git repo, but in the sub projects, core project is a git submodule. Then, symlinks are added and tracked via git. For example:

/subproject $: git submodule add [email protected]:core.git core
/subproject $: cd app
/subproject/app $: ln -s ../core/models models

now, subproject/app/models pulls from the core project. you can do this for any number of files.

to update from the core repo:

/subproject $: git submodule update && git commit

Clearly that is a lot easier than copying files. I hope this works for you.

efalcao