Class: Gitlab::ProjectTransfer
- Inherits:
-
Object
- Object
- Gitlab::ProjectTransfer
- Defined in:
- lib/gitlab/project_transfer.rb
Overview
This class is used to move local, unhashed files owned by projects to their new location
Direct Known Subclasses
Instance Method Summary collapse
-
#move_namespace(path, parent_path_was, parent_path) ⇒ Object
(also: #move_project)
nil parent_path (or parent_path_was) represents a root namespace.
- #rename_namespace(path_was, path) ⇒ Object
- #rename_project(path_was, path, namespace_path) ⇒ Object
- #root_dir ⇒ Object
Instance Method Details
#move_namespace(path, parent_path_was, parent_path) ⇒ Object Also known as: move_project
nil parent_path (or parent_path_was) represents a root namespace
7 8 9 10 11 12 13 14 15 |
# File 'lib/gitlab/project_transfer.rb', line 7 def move_namespace(path, parent_path_was, parent_path) parent_path_was ||= '' parent_path ||= '' new_parent_folder = File.join(root_dir, parent_path) FileUtils.mkdir_p(new_parent_folder) from = File.join(root_dir, parent_path_was, path) to = File.join(root_dir, parent_path, path) move(from, to, "") end |
#rename_namespace(path_was, path) ⇒ Object
24 25 26 |
# File 'lib/gitlab/project_transfer.rb', line 24 def rename_namespace(path_was, path) move(path_was, path) end |
#rename_project(path_was, path, namespace_path) ⇒ Object
19 20 21 22 |
# File 'lib/gitlab/project_transfer.rb', line 19 def rename_project(path_was, path, namespace_path) base_dir = File.join(root_dir, namespace_path) move(path_was, path, base_dir) end |
#root_dir ⇒ Object
28 29 30 |
# File 'lib/gitlab/project_transfer.rb', line 28 def root_dir raise NotImplementedError end |