Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
31e0fa65
Commit
31e0fa65
authored
Dec 23, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update output of gitlab:enable_namespaces
parent
1b6c28b9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
lib/tasks/gitlab/enable_namespaces.rake
lib/tasks/gitlab/enable_namespaces.rake
+16
-12
No files found.
lib/tasks/gitlab/enable_namespaces.rake
View file @
31e0fa65
namespace
:gitlab
do
desc
"GITLAB | Enable usernames and namespaces for user projects"
task
enable_namespaces: :environment
do
print
"
\n
Usernames for users:"
.
yellow
warn_user_is_not_gitlab
print
"Generate usernames for users without one: "
User
.
find_each
(
batch_size:
500
)
do
|
user
|
next
if
user
.
namespace
...
...
@@ -16,7 +18,8 @@ namespace :gitlab do
end
end
print
"
\n\n
Dirs for groups:"
.
yellow
puts
""
print
"Create directories for groups: "
Group
.
find_each
(
batch_size:
500
)
do
|
group
|
if
group
.
ensure_dir_exist
...
...
@@ -25,43 +28,44 @@ namespace :gitlab do
print
'F'
.
red
end
end
puts
""
print
"
\n\n
Move projects from groups under groups dirs:"
.
yellow
git_path
=
Gitlab
.
config
.
gitolite
.
repos_path
puts
""
puts
"Move projects in groups into respective directories ... "
Project
.
where
(
'namespace_id IS NOT NULL'
).
find_each
(
batch_size:
500
)
do
|
project
|
next
unless
project
.
group
group
=
project
.
group
puts
"
\n
"
print
" *
#{
project
.
name
}
: "
print
"
#{
project
.
name_with_namespace
.
yellow
}
... "
new_path
=
File
.
join
(
git_path
,
project
.
path_with_namespace
+
'.git'
)
if
File
.
exists?
(
new_path
)
p
rint
"ok. already at
#{
new_path
}
"
.
cya
n
p
uts
"already at
#{
new_path
}
"
.
gree
n
next
end
old_path
=
File
.
join
(
git_path
,
project
.
path
+
'.git'
)
unless
File
.
exists?
(
old_path
)
p
rint
"missing. not found
at
#{
old_path
}
"
.
red
p
uts
"couldn't find it
at
#{
old_path
}
"
.
red
next
end
begin
Gitlab
::
ProjectMover
.
new
(
project
,
''
,
group
.
path
).
execute
p
rint
"ok. M
oved to
#{
new_path
}
"
.
green
p
uts
"m
oved to
#{
new_path
}
"
.
green
rescue
p
rint
"F
ailed moving to
#{
new_path
}
"
.
red
p
uts
"f
ailed moving to
#{
new_path
}
"
.
red
end
end
print
"
\n\n
Rebuild gitolite:"
.
yellow
puts
""
puts
"Rebuild Gitolite ... "
gitolite
=
Gitlab
::
Gitolite
.
new
gitolite
.
update_repositories
(
Project
.
where
(
'namespace_id IS NOT NULL'
))
puts
"
\n
"
puts
"
...
#{
"done"
.
green
}
"
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment