Keeping your Rails Codebase Clean with SVN Externals
Posted by Mike Blake Wed, 31 Jan 2007 16:25:00 GMT
As you develop a nice well organized Rails application, you’re sure to utilize some of the great open source code already written by Rails developers.
A common practice is to install a plugin or some other code into your application, then add that code to subversion. Some problems with this are that a checkout of your app now takes longer, and if the plugin improves, you are using old code in your application. A neater solution is to access third party code using SVN Externals.
Using Tortoise SVN, right click inside the vendor directory of your app, then choose ‘properties’ from the menu.

Click the ‘Subversion’ Tab with the little turtle. Then choose svn:externals from the dropdown in the middle of the screen.

Now in the text area, enter the plugin you want to include.
acts_as_authenticated http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated
The format here is important, the first word the entry, before the first space will be the directory name where the code will live. After the first space is the url for the repository. Click ‘OK to save the external. Then go up one directory and do a checkout of the ‘vendor’ directory.
Now:
- If the plugin code changes, you’ll receive the new code whenever you do an Update.
- Additional coders who check out the repository have the option to ‘Omit externals’ if they don’t need the portion of the code you’ve included.
- There’s a clear distinction in your repository between the code you’re maintaining, and third party code.

