gitlabhq/lib/tasks/gitlab/activate_namespaces.rake

14 lines
422 B
Ruby
Raw Normal View History

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|
User.transaction do
username = user.email.match(/^[^@]*/)[0]
user.update_attributes!(username: username)
user.create_namespace!(code: username, name: user.name)
print '.'.green
end
end
end
end