2012-11-23 04:34:09 +01:00
|
|
|
namespace :gitlab do
|
|
|
|
desc "GITLAB | Enable usernames and namespaces for user projects"
|
|
|
|
task activate_namespaces: :environment do
|
|
|
|
User.find_each(batch_size: 500) do |user|
|
2012-11-24 11:25:04 +01:00
|
|
|
next if user.namespace
|
|
|
|
|
2012-11-23 04:34:09 +01:00
|
|
|
User.transaction do
|
|
|
|
username = user.email.match(/^[^@]*/)[0]
|
2012-11-24 11:25:04 +01:00
|
|
|
if user.update_attributes!(username: username)
|
|
|
|
print '.'.green
|
|
|
|
else
|
|
|
|
print 'F'.red
|
|
|
|
end
|
2012-11-23 04:34:09 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|