Advanced Rails - Building Industrial-Strength Web Apps in Record Time

(Tuis.) #1
Project Structure | 309

Project Structure

There are several decisions that must be made about how to structure a large Rails
application. Issues arise with how to manage multiple branches of development, a
team of developers, and external or vendor software. In this section, we cover some
of the most common choices.


Subversion Configuration


Subversion usually needs a little bit of configuration to work with Rails. There are
some “volatile” files that change from development to production or within a
deployment. These files should be kept out of version control. In Subversion, a file is
ignored within a directory by setting a pattern matching the file as the value of the
svn:ignoreproperty on the parent directory. For most Rails applications, the follow-
ing ignores are typically used:


$ svn propset svn:ignore database.yml config/
$ svn propset svn:ignore "*" log/ tmp/{cache,pids,sessions,sockets}

There is a Subversion client configuration that sets up many of these settings, and
will ignore those volatile files without the need for svn:ignore. It also sets up
autoprops, which sets the MIME type on files in the repository automatically. If you
work mainly with Rails projects, this can be a good choice. The config file is avail-
able fromhttp://3spoken.wordpress.com/rails-subversion-tng-config-file/.


As a rule, configuration specific to a particular Rails environment (excluding database
connection specifications, which are more specific to the developer and his environ-
ment) should not be ignored, but rather should be placed in environment-specific
blocks. This allows the configuration to be versioned while still remaining environment-
specific.


Importing existing applications


Thesvn importcommand is designed to place a directory (and its subdirectories)
under version control. Unfortunately, it is only an import, not a checkout. It does
not turn the imported directory into a working copy, which is usually the behavior
you want when importing a project that is already under development.


Trac Python, Subversion Great Subversion integration. Very nice workflow. Based on mod-
ular architecture, so many plugins are available. However, it can
be difficult to install. Currently used to manage Rails develop-
ment (http://dev.rubyonrails.org/).
Lighthouse Rails (Hosted) New subscription-based issue-tracking service by Active Reload
(Rick Olson and Justin Palmer). Very slick interface, good extensi-
bility, and integration with email.

Product Platform Description
Free download pdf