Combining different Rails apps into one

Hello!

I’m trying to join two Rails apps, namely Beast and Simplelog.

Is it just to copy the code from one app into the other, and manually merge conflicting files and folders?

Can anybody offer me some tips and tricks on this?

I see a lot of pain, for instance, when it’s time to upgrade…

http://forums.simplelog.net/comments.php?DiscussionID=98&page=1

It is important that things remain neat and supersimple, otherwise I’ll feel sick.

Thanks,
Kyrre

Kyrre Nygård wrote:

Hello!

Hi there.

I'm trying to join two Rails apps, namely Beast and Simplelog.

Alright..

It is important that things remain neat and supersimple, otherwise I'll feel sick.

Impossible.

I'm not quite sure what exactly you want to achieve (single sign on, single database, single codebase or a combination) but none of these is supersimple probably also won't be neat.

Having a single database would be the easiest one (besides SSO if the apps support openid out of the box). You would have to compare the tables created by both apps to make sure that there are no duplicates. Then it would be as simple as pointing both configs to the same db. The only thing that will break is migrations support since the schema version is stored in the db as well. You can always go in and manually edit the schema version number though.. If there are duplicate table names, you would need obviously need to override them.

Now if you would REALLY want to merge codebase and have a single database, the way to go might be to namespace all your ruby classes into e.g. Beast and Simplelog. Then you create a Application::Base < ActiveRecord::Base class for each app and use this base class to prefix all your tables with e.g. beast_ or simplelog_. Of course you then have to go prefix your routes as well.

I've never looked at the codebase of these applications but in theory this would be a fairly low-mess approach, even upgrades should be relatively painless if all you've done is prefix your routes and introduce a new base class for all models. Clearly though, YMMV and of course the question remains: why?

Regards,
Niels

Niels,
For what it's worth I had the same need and found it much easier to
'reverse engineer' these types of apps and then rebuild them myself.
You can see what I did at www.RailsExpert.com.
Kathleen

Indeed I am looking for a single sign on, a single database as well as a single codebase.

One of the apps comes with OpenID support, the other, no.

That’s a nice domain by the way. Did you have to travel to Morocco just to get it?

Kyrre

Kyrre Nygård wrote:

Indeed I am looking for a single sign on, a single database as well as a single codebase.

One of the apps comes with OpenID support, the other, no.

Well, you can always politely ask for inclusion of OpenID support in the other app.

As pointed out earlier, "namespacing" your database tables should be *fairly* trivial (although you have to take care with your migrations, e.g. all migration files also need to be changed to include table name prefixes).

Contrary though, I wouldn't even try to merge codebases since this will most likely turn into a complete mess at the latest when updating. It is called "application" (as opposed to e.g. component) for a reason..

That's a nice domain by the way. Did you have to travel to Morocco just to get it?

Nope. They give them out just like that. Well in exchange for your credit card information that is.. :slight_smile:

Cheers,
Niels

The way you put it does sound quite trivial, and I’m really gonna put my heart into this.

As for upgrading, yeah I’ll most likely have to do this manually.

I was just about to write the following to the Git mailing list: