You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#coding=utf-8
|
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
|
|
# 脚本用于刷新版本库,由git hooks里进行调用,传入参数为git仓库路径
|
|
|
|
|
# 需要配置rails项目地址
|
|
|
|
|
# 必须装此文件放在git的存放目录,现在是 /home/pdl/redmine-2.3.2-0/apache2/htdocs
|
|
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
import os
|
|
|
|
|
import urllib
|
|
|
|
|
import urllib2
|
|
|
|
|
|
|
|
|
|
RAILS_URL = 'http://192.168.128.128:3000/'
|
|
|
|
|
|
|
|
|
|
def get_git_path():
|
|
|
|
|
return sys.argv[1]
|
|
|
|
|
path=os.path.realpath(sys.argv[0])
|
|
|
|
|
if os.path.isfile(path):
|
|
|
|
|
path=os.path.dirname(os.path.dirname(path))
|
|
|
|
|
return os.path.abspath(path)
|
|
|
|
|
|
|
|
|
|
def post_http_data(url, data):
|
|
|
|
|
data_urlencode = urllib.urlencode(data)
|
|
|
|
|
req = urllib2.Request(url = url,data =data_urlencode)
|
|
|
|
|
res_data = urllib2.urlopen(req)
|
|
|
|
|
#res = res_data.read()
|
|
|
|
|
#return res
|
|
|
|
|
|
|
|
|
|
path = get_git_path()
|
|
|
|
|
post_http_data(RAILS_URL + 'git_callback/post_update', {'root_url': path})
|