Create dev fixture projects with fixed visibility
Created by: cirosantilli
Creates 3 new projects: one public, one private and one internal. For each project create a new user which is it's owner.
Really helpful to test cases things where visibility matters
Factor out Sidekiq::Testing.inline! do
into the Seeder
with 04_projects.
Create a fixtures_development_helper.rb
helper file because I am pretty sure that will be reused afterwards.
Created by: TeatroIO
I've prepared a stage. Click to open.
By Administrator on 2014-10-26T10:32:42 (imported from GitLab project)
47 puts project.errors.full_messages 48 print 'F' 49 end 1 Gitlab::Seeder.quiet do 2 project_urls = [ 3 'https://github.com/documentcloud/underscore.git', 4 'https://gitlab.com/gitlab-org/gitlab-ce.git', 5 'https://gitlab.com/gitlab-org/gitlab-ci.git', 6 'https://gitlab.com/gitlab-org/gitlab-shell.git', 7 'https://gitlab.com/gitlab-org/gitlab-test.git', 8 'https://github.com/twitter/flight.git', 9 'https://github.com/twitter/typeahead.js.git', 10 'https://github.com/h5bp/html5-boilerplate.git', 11 ] 12 13 project_urls.each do |url| 14 group_path, project_path = url.split('/')[-2..-1] 15 16 group = Group.find_by(path: group_path) 17 18 unless group 19 group = Group.new( 20 name: group_path.titleize, 21 path: group_path 22 ) 23 group.description = Faker::Lorem.sentence 24 group.save 25 26 group.add_owner(User.first) 27 end 28 29 project_path.gsub!('.git', '') 15 16 # import_url does not work for local paths, 17 # so we just copy the template repository in. 18 unless Project.find_with_namespace("#{user.namespace.id}/"\ 19 "#{visibility_label_downcase}") 20 params = { 21 name: "#{visibility_label} Project", 22 description: "#{visibility_label} Project description", 23 namespace_id: user.namespace.id, 24 visibility_level: visibility_value, 25 } 26 project = Projects::CreateService.new(user, params).execute 27 new_path = project.repository.path 28 FileUtils.rm_rf(new_path) 29 FileUtils.cp_r(FixturesDevelopmentHelper.template_project.repository.path, 30 new_path) Created by: cirosantilli
@randx sorry for having caused this problem, I have removed the cause of the problem at: https://github.com/gitlabhq/gitlabhq/pull/8285
By Administrator on 2014-11-10T14:41:35 (imported from GitLab project)
Please register or sign in to reply