Fixed and improved enable_naamespace migration task

This commit is contained in:
Dmitriy Zaporozhets 2012-12-28 06:14:05 +03:00
parent d991ce636b
commit d03964d6ec
3 changed files with 76 additions and 27 deletions

View file

@ -51,8 +51,12 @@ class Namespace < ActiveRecord::Base
end
def ensure_dir_exist
dir_exists? || system("mkdir -m 770 #{namespace_dir_path}")
end
def dir_exists?
namespace_dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
system("mkdir -m 770 #{namespace_dir_path}") unless File.exists?(namespace_dir_path)
File.exists?(namespace_dir_path)
end
def move_dir