Commit 802a0ecf authored by Douwe Maan's avatar Douwe Maan Committed by Jarka Kadlecova

Merge branch 'zj-add-two-more-project-templates' into 'master'

Add two more project templates

See merge request !13415
parent 970d9e96
...@@ -25,7 +25,9 @@ module Gitlab ...@@ -25,7 +25,9 @@ module Gitlab
end end
TEMPLATES_TABLE = [ TEMPLATES_TABLE = [
ProjectTemplate.new('rails', 'Ruby on Rails') ProjectTemplate.new('rails', 'Ruby on Rails'),
ProjectTemplate.new('spring', 'Spring'),
ProjectTemplate.new('express', 'NodeJS Express')
].freeze ].freeze
class << self class << self
......
...@@ -21,13 +21,18 @@ namespace :gitlab do ...@@ -21,13 +21,18 @@ namespace :gitlab do
params = { params = {
import_url: template.clone_url, import_url: template.clone_url,
namespace_id: admin.namespace.id, namespace_id: admin.namespace.id,
path: template.title, path: template.name,
skip_wiki: true skip_wiki: true
} }
puts "Creating project for #{template.name}" puts "Creating project for #{template.title}"
project = Projects::CreateService.new(admin, params).execute project = Projects::CreateService.new(admin, params).execute
unless project.persisted?
puts project.errors.messages
exit(1)
end
loop do loop do
if project.finished? if project.finished?
puts "Import finished for #{template.name}" puts "Import finished for #{template.name}"
......
...@@ -4,7 +4,9 @@ describe Gitlab::ProjectTemplate do ...@@ -4,7 +4,9 @@ describe Gitlab::ProjectTemplate do
describe '.all' do describe '.all' do
it 'returns a all templates' do it 'returns a all templates' do
expected = [ 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) expect(described_class.all).to be_an(Array)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment