还原之前的改动

dev_bj
daiao 6 years ago
parent b40f1844fb
commit c2dee3b831

@ -817,18 +817,18 @@ class ShixunsController < ApplicationController
ShixunServiceConfig.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror)
end
end
# # 自动构建版本库
# repository = Repository.new
# repository.shixun = @shixun
# repository.type = 'Repository::Gitlab'
# repository.identifier = @shixun.identifier.downcase
# repository.project_id = -1
# repository.save!
# s = Trustie::Gitlab::Sync.new
# gproject = s.create_shixun(@shixun, repository)
# raise "版本库创建失败" if @shixun.gpid.blank? # 若和gitlab没同步成功则抛出异常
# g = Gitlab.client
# @shixun.update_column(:git_url, g.project(@shixun.gpid).path_with_namespace)
# 自动构建版本库
repository = Repository.new
repository.shixun = @shixun
repository.type = 'Repository::Gitlab'
repository.identifier = @shixun.identifier.downcase
repository.project_id = -1
repository.save!
s = Trustie::Gitlab::Sync.new
gproject = s.create_shixun(@shixun, repository)
raise "版本库创建失败" if @shixun.gpid.blank? # 若和gitlab没同步成功则抛出异常
g = Gitlab.client
@shixun.update_column(:git_url, g.project(@shixun.gpid).path_with_namespace)
# g = Gitlab.client
# hook_url = Setting.protocol + "://" + Setting.host_name + "/shixuns/#{@shixun.identifier}" + "/ghook"
# g.add_project_hook(@shixun.gpid, hook_url)

Loading…
Cancel
Save