views:

89

answers:

5

Hi,

I developed a rails app for a school alumni site. Now another school wants me to develop a similar site for them.

I want to reuse the app. Data structure will be same but the actual data will be different. Design layout will be similar but design itself will be different.

One option is that I just copy the app and modify it. But in this case, I need to manage 2 apps as they evolve.

Another option will be to make the app generalized and customizable (Database will be separated though). Views will have a lot of a lot of branches.

I could use on database for multiple apps but I am sure it will require a lot of jobs.

Another option will be to move controllers and models to plugins so that 2 apps share them.

Do you have any experience with such a case? If so, can you share it with me?

Thanks.

Sam

A: 

You'd be surprised how far you can get with different stylesheets, layouts and judicious use of localisation.

jonnii
A: 

If there is any way to avoid the complexity of forking your code into two separate applications you should do it.

Making the application generalized and customizable as you are suggesting moves your one off consulting project into something closer to a standalone product (which might be more profitable).

Mike Buckbee
+2  A: 

This might be a little unorthodox, but if you're using git, you can create two branches

  1. one for the school alumni site
  2. one for the similar site

The root code will stay in the master branch. Your development flow would then be:

  • branch off the master
  • make edits
  • pull edits into master when satisfied
  • pull the master changes into the branches.

You can continue to locally modify the branches as needed, but you will need to be careful about introducing conflicting edits between master/branch.

klochner
I've never thought about it. Great idea. I doubt that I will do it that way, though.
Sam Kong
A: 

2 apps will share:

Models Helpers Controllers

They won't share:

Views

I am not sure about database yet.

I may separate views using skin concept like:

app/views/app1/...

app/views/app2/...

I am still thinking about database.

Sam Kong
A: 

I'm using git submodules and symlinks. There's a submodule to the shared project in Rails.root/shared. Then there's symlinks from app/models to shared/app/models, and so on.

August Lilleaas