Commit f47ba909 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix seeds. More projects for dev seeds

parent 86d9ed9a
...@@ -7,5 +7,6 @@ User.seed(:id, [ ...@@ -7,5 +7,6 @@ User.seed(:id, [
password: "5iveL!fe", password: "5iveL!fe",
password_confirmation: "5iveL!fe", password_confirmation: "5iveL!fe",
admin: true, admin: true,
projects_limit: 100,
} }
]) ])
gitlab_shell_path = File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}")
root = Gitlab.config.gitlab_shell.repos_path
projects = [
{ path: 'underscore.git', git: 'https://github.com/documentcloud/underscore.git' },
{ path: 'diaspora.git', git: 'https://github.com/diaspora/diaspora.git' },
{ path: 'brightbox/brightbox-cli.git', git: 'https://github.com/brightbox/brightbox-cli.git' },
{ path: 'brightbox/puppet.git', git: 'https://github.com/brightbox/puppet.git' },
{ path: 'gitlab/gitlabhq.git', git: 'https://github.com/gitlabhq/gitlabhq.git' },
{ path: 'gitlab/gitlab-ci.git', git: 'https://github.com/gitlabhq/gitlab-ci.git' },
{ path: 'gitlab/gitlab-recipes.git', git: 'https://github.com/gitlabhq/gitlab-recipes.git' },
]
projects.each do |project|
project_path = File.join(root, project[:path])
if File.exists?(project_path)
print '-'
next
end
if system("#{gitlab_shell_path}/gitlab-shell/bin/gitlab-projects import-project #{project[:path]} #{project[:git]}")
print '.'
else
print 'F'
end
end
puts "OK".green
Group.seed(:id, [
{ id: 99, name: "GitLab", path: 'gitlab', owner_id: 1 },
{ id: 100, name: "Brightbox", path: 'brightbox', owner_id: 1 },
{ id: 101, name: "KDE", path: 'kde', owner_id: 1 },
])
Project.seed(:id, [ project_urls = [
'https://github.com/documentcloud/underscore.git',
'https://github.com/diaspora/diaspora.git',
'https://github.com/diaspora/diaspora-project-site.git',
'https://github.com/diaspora/diaspora-client.git',
'https://github.com/brightbox/brightbox-cli.git',
'https://github.com/brightbox/puppet.git',
'https://github.com/gitlabhq/gitlabhq.git',
'https://github.com/gitlabhq/gitlab-ci.git',
'https://github.com/gitlabhq/gitlab-recipes.git',
'https://github.com/gitlabhq/gitlab-shell.git',
'https://github.com/gitlabhq/grack.git',
'https://github.com/twitter/flight.git',
'https://github.com/twitter/typeahead.js.git',
'https://github.com/h5bp/html5-boilerplate.git',
'https://github.com/h5bp/mobile-boilerplate.git',
]
# Global project_urls.each_with_index do |url, i|
{ id: 1, name: "Underscore.js", path: "underscore", creator_id: 1 }, group_path, project_path = url.split('/')[-2..-1]
{ id: 2, name: "Diaspora", path: "diaspora", creator_id: 1 },
# Brightbox group = Group.find_by_path(group_path)
{ id: 3, namespace_id: 100, name: "Brightbox CLI", path: "brightbox-cli", creator_id: 1 },
{ id: 4, namespace_id: 100, name: "Puppet", path: "puppet", creator_id: 1 },
# KDE unless group
{ id: 5, namespace_id: 101, name: "kdebase", path: "kdebase", creator_id: 1}, group = Group.new(
{ id: 6, namespace_id: 101, name: "kdelibs", path: "kdelibs", creator_id: 1}, name: group_path.titleize,
{ id: 7, namespace_id: 101, name: "amarok", path: "amarok", creator_id: 1}, path: group_path
)
group.owner = User.first
group.save
end
# GitLab project_path.gsub!(".git", "")
{ id: 8, namespace_id: 99, name: "gitlabhq", path: "gitlabhq", creator_id: 1},
{ id: 9, namespace_id: 99, name: "gitlab-ci", path: "gitlab-ci", creator_id: 1}, params = {
{ id: 10, namespace_id: 99, name: "gitlab-recipes", path: "gitlab-recipes", creator_id: 1}, import_url: url,
]) namespace_id: group.id,
name: project_path.titleize
}
project = Projects::CreateContext.new(User.first, params).execute
if project.valid?
print '.'
else
puts project.errors.full_messages
print 'F'
end
end
Gitlab::Seeder.quiet do Gitlab::Seeder.quiet do
(2..300).each do |i| (2..50).each do |i|
begin begin
User.seed(:id, [{ User.seed(:id, [{
id: i, id: i,
......
ActiveRecord::Base.observers.disable :all ActiveRecord::Base.observers.disable :all
Gitlab::Seeder.quiet do Gitlab::Seeder.quiet do
Project.all.each do |project| Group.all.each do |group|
project.team << [User.first, :master] User.all.sample(4).each do |user|
if group.add_users([user.id], UsersGroup.group_access_roles.values.sample)
print '.' print '.'
else
print 'F'
end
end
end
User.all.sample(rand(10)).each do |user| Project.all.each do |project|
role = [:master, :developer, :reporter].sample User.all.sample(4).each do |user|
project.team << [user, role] if project.team << [user, UsersProject.access_roles.values.sample]
print '.' print '.'
else
print 'F'
end
end end
end end
end end
...@@ -11,7 +11,6 @@ Gitlab::Seeder.quiet do ...@@ -11,7 +11,6 @@ Gitlab::Seeder.quiet do
next unless user next unless user
user_id = user.id user_id = user.id
IssueObserver.current_user = user
Issue.seed(:id, [{ Issue.seed(:id, [{
id: i, id: i,
......
...@@ -17,7 +17,6 @@ Gitlab::Seeder.quiet do ...@@ -17,7 +17,6 @@ Gitlab::Seeder.quiet do
next if branches.uniq.size < 2 next if branches.uniq.size < 2
user_id = user.id user_id = user.id
MergeRequestObserver.current_user = user
MergeRequest.seed(:id, [{ MergeRequest.seed(:id, [{
id: i, id: i,
source_branch: branches.first, source_branch: branches.first,
......
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