|
|
|
@ -39,6 +39,7 @@ class RepositoriesController < ApplicationController
|
|
|
|
|
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
|
|
|
|
|
helper :repositories
|
|
|
|
|
include RepositoriesHelper
|
|
|
|
|
include GitlabHelper
|
|
|
|
|
#@root_path = RepositoriesHelper::ROOT_PATH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -91,10 +92,30 @@ class RepositoriesController < ApplicationController
|
|
|
|
|
render :action => 'show', :layout => 'base_projects'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 创建git版本库
|
|
|
|
|
def create
|
|
|
|
|
if params[:repository_scm].to_s == 'Gitlab'
|
|
|
|
|
if params[:repository_scm].to_s == 'Git'
|
|
|
|
|
# add by nwb
|
|
|
|
|
# 增加对gitlab版本库的支持
|
|
|
|
|
# 判断gitlab用户是否存在,不存在则创建
|
|
|
|
|
user = User.current
|
|
|
|
|
gitlab_user = GitlabUser.find_by_user_id(user.id)
|
|
|
|
|
if gitlab_user.nil?
|
|
|
|
|
if create_user(user.login,user.show_name,user.password,user.mail,user.id)
|
|
|
|
|
else
|
|
|
|
|
# 创建gitlab用户失败
|
|
|
|
|
# 返回可自定义用户创建gitlab的界面
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
# 创建gitlab版本库
|
|
|
|
|
repos = params[:repository][:identifier]
|
|
|
|
|
if create_project_for_user(repos,@project.id,gitlab_user.gitlab_user_id)
|
|
|
|
|
# 创建成功
|
|
|
|
|
else
|
|
|
|
|
# 创建gitlab项目失败
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 连接创建成功后的gitlab版本库
|
|
|
|
|
attrs = pickup_extra_info
|
|
|
|
|
@repository = Repository.factory('Git')
|
|
|
|
|
@repository.safe_attributes = params[:repository]
|
|
|
|
|