去掉测试代码
This commit is contained in:
parent
0dc2466539
commit
6a65b2a84b
|
@ -364,13 +364,13 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
# 测试代码
|
# 测试代码
|
||||||
login_gitlab("admin@local.host","19840410")
|
#login_gitlab("admin@local.host","19840410")
|
||||||
#create_project("testproject1")
|
#create_project("testproject1")
|
||||||
#create_project_for_user("testproject1","2")
|
#create_project_for_user("testproject1","2")
|
||||||
#create_user("test","just test","123456","test@sina.com")
|
#create_user("test","just test","123456","test@sina.com")
|
||||||
#delete_user("3")
|
#delete_user("3")
|
||||||
add_user_to_project("1","2",GitlabHelper::GUEST)
|
#add_user_to_project("1","2",GitlabHelper::GUEST)
|
||||||
delete_user_from_project("1","2")
|
#delete_user_from_project("1","2")
|
||||||
# 测试结束
|
# 测试结束
|
||||||
|
|
||||||
pre_count = 10 #limit
|
pre_count = 10 #limit
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
# Gitlab5.3 API操作接口
|
# Gitlab5.3 API操作接口
|
||||||
# Add by nwb
|
# Add by nwb
|
||||||
# 暂时没支持SSH
|
# 暂时没支持SSH
|
||||||
|
# 接口通过HTTP协议与服务器交互,理论上只要能安装gitlab的操作系统本接口都能支持
|
||||||
|
# 本机的测试环境是Ubuntu 12.04
|
||||||
|
|
||||||
module GitlabHelper
|
module GitlabHelper
|
||||||
|
|
||||||
|
@ -8,6 +10,7 @@ module GitlabHelper
|
||||||
ROOT_PATH="/home/git/repositories/"
|
ROOT_PATH="/home/git/repositories/"
|
||||||
PROJECT_PATH_CUT = 40
|
PROJECT_PATH_CUT = 40
|
||||||
# gitlab版本库所在服务器
|
# gitlab版本库所在服务器
|
||||||
|
# 注意REPO_IP_ADDRESS必须以http://开头,暂时只支持HTTP协议,未支持SSH
|
||||||
#REPO_IP_ADDRESS = "http://" + Setting.repository_domain
|
#REPO_IP_ADDRESS = "http://" + Setting.repository_domain
|
||||||
REPO_IP_ADDRESS = "http://192.168.137.100"
|
REPO_IP_ADDRESS = "http://192.168.137.100"
|
||||||
GITLAB_API = "/api/v3"
|
GITLAB_API = "/api/v3"
|
||||||
|
@ -18,6 +21,8 @@ module GitlabHelper
|
||||||
DEVELOPER = 30
|
DEVELOPER = 30
|
||||||
MASTER = 40
|
MASTER = 40
|
||||||
|
|
||||||
|
# gitlab的登录验证信息
|
||||||
|
# add by nwb
|
||||||
def self.gitlab_token=(token)
|
def self.gitlab_token=(token)
|
||||||
Thread.current[:gitlab_token] = token
|
Thread.current[:gitlab_token] = token
|
||||||
end
|
end
|
||||||
|
@ -211,7 +216,6 @@ module GitlabHelper
|
||||||
#request.set_form_data(params)
|
#request.set_form_data(params)
|
||||||
request.body = params.to_json
|
request.body = params.to_json
|
||||||
response = http.start { |http| http.request(request) }
|
response = http.start { |http| http.request(request) }
|
||||||
puts response.body.inspect
|
|
||||||
return JSON.parse response.body
|
return JSON.parse response.body
|
||||||
rescue =>err
|
rescue =>err
|
||||||
return nil
|
return nil
|
||||||
|
@ -234,7 +238,6 @@ module GitlabHelper
|
||||||
request['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1; rv:29.0) Gecko/20100101 Firefox/29.0'
|
request['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1; rv:29.0) Gecko/20100101 Firefox/29.0'
|
||||||
request['X-ACL-TOKEN'] = 'xxx_token'
|
request['X-ACL-TOKEN'] = 'xxx_token'
|
||||||
response = http.start { |http| http.request request }
|
response = http.start { |http| http.request request }
|
||||||
puts response.body.inspect
|
|
||||||
return JSON.parse response.body
|
return JSON.parse response.body
|
||||||
rescue =>err
|
rescue =>err
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue