Installing Subversion for Use with Rails

Subversion is a source code repository and versioning system that many Rails developers use every day. It allows you to track changes to code, revert to old versions, and really simplify deployment to remote servers.

Additionally, many Rails plug-ins require Subversion on your machine as part of the installation process.

This section will walk you through installing Subversion's client tools on your machine. We'll set up the command-line tools that are required for Rails plug-ins, but we'll also install a graphical interface called TortoiseSVN, which makes it dead simple to use.

Finally, I'll walk you through setting up your own repository for your projects.

Installing the Subversion Client Tools

Visit the page http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91 and locate the most current Windows setup version. The filename will look something like svn-1.4.2-setup.exe. Grab the one with the highest version number.

Once it's downloaded, run the installer. During the installation, you'll be asked where Subversion should be installed. The default location will be c:program filessubversion, but I strongly recommend you change it to c:svn (see Figure 26). This will make it easier later on if you want to create a repository or edit files.

Installing Subversion to c:svn will make it easier to configure the service later.

Figure 26. Installing Subversion to c:svn will make it easier to configure the service later.

The installer will install the official Subversion manual to your Start Menu, so give that a look when you have some spare time.

The installer adds the Subversion executables to your path so you'll need to close any open command windows and reopen them in order for the path changes to take effect.

Testing Subversion

You can easily test Subversion to see if it's installed correctly by opening up a command prompt and typing this command (see Figure 27):

svn --help
Running svn with the -help option

Figure 27. Running svn with the -help option

Installing TortoiseSVN—A GUI for Subversion

TortoiseSVN is a really nice graphical client for Subversion repositories that integrates with the Windows Explorer shell.

Visit http://tortoisesvn.net/downloads and download the latest version (see Figure 28). Make sure to get the right one for your architecture (32-bit versus 64-bit).

Downloading TortoiseSVN

Figure 28. Downloading TortoiseSVN

Once it's downloaded, run the installer and leave all the settings alone. The installation may require you to reboot your machine. Ensure that you have the ability to install software on your machine as well.

Once it's installed, you can connect to a repository by right-clicking anywhere on your desktop or from any folder in Explorer (see Figure 29).

TortoiseSVN integrates with Windows Explorer

Figure 29. TortoiseSVN integrates with Windows Explorer

The Repo-Browser allows you to browse through repositories, check out projects, and much more. You can learn more about how TortoiseSVN works by reading the documentation.

Configuring Subversion for SVN+SSH

Some repositories require that the communication be done over a secure channel using SSH. In order to make this happen under Windows, you have to make a few minor configuration changes.

First, make sure that TortoiseSVN has been installed on the system.

Next, set the environment variable SVN_SSH to the path of the TortoisePlink program which can create the necessary tunnel.

set SVN_SSH="c:\program files\TortoiseSVN\bin\TortoisePlink.exe"

You could also set the home path using the Windows Environment Variables configuration dialog. That way you only need to set it once instead of every time you open a new command prompt.

  1. Right-click the My Computer icon

  2. Select Properties from the context menu

  3. Choose the Advanced tab

  4. Select the Environment variables button

  5. Choose New under User Variables

  6. Add the variable name SVN_SSH and the value c:\programfiles\TortoiseSVN\bin\TortoisePlink.exe (see Figure 30)

  7. Select OK to save the changes, and then press OK on the other background windows

Configuring your environment variables for SVN_SSH support. The double-backslashes are not a mistake!

Figure 30. Configuring your environment variables for SVN_SSH support. The double-backslashes are not a mistake!

You can now access your secured repository via an SSH Tunnel:

svn ls svn+ssh://[email protected]/repository

When you access it, you'll need to accept the host key. You'll see a message similar to the one in Figure 31. You can press Yes to save the host key so you'll never be bothered again. This will store the key in your current user profile; it won't be shared with any other user.

Select Yes to trust the remote host

Figure 31. Select Yes to trust the remote host

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset