Project Structure | 313
There are plenty of nuances to this trick, so be sure to check the aforementioned blog
post and its comments for the full story.
Multi-Application Projects
For large projects, sometimes multiple Rails applications need to be grouped
together. Multiple applications that need to share code can be grouped in the same
version control tree. This is a good use for Subversion externals; externals can point
to other parts of the repository that they live in.
Under this setup, bits of shared code are kept in the repository at the top level of
their branch or trunk (at the same level as the Rails applications). Subversion exter-
nals are used to pull shared folders into each of the Rails projects. A typical directory
structure looks like Figure 10-5.
Under this directory layout, you would issue commands like the following to import
each directory from the shared tree:
$ cd project
$ svn propset svn:externals "models(repo)/trunk/shared_models" \
trunk/rails_app_{1,2}/app
That command tells Subversion to sourcetrunk/rails_app_1/app/modelsandtrunk/
rails_app_2/app/modelsfromtrunk/shared_models. When you update either of the Rails
applications, they will grab code fromshared_models. When you commit code into the
applications’ model directories, Subversion will push the code intoshared_models.
Figure 10-5. Directory structure of a large Rails project