Martinicity: Keeping your Rails Codebase Clean with SVN ExternalsMike Blaketag:www.martinicity.net,2005:TypoTypo2007-01-31T16:42:21+00:00Mike Blakeurn:uuid:dee6f8d3-128c-49df-abbe-ffc8ff2435702007-01-31T16:25:00+00:002007-01-31T16:42:21+00:00Keeping your Rails Codebase Clean with SVN Externals<p>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.</p>
<p>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 <i><span class="caps">SVN</span> Externals.</i></p>
<p>Using <a href="http://tortoisesvn.tigris.org">Tortoise <span class="caps">SVN</span></a>, right click inside the vendor directory of your app, then choose ‘properties’ from the menu.</p>
<p>!<a href="/images/svn_properties.gif">svn properties</a></p>
<p>Click the ‘Subversion’ Tab with the little turtle. Then choose <b>svn:externals</b> from the dropdown in the middle of the screen.</p>
<p>!<a href="/images/externals.gif">svn:externals</a></p>
Now in the text area, enter the plugin you want to include.
<code>acts_as_authenticated&nbsp;http://svn.techno-weenie.net/projects/plugins/acts\_as\_authenticated
</code>
<p>The format here is important, the first word the entry, before the first space will be the <b>directory name</b> where the code will live. After the first space is the <b>url for the repository</b>. Click ‘OK to save the external. Then go up one directory and do a checkout of the ‘vendor’ directory.</p>
<p>Now:</p>
<p>1. If the plugin code changes, you’ll receive the new code whenever you do an Update.
1. 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.
1. There’s a clear distinction in your repository between the code you’re maintaining, and third party code.</p>