Class: Storage::LegacyProject
- Inherits:
-
Object
- Object
- Storage::LegacyProject
- Defined in:
- app/models/storage/legacy_project.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
-
#base_dir ⇒ String
Base directory.
-
#disk_path ⇒ String
Disk path is used to build repository and project's wiki path on disk.
-
#initialize(project) ⇒ LegacyProject
constructor
A new instance of LegacyProject.
- #rename_repo(old_full_path: nil, new_full_path: nil) ⇒ Object
Constructor Details
#initialize(project) ⇒ LegacyProject
Returns a new instance of LegacyProject.
8 9 10 |
# File 'app/models/storage/legacy_project.rb', line 8 def initialize(project) @project = project end |
Instance Attribute Details
#project ⇒ Object
Returns the value of attribute project
5 6 7 |
# File 'app/models/storage/legacy_project.rb', line 5 def project @project end |
Instance Method Details
#base_dir ⇒ String
Base directory
15 16 17 |
# File 'app/models/storage/legacy_project.rb', line 15 def base_dir namespace.full_path end |
#disk_path ⇒ String
Disk path is used to build repository and project's wiki path on disk
22 23 24 |
# File 'app/models/storage/legacy_project.rb', line 22 def disk_path project.full_path end |
#rename_repo(old_full_path: nil, new_full_path: nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/models/storage/legacy_project.rb', line 26 def rename_repo(old_full_path: nil, new_full_path: nil) old_full_path ||= project.full_path_before_last_save new_full_path ||= project.build_full_path if gitlab_shell.mv_repository(repository_storage, old_full_path, new_full_path) # If repository moved successfully we need to send update instructions to users. # However we cannot allow rollback since we moved repository # So we basically we mute exceptions in next actions begin gitlab_shell.mv_repository(repository_storage, "#{old_full_path}.wiki", "#{new_full_path}.wiki") return true rescue => e Gitlab::AppLogger.error("Exception renaming #{old_full_path} -> #{new_full_path}: #{e}") # Returning false does not rollback after_* transaction but gives # us information about failing some of tasks return false end end false end |