summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-11-23 09:11:09 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-11-23 09:11:09 +0300
commitab9d02365181df373beffbe7732b36b9b3f7a307 (patch)
tree4dc15b36db8f256f032bb58b889e28850d3c1b0b /app/models/namespace.rb
parentf17ddeb394ced4322f9b29eada92d5086bdef03b (diff)
downloadgitlab-ce-ab9d02365181df373beffbe7732b36b9b3f7a307.tar.gz
Create dir with namespace. Create namespace with user
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 120dac1ce5a..247115351b5 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -10,6 +10,8 @@ class Namespace < ActiveRecord::Base
delegate :name, to: :owner, allow_nil: true, prefix: true
+ after_save :ensure_dir_exist
+
scope :root, where('type IS NULL')
def self.search query
@@ -23,4 +25,9 @@ class Namespace < ActiveRecord::Base
def human_name
owner_name
end
+
+ def ensure_dir_exist
+ namespace_dir_path = File.join(Gitlab.config.git_base_path, code)
+ Dir.mkdir(namespace_dir_path) unless File.exists?(namespace_dir_path)
+ end
end