Methods
C
N
P
T
Instance Public methods
chief()
# File app/roles/namespaced_project.rb, line 44
def chief
  if namespace
    namespace_owner
  else
    owner
  end
end
name_with_namespace()
# File app/roles/namespaced_project.rb, line 30
def name_with_namespace
  @name_with_namespace ||= begin
                             if namespace
                               namespace.human_name + " / " + name
                             else
                               name
                             end
                           end
end
namespace_owner()
# File app/roles/namespaced_project.rb, line 40
def namespace_owner
  namespace.try(:owner)
end
path_with_namespace()
# File app/roles/namespaced_project.rb, line 52
def path_with_namespace
  if namespace
    namespace.path + '/' + path
  else
    path
  end
end
transfer(new_namespace)
# File app/roles/namespaced_project.rb, line 2
def transfer(new_namespace)
  Project.transaction do
    old_namespace = namespace
    self.namespace = new_namespace

    old_dir = old_namespace.try(:path) || ''
    new_dir = new_namespace.try(:path) || ''

    old_repo = if old_dir.present?
                 File.join(old_dir, self.path)
               else
                 self.path
               end

    if Project.where(path: self.path, namespace_id: new_namespace.try(:id)).present?
      raise TransferError.new("Project with same path in target namespace already exists")
    end

    Gitlab::ProjectMover.new(self, old_dir, new_dir).execute

    git_host.move_repository(old_repo, self)

    save!
  end
rescue Gitlab::ProjectMover::ProjectMoveError => ex
  raise Project::TransferError.new(ex.message)
end