Project Structure | 311
First, install Piston and convert your existing svn:externals to Piston-locked
directories:
$ sudo gem install --include-dependencies piston
$ piston convert
You can now lock to edge Rails:
$ piston import http://svn.rubyonrails.org/rails/trunk vendor/rails
Installing plugins is simple if you know the repository URL:
$ piston import \
http://activemerchant.googlecode.com/svn/trunk/active_merchant \
vendor/plugins/active_merchant
Remember to manually execute the commands ininstall.rbif it does anything spe-
cial;script/pluginwould do this for you, but Piston doesn’t know or care that you
are installing a Rails plugin.
Piston-controlled directories can be updated all at once withpiston update, or one at
a time withpiston update vendor/plugins/active_merchant.
Rails Version
If a Rails distribution is unpacked invendor/railsunder the application root, it will be
used. Ifvendor/railsis not present, Rails will look for an installedrailsgem match-
ing the specifiedRAILS_GEM_VERSION(usually specified inconfig/environment.rb). It is
usually best, for the sake of predictability, to have the Rails code unpacked in
vendor/rails. Although it takes up a little more room in the repository and on the
server, it ensures that everyone is on the same page and developing against the exact
same version.
Nothing says that you have to use edge Rails; for the stable branch of Rails 1.2, use
Piston to lockvendor/rails tohttp://svn.rubyonrails.org/rails/branches/1-2-stable.
Environment Initialization
As Rails has matured, theenvironment.rbconfiguration file has been shifting in pur-
pose and style. Originally, it started out as a procedural language where every little
bit of configuration was included, and you would just “throw something at the bot-
tom” to have it run upon Rails initialization. Now, its purpose is more focused, to
the point that it almost seems to be a domain-specific language for configuring Rails.
The mechanics of starting up Rails have been moved toboot.rb, and what is left has
been cleaned up.
However, sometimes we just need a place to put initialization routines. In edge
Rails, these have been given a new place. If you have (or create) aconfig/initializers
directory, any Ruby files there will be executed after the environment is configured.