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
|
2018-02-12 08:57:25 -05:00
|
|
|
template_name = params.delete(:template_name)
|
|
|
|
file = Gitlab::ProjectTemplate.find(template_name).file
|
|
|
|
|
|
|
|
params[:file] = file
|
|
|
|
|
|
|
|
GitlabProjectsImportService.new(current_user, params).execute
|
2017-07-26 08:21:53 -04:00
|
|
|
|
2017-08-01 08:34:11 -04:00
|
|
|
ensure
|
2018-02-12 08:57:25 -05:00
|
|
|
file&.close
|
2017-07-26 08:21:53 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|