Chinaunix首页 | 论坛 | 博客
  • 博客访问: 590012
  • 博文数量: 207
  • 博客积分: 10128
  • 博客等级: 上将
  • 技术积分: 2440
  • 用 户 组: 普通用户
  • 注册时间: 2004-10-10 21:40
文章分类

全部博文(207)

文章存档

2009年(200)

2008年(7)

我的朋友

分类: Java

2009-04-06 16:25:44

The Problem

If you are wondering why exactly you need version control, then you should probably . is a great open-source version control system. And is a good project management and bug/issue tracking system which works seamlessly with Subversion. The problem is how to create and manage multiple projects using a single build procedure.

Subversion + Trac

The Solution

First we need a machine running . The steps below have been tested for Ubuntu 8.04.

Launch terminal and run the following command to install Apache, Python and Subversion.

1.sudo apt-get install apache2 libapache2-mod-python libapache2-svn python-setuptools subversion python-subversion

You can use sudo apt-get install Trac, but the version it installs is 0.10.4. Inorder to get the latest version of Trac use the following command. I suggest you specify the in the command line. As of writing this guide, it is 0.11.3. Also, execute the commands below i.e. create directories svn and trac; create a htpasswd file with your usernames.

1.sudo easy_install http://ftp.edgewall.com/pub/trac/Trac-0.11.3.tar.gz
2.sudo mkdir /svn
3.sudo mkdir /trac
4.sudo htpasswd -cm /etc/svnauth yourusername
5.sudo htpasswd -m /etc/svnauth nextusername

Next you have to create a file for permissions

1.sudo gpedit /etc/svnaccess

Add the following contents to the file. Make sure you change yourusername and nextusername to the usernames you have created.

1.[groups]
2.developers = yourusername, nextusername
3.[ / ]
4.@developers = rw
5.* = r

Then you have to create a new configuration file for Apache by executing:

1.sudo gedit /etc/apache2/sites-available/myserver

Add the following contents to the file. Make sure you change your@email.com to you email address.

01.
02.  
03.    ServerAdmin your@email.com
04.  
05.    DocumentRoot /var/www/
06.    
07.        Options FollowSymLinks
08.        AllowOverride None
09.    
10.    var/www/>
11.        Options Indexes FollowSymLinks MultiViews
12.        AllowOverride None
13.        Order allow,deny
14.        allow from all
15.    
16.  
17.    ErrorLog /var/log/apache2/error.log
18.    LogLevel warn
19.    CustomLog /var/log/apache2/access.log combined
20.    ServerSignature On
21.  
22.
23.  
24.   DAV svn
25.   SVNParentPath /svn
26.  
27.   AuthType Basic
28.   AuthName "Subversion Repository"
29.   AuthUserFile /etc/svnauth
30.   Require valid-user
31.  
32.   AuthzSVNAccessFile /etc/svnaccess
33.
34.  
35.
36.  
37.   SetHandler mod_python
38.   PythonHandler trac.web.modpython_frontend
39.   PythonOption TracEnvParentDir /trac
40.   PythonOption TracUriRoot /trac
41.  
42.   AuthType Basic
43.   AuthName "Trac"
44.   AuthUserFile /etc/svnauth
45.   Require valid-user
46.  
47.
48.  
49.

Once that is done, activate your newly created configuration file by using the a2ensite command as follows. Reload Apache, set permissions and edit trac.ini.

1.sudo a2ensite /etc/apache2/sites-available/myserver
2.sudo /etc/init.d/apache2 reload
3.sudo chown -R www-data /trac
4.sudo gpedit /etc/trac.ini

Add the following contents to trac.ini.

1.[header_logo]
2.alt = Logo
3.height = -1
4.link =
5.src = /logo.gif
6.width = -1

/etc/trac.ini will store the default configuration for each Trac project instance. Copy your logo.gif to /var/www folder.

Finally, create a perl file called init.pl and add the following contents. Make sure you change yourusername to your username. This step will grant you administration rights so that you can add milestones etc. straight from the web interface.

01.#!/usr/bin/perl
02.$sName = $ARGV[0];
03.$lName = $ARGV[1];
04.if ($lName eq "") {
05.   $lName = $sName;
06.}
07.$sName =~ tr/A-Z/a-z/;
08.$path = "sudo svnadmin create /svn/$sName";
09.system ($path);
10.$path = "sudo chown -R www-data /svn/$sName";
11.system ($path);
12.$path = "sudo trac-admin /trac/$sName initenv '$lName' 'sqlite:db/trac.db' 'svn' '/svn/$sName' --inherit=/etc/trac.ini";
13.system ($path);
14.$path = "sudo chown -R www-data /trac/$sName";
15.system ($path);
16.$path = "sudo trac-admin /trac/$sName permission add yourusername TRAC_ADMIN permission list yourusername";
17.system ($path);
18.print "Done!\n\n";

Once the above file is created, your one click build is ready!

Now every time you want to create a new project, all you have to do is execute:

init.pl ’shortprojname’ ‘fullprojname’

where shortprojname is the name of your project with no spaces e.g. todoapp
fullprojname is the expanded name of your project e.g. To-Do Application

Create your first sample project and point your browser to for Trac
The path for your SVN repository will be

If you are looking for a GUI client for Subversion, I suggest you download or . If you are not sure on how to use TortoiseSVN, here are a tutorials.

阅读(1023) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~