summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-08-09 12:16:43 +0200
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2017-08-15 12:55:54 +0200
commit639140677410f11955947980aa47356e1136c32e (patch)
tree7d0a6827634ab87586f51ccd886b8888c1085a2e
parent4a2a6d521a260981482ee8e4931ebf06cb4f5b6a (diff)
downloadgitlab-ce-zj-add-two-more-project-templates.tar.gz
Add two more project templateszj-add-two-more-project-templates
Related to !13108. Mostly this is just running the rake task and changing the task a bit to catch cases like the project already existing or so. The rake task moves archives to the vendor/project_template directory, which are checked in too.
-rw-r--r--app/views/shared/icons/_express.svg (renamed from app/views/shared/icons/_node_express.svg)0
-rw-r--r--app/views/shared/icons/_spring.svg (renamed from app/views/shared/icons/_java_spring.svg)0
-rw-r--r--lib/gitlab/project_template.rb4
-rw-r--r--lib/tasks/gitlab/update_templates.rake9
-rw-r--r--spec/lib/gitlab/project_template_spec.rb4
-rw-r--r--vendor/project_templates/express.tar.gzbin0 -> 4572 bytes
-rw-r--r--vendor/project_templates/spring.tar.gzbin0 -> 49882 bytes
7 files changed, 13 insertions, 4 deletions
diff --git a/app/views/shared/icons/_node_express.svg b/app/views/shared/icons/_express.svg
index f2c94319f19..f2c94319f19 100644
--- a/app/views/shared/icons/_node_express.svg
+++ b/app/views/shared/icons/_express.svg
diff --git a/app/views/shared/icons/_java_spring.svg b/app/views/shared/icons/_spring.svg
index 508349aa456..508349aa456 100644
--- a/app/views/shared/icons/_java_spring.svg
+++ b/app/views/shared/icons/_spring.svg
diff --git a/lib/gitlab/project_template.rb b/lib/gitlab/project_template.rb
index cf461adf697..732fbf68dad 100644
--- a/lib/gitlab/project_template.rb
+++ b/lib/gitlab/project_template.rb
@@ -25,7 +25,9 @@ module Gitlab
end
TEMPLATES_TABLE = [
- ProjectTemplate.new('rails', 'Ruby on Rails')
+ ProjectTemplate.new('rails', 'Ruby on Rails'),
+ ProjectTemplate.new('spring', 'Spring'),
+ ProjectTemplate.new('express', 'NodeJS Express')
].freeze
class << self
diff --git a/lib/tasks/gitlab/update_templates.rake b/lib/tasks/gitlab/update_templates.rake
index a7e30423c7a..f44abc2b81b 100644
--- a/lib/tasks/gitlab/update_templates.rake
+++ b/lib/tasks/gitlab/update_templates.rake
@@ -21,13 +21,18 @@ namespace :gitlab do
params = {
import_url: template.clone_url,
namespace_id: admin.namespace.id,
- path: template.title,
+ path: template.name,
skip_wiki: true
}
- puts "Creating project for #{template.name}"
+ puts "Creating project for #{template.title}"
project = Projects::CreateService.new(admin, params).execute
+ unless project.persisted?
+ puts project.errors.messages
+ exit(1)
+ end
+
loop do
if project.finished?
puts "Import finished for #{template.name}"
diff --git a/spec/lib/gitlab/project_template_spec.rb b/spec/lib/gitlab/project_template_spec.rb
index 12e75cdd5d0..d19bd611919 100644
--- a/spec/lib/gitlab/project_template_spec.rb
+++ b/spec/lib/gitlab/project_template_spec.rb
@@ -4,7 +4,9 @@ describe Gitlab::ProjectTemplate do
describe '.all' do
it 'returns a all templates' do
expected = [
- described_class.new('rails', 'Ruby on Rails')
+ described_class.new('rails', 'Ruby on Rails'),
+ described_class.new('spring', 'Spring'),
+ described_class.new('express', 'NodeJS Express')
]
expect(described_class.all).to be_an(Array)
diff --git a/vendor/project_templates/express.tar.gz b/vendor/project_templates/express.tar.gz
new file mode 100644
index 00000000000..6353f6605d5
--- /dev/null
+++ b/vendor/project_templates/express.tar.gz
Binary files differ
diff --git a/vendor/project_templates/spring.tar.gz b/vendor/project_templates/spring.tar.gz
new file mode 100644
index 00000000000..d7c0ab74d01
--- /dev/null
+++ b/vendor/project_templates/spring.tar.gz
Binary files differ