There is 1 main RoR project and 2 additional projects share some parts of main project - models, plugins, etc.
Currently all projects are under same svn repository with svn externals for shared parts.
What is best way of moving such layout to git?
Yes you can, but is not recommended. Best practice is one repo per project always. Otherwise you have multiple projects updating one repo, that can mess with the code a fair bit if not set correctly. If the project is set up to be read-only on one project, that is an exception.
Yes. You can put multiple projects in one Git repository but they would need to be on different branches within that repo. The Git console in ReadyAPI gives you the ability to create or switch branches from the UI. More information on the Git integration can be found here in the documentation.
You will need a repository for each of the parts. (each project and one or more for the shared parts).
To include these shared parts there are two possibilities.
First the easy one, you create a (private) gem for the shared parts, that means you don't need to link anything, just add gem [gemname] to your Gemfile. When you update the gem, all projects will use the changed code.
When you want to include the external code in your project you need a little bit of organisation. You create a root map where you clone both the shared and project repository to. Then you create a (relative) symlink, to the shared code folder. You can just add this symlink to your git repository and commit it. You have to update and commit both repositories seperate.
An example of the second method:
- projectfolder
--- shared code
--- project code
----- lib
------- shared (link to shared code)
The link to shared code is created by the command ln -s "../../../shared code" shared
Ofcourse, this only works on systems supporting symbolic links (mac and *nix)
Even though i accepted first answer we chose quite a different approach.
Since essentially all applications are just different aspects of 1 project(frontend, backend and api) they share A LOT therefore we decided to put them all into 1 repository and symlink shared parts(git can handle that).
This simplifies repository organization but slightly complicates deployment scripts which was ok tradeoff for us.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With