30 April 2010
All
This is Part 3 in a three-part series on using Subversion with Dreamweaver CS5. Part 1 provides a general introduction to Subversion and the concept of version control systems. Part 2 shows you how to configure Dreamweaver CS5 to use a Subversion repository. This part explains how to create your own repository.
Note: This part is more advanced than the previous parts. It requires UNIX commands to configure your repository and set up Apache access on your local machine. A discussion on setting up Subversion using the built-in svn protocol is beyond the scope of this article. Please refer to the Where to go from here section at the end of this part for resources on configuring a Subversion server.
In this example, I will be setting up my Mac as a Subversion repository (it can be considered a server in the traditional client-server model). To do this I will depend on the fact that Apple, since Mac OS X 10.5, includes the Subversion binaries. If you have an older version of Mac OS X or are using Windows, you may want to go to the Subversion site or search the Internet for information on how to implement Subversion locally.
The first step in creating a repository is selecting a location on your local hard disk where the repository files are kept. This is different than the location where you will keep your local client copies of your code. Remember, in this scenario your machine will be both the client and the server.
On my machine I chose to put my repository in my home directory. The full path is:
/usr/local/svn/repo
For the directory name you can use "repo", "repositories", or any other descriptive name.
To get started, access the Mac (UNIX) command line by opening the Terminal application. Choose Application > Utilities > Terminal from the Mac menu bar.
In the Terminal application (see Figure 1), you'll see a prompt which looks something like the following:
Voltage:~ voltmer$
In the prompt, Voltage is the name of my machine and voltmer is my login.
I use the following commands to:
Voltage:~ voltmer$ sudo mkdir /usr/local/svn
Voltage:~ voltmer$ sudo svnadmin create --fs-type fsfs
/usr/local/svn/repo
Voltage:~ voltmer$ ls /usr/local/svn/repo
README.txt
dav
format locks
Conf
db hooks
Note: I precede each command with sudo to execute commands as the superuser. The first time you run the sudo command it will prompt you for the superuser password. It will cache the password for a while and not prompt you again until the cache times out.
That is it! I now have a repository where I can keep my code.
To access the repository via Apache, the Mac's built-in web server, I need to make a few changes to the Apache config file and to the repository's permissions.
At the prompt, I change to the configuration directory for Apache and back up my httpd.conf file, which is where the Apache configuration settings are kept:
Voltage:~ voltmer$ cd /etc/apache2/
Voltage:apache2 voltmer$ sudo cp httpd.conf httpd.conf.bak
Now I edit the file using the nano editor, which uses the Control key with letters to issue commands that are listed across the bottom of the screen. (You can use any text editor to edit the file.) Here is the command to start nano as superuser (see Figure 3):
Voltage:apache2 voltmer$ sudo nano httpd.conf
I must edit the file to load the WebDAV SVN module and configure the directory for the repository. Within the file there are several lines starting with LoadModule. At the end of that section I add the following on a line by itself (see Figure 4):
LoadModule dav_svn_module
libexec/apache2/mod_dav_svn.so
Now I scroll down to the end of the file and add the following section (see Figure 5):
<Location /repo>
DAV svn
SVNPath /usr/local/svn/repo
AuthType Basic
AuthName "Subversion"
AuthUserFile /usr/local/svn/svn_passwd
Require valid-user
</Location>
This tells Apache to map the /repo web directory to the actual file system location of the repository. This links the following URL:
http://localhost/repo
to the repository at /usr/local/svn/repo.
To save the file and exit nano I press Control (^X).
Because I don't want unauthorized users reviewing my repository I am going to create a password file to protect the contents. This file, /usr/local/svn/svn_passwd, was specified in the httpd.conf file but it does not yet exist. To create it, I change directory to the location where I am going to keep my repository and run the htpasswd utility to make the file (see Figure 6):
Voltage:apache2 voltmer$ cd /usr/local/svn
Voltage:svn voltmer$ sudo htpasswd -c svn_passwd voltmer
New password:
Re-type new password:
Adding password for user voltmer
It prompted me twice for the password for the user known as voltmer. It is not asking for my current user password but a new one for the web SVN access. You can, however, use the same password if you want. I also have to make sure that only the web server can read the repository, so I execute the following commands to set the permissions on the repository and password file (see Figure 7):
Voltage:svn voltmer$ cd /usr/local
Voltage:local voltmer$ sudo chown –R www:www /usr/local/svn
Voltage:local voltmer$ sudo chmod 600 /usr/local/svn/svn_passwd
Voltage:local voltmer$ ls -la /usr/local/svn/svn_passwd
-rw------- 1 _www _www 22 Sep 2 16:23
svn_passwd
The final task is to start (or restart) the web server. On a Mac, open System Preferences and then go to the Sharing control panel. If Web Sharing is not already checked (see Figure 8), then select it (see Figure 9).
If it is already checked (Apache is running), then deselect and reselect the Web Sharing option to stop Apache and restart it. To verify that everything is working correctly, point your web browser (for example, Safari) to http://localhost/repo. If all is working, you will be prompted for the username and password that you just created (see Figure 10), then you will see the root directory of the repository.
If you see the text "Powered by Subversion version..." (see Figure 11), then you know the setup is working.
With the new repository set up, you are now ready to configure Dreamweaver to use it. Follow the steps in the Configuring a new site to use the Subversion repository section to access the repository via the HTTP protocol.
This time when you click Test to verify your settings are correct, Dreamweaver will notify you that the project does not exist. This is because you have not yet submitted the files from the local file system to the repository. Click Done and another dialog box will ask you, whether you want to create the Subversion directory (see Figure 12). Click Yes.
At this point you will be able to see your files in the Local Files list. They now have a plus (+) symbol next to their names to indicate that the local files are different than those in the repository (see Figure 13).
This is true because there are no files in the repository yet; they need to be checked in for the first time. To check them in right-click on the top folder of the site and choose Check In (see Figure 14).
Just like the earlier example, Dreamweaver will prompt for a Commit Message. Type Initial check in and click Commit (see Figure 15).
Dreamweaver CS5 removes the plus (+) symbol in front of the files to indicate that they are checked in (committed) to the repository (see Figure 16). You are free to continue the check-out, edit, check-in cycle as needed. If other users will work on this project in the repository they can now configure their Dreamweaver CS5 sites in a similar manner.
You can refer to a number of excellent resources available on the Internet for additional information. These include:
Other publications include:
Tutorials and samples |
| 04/23/2012 | Resolution/Compatibility/liquid layout |
|---|---|
| 04/20/2012 | using local/testing server with cs5 inserting images look fine in the split screen but do not show |
| 04/18/2012 | Ap Div help |
| 04/23/2012 | Updating |