Refactored and fixed seeds to work with gitlab-shell

This commit is contained in:
Dmitriy Zaporozhets 2013-02-09 15:13:56 +02:00
parent 152f87864c
commit 38985390b0
11 changed files with 14 additions and 24 deletions

View file

@ -13,19 +13,17 @@ projects = [
projects.each do |project|
project_path = File.join(root, project[:path])
next if File.exists?(project_path)
if File.exists?(project_path)
print '-'
next
end
cmds = [
"cd #{root} && sudo -u git -H git clone --bare #{project[:git]} ./#{project[:path]}",
"sudo ln -s ./lib/hooks/post-receive #{project_path}/hooks/post-receive",
"sudo chown git:git -R #{project_path}",
"sudo chmod 770 -R #{project_path}",
]
cmds.each do |cmd|
puts cmd.yellow
`#{cmd}`
if system("/home/git/gitlab-shell/bin/gitlab-projects import-project #{project[:path]} #{project[:git]}")
print '.'
else
print 'F'
end
end
puts "OK".green

View file

@ -0,0 +1,5 @@
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 },
])

View file

@ -1,9 +1,3 @@
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, [
# Global

View file

@ -1,5 +1,3 @@
UsersProject.skip_callback(:save, :after, :update_repository)
Gitlab::Seeder.quiet do
(1..300).each do |i|
@ -21,9 +19,4 @@ Gitlab::Seeder.quiet do
print('.')
end
end
UsersProject.set_callback(:save, :after, :update_repository)
puts "\nRebuild gitolite\n".yellow
Project.all.each(&:update_repository)
puts "OK".green