Pergunta

I’m writing an application with Ruby on Rails. This application will be delivered to a minimum of two different customer types. The base is always the same but some of the views differ. That’s mostly it. For now.

Is there any way, for example using branches, to use the same code base and separate only the views, for example? I read the Git manual for branching but am still not sure if this is the best way to achieve what I need.

Another idea would be forking. But, is that clever? If I change something in the code of fork A, is it easy to merge these changes into fork B?

Foi útil?

Solução

Branching and forking in git is not bad at all, as the merge support is great (possible the best of al VCMs).

Personally, I don't like the idea of branching or forking a project to provide different customization as it can very quickly become really difficult, e.g. what are you going to do if you have 15 different deployments?

I think a better approach is to build the application so it behaves differently depending on some parameters. I'm well aware that sometimes the implementations are very different, so this might not be useful anymore. Another approach is to build the core of your app in a GEM which acts as a service to the application, and the only thing you customize per client are the views. Of course, the GEM should be generic enough to provide all the services you need.

Please share with us what you decided, as there's no best answer for your question.

Outras dicas

It would probably be better to make you product select between the types at either build or runtime, that way you can use a single set of source.

Otherwise it is possible with branches, and merging, but you'll have more difficulty managing things. Forking is basically branching at this level.

I agree with @Augusto. You could run your app in 2 different environments, ie production_A and production_B. From there, you could use SettingsLogic to define configurations based on Rails.env, then reference those settings in your app when selecting which view to use for example.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top