summaryrefslogtreecommitdiff
path: root/lib/gitlab/project_template.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-08-01 12:38:10 +0200
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-08-01 13:00:51 +0200
commit09974de3e3d6409e24786c116fc084c6d834fed8 (patch)
tree6078d00a08229946182fe9ad415dea36c4df0997 /lib/gitlab/project_template.rb
parent74b58131d49ac1379cc8071b1df3867bdbf54eae (diff)
downloadgitlab-ce-09974de3e3d6409e24786c116fc084c6d834fed8.tar.gz
Create rake task to create project templates
First iteration, and some stuff is missing. But basically this rake task does a clone of a project we've pointed it to. Than creates a project on the GDK, which should be running in the background. This project is exported, after which we move that archive to the location we need it. We clean up by removing the generated project. The first idea was to export the project on .com too, however than we might run into ImportExport versions mismatch. This could've been circumvented by checkout out an older commit locally. This however is not needed yet, so we opted to not go this route yet, instead we will iterate on what we got.
Diffstat (limited to 'lib/gitlab/project_template.rb')
-rw-r--r--lib/gitlab/project_template.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/gitlab/project_template.rb b/lib/gitlab/project_template.rb
index 72fcda154c5..01f9492c860 100644
--- a/lib/gitlab/project_template.rb
+++ b/lib/gitlab/project_template.rb
@@ -11,13 +11,17 @@ module Gitlab
end
def file
- template_archive.open
+ archive_path.open
end
- def template_archive
+ def archive_path
Rails.root.join("vendor/project_templates/#{name}.tar.gz")
end
+ def clone_url
+ "https://gitlab.com/gitlab-org/project-templates/#{name}.git"
+ end
+
def ==(other)
name == other.name && title == other.title
end
@@ -34,6 +38,10 @@ module Gitlab
def find(name)
all.find { |template| template.name == name.to_s }
end
+
+ def archive_directory
+ Rails.root.join("vendor_directory/project_templates")
+ end
end
end
end