2014年(4)
分类: 项目管理
2014-03-21 10:36:09
vi /etc/httpd/conf/httpd.conf 增如下记录。
touch trac_digest.py and then vi trac_digest.py 在文件里增加如下记录。
from optparse import OptionParser
# The md5 module is deprecated in Python 2.5
try:
from hashlib import md5
except ImportError:
from md5 import md5
realm = 'trac'
# build the options
usage = "usage: %prog [options]"
parser = OptionParser(usage=usage)
parser.add_option("-u", "--username",action="store", dest="username", type = "string",
help="the username for whom to generate a password")
parser.add_option("-p", "--password",action="store", dest="password", type = "string",
help="the password to use")
parser.add_option("-r", "--realm",action="store", dest="realm", type = "string",
help="the realm in which to create the digest")
(options, args) = parser.parse_args()
# check options
if (options.username is None) or (options.password is None):
parser.error("You must supply both the username and password")
if (options.realm is not None):
realm = options.realm
# Generate the string to enter into the htdigest file
kd = lambda x: md5(':'.join(x)).hexdigest()
print ':'.join((options.username, realm, kd([options.username, realm, options.password])))
cd /var/www/html/trac
python trac_digest.py -u admin -p luoyang >> ./digest.auth
trac-admin /var/www/html/trac/project1 permission add admin TRAC_ADMIN
tracd -p 8000 --auth="project1,/var/www/html/trac/digest.auth,trac" /var/www/html/trac/project1
点击登陆按钮,就可以直接登陆。Username/Password:admin/luoyang (也就是上面python代码生成的那个用户名密码)
2. 关联SVN到Trac
admin登陆成功后,找到Administration>>Plugins>>Trac 1.0.1, 点击展这个插件列表,把没有勾选的全部勾选上,保存。
修改Trac.ini文件如下信息,保存退出。
vi /var/www/html/trac/project1/conf/trac.ini
authz_file = /var/www/html/trac/authz
authz_module_name = project1
repository_dir = /var/www/html/svn/repos1
repository_sync_per_request =
repository_type = svn
最后再全到Administration>>Version Control>>Repositories,
默认有一个svn项目/var/www/html/svn/repos1, 你可以自己新加一个。
name type: Directory
project1 svn /var/www/html/svn/repos1
此时你就可以到Browse Source查看版本更新的情况。
在Browse Source查看新版本信息
如果有更新,想在Browse Source查看新版本状态,在CentOS增加如下脚本,手功执行一下即可。
touch trac_update.sh and then vi trac_update.sh add this info.
#!/bin/sh
export PYTHON_EGG_CACHE="/var/www/html/trac/"
trac-admin /var/www/html/trac/project1 changeset added "$1" "$2"
执行这个脚本就可以在Browse Source查看新版本信息。