Fixed and improved enable_naamespace migration task
This commit is contained in:
parent
779e95b503
commit
708a0d421e
3 changed files with 84 additions and 25 deletions
|
@ -51,8 +51,17 @@ class Namespace < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def ensure_dir_exist
|
||||
namespace_dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
|
||||
system("mkdir -m 770 #{namespace_dir_path}") unless File.exists?(namespace_dir_path)
|
||||
unless dir_exists?
|
||||
system("mkdir -m 770 #{namespace_full_path}")
|
||||
end
|
||||
end
|
||||
|
||||
def dir_exists?
|
||||
File.exists?(namespace_full_path)
|
||||
end
|
||||
|
||||
def namespace_full_path
|
||||
@namespace_full_path ||= File.join(Gitlab.config.gitolite.repos_path, path)
|
||||
end
|
||||
|
||||
def move_dir
|
||||
|
|
|
@ -14,7 +14,7 @@ class UserObserver < ActiveRecord::Observer
|
|||
if user.namespace
|
||||
user.namespace.update_attributes(path: user.username)
|
||||
else
|
||||
user.create_namespace!(path: user.username, name: user.name)
|
||||
user.create_namespace!(path: user.username, name: user.username)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue