|
|
@ -13,7 +13,6 @@ class CreateShixunService < ApplicationService
|
|
|
|
shixun.identifier= identifier
|
|
|
|
shixun.identifier= identifier
|
|
|
|
main_mirror = MirrorRepository.find params[:main_type]
|
|
|
|
main_mirror = MirrorRepository.find params[:main_type]
|
|
|
|
sub_mirrors = MirrorRepository.where(id: params[:sub_type])
|
|
|
|
sub_mirrors = MirrorRepository.where(id: params[:sub_type])
|
|
|
|
begin
|
|
|
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
shixun.save!
|
|
|
|
shixun.save!
|
|
|
|
# 获取脚本内容
|
|
|
|
# 获取脚本内容
|
|
|
@ -43,10 +42,6 @@ class CreateShixunService < ApplicationService
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return shixun
|
|
|
|
return shixun
|
|
|
|
end
|
|
|
|
end
|
|
|
|
rescue => e
|
|
|
|
|
|
|
|
Rails.logger.error(e.message)
|
|
|
|
|
|
|
|
render_error("实训创建失败:#{e.message}")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
private
|
|
|
@ -102,7 +97,7 @@ class CreateShixunService < ApplicationService
|
|
|
|
|
|
|
|
|
|
|
|
# 版本库目录空间
|
|
|
|
# 版本库目录空间
|
|
|
|
def repo_namespace(user, shixun_identifier)
|
|
|
|
def repo_namespace(user, shixun_identifier)
|
|
|
|
"#{user.login}/#{shixun_identifier}.git"
|
|
|
|
"#{user}/#{shixun_identifier}.git"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|