2017-07-26 08:21:53 -04:00
|
|
|
module Projects
|
|
|
|
class CreateFromTemplateService < BaseService
|
|
|
|
def initialize(user, params)
|
|
|
|
@current_user, @params = user, params.dup
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
2017-08-01 08:34:11 -04:00
|
|
|
params[:file] = Gitlab::ProjectTemplate.find(params[:template_name]).file
|
2017-07-26 08:21:53 -04:00
|
|
|
|
2017-08-01 08:34:11 -04:00
|
|
|
GitlabProjectsImportService.new(@current_user, @params).execute
|
|
|
|
ensure
|
|
|
|
params[:file]&.close
|
2017-07-26 08:21:53 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|