Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-07-26 15:21:53 +0300
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-07-28 12:32:46 +0300
commit1d3815f89b9b9f5ecfd6dd15158a2988603b9ed8 (patch)
treea694e1e05f58fc3fe5ae00135d4a439eef7c8150 /app/services/projects/create_from_template_service.rb
parentd964816b9fe56679ffc0b331e701f7b24db5c6a9 (diff)
Allow projects to be started from a template
Started implementation for the first iteration of gitlab-org/gitlab-ce#32420. This will allow users to select a template to start with, instead of an empty repository in the project just created. Internally this is basically a small extension of the ImportExport GitLab projects we already support. We just import a certain import tar archive. This commits includes the first one: Ruby on Rails. In the future more will be added.
Diffstat (limited to 'app/services/projects/create_from_template_service.rb')
-rw-r--r--app/services/projects/create_from_template_service.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/services/projects/create_from_template_service.rb b/app/services/projects/create_from_template_service.rb
new file mode 100644
index 00000000000..3fc5c4ad157
--- /dev/null
+++ b/app/services/projects/create_from_template_service.rb
@@ -0,0 +1,14 @@
+module Projects
+ class CreateFromTemplateService < BaseService
+ def initialize(user, params)
+ @current_user, @params = user, params.dup
+ end
+
+ def execute
+ params[:file] = Gitlab::ProjectTemplate.find(params[:template_title]).file
+
+ @params[:from_template] = true
+ GitlabProjectsImporterService.new(@current_user, @params).execute
+ end
+ end
+end