Class: Gitlab::ImportExport::Shared
- Inherits:
-
Object
- Object
- Gitlab::ImportExport::Shared
- Defined in:
- lib/gitlab/import_export/shared.rb
Constant Summary collapse
- LOCKS_DIRECTORY =
'locks'
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#exportable ⇒ Object
readonly
Returns the value of attribute exportable.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #active_export_count ⇒ Object
- #add_error_message(message) ⇒ Object
- #after_export_in_progress? ⇒ Boolean
-
#archive_path ⇒ Object
The path where the tarball is saved.
- #base_path ⇒ Object
- #error(error) ⇒ Object
-
#export_path ⇒ Object
The path where the exportable metadata and repository bundle (in case of project) is saved.
-
#initialize(exportable) ⇒ Shared
constructor
A new instance of Shared.
- #lock_files_path ⇒ Object
- #locks_present? ⇒ Boolean
Constructor Details
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
26 27 28 |
# File 'lib/gitlab/import_export/shared.rb', line 26 def errors @errors end |
#exportable ⇒ Object (readonly)
Returns the value of attribute exportable.
26 27 28 |
# File 'lib/gitlab/import_export/shared.rb', line 26 def exportable @exportable end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
26 27 28 |
# File 'lib/gitlab/import_export/shared.rb', line 26 def logger @logger end |
Instance Method Details
#active_export_count ⇒ Object
36 37 38 |
# File 'lib/gitlab/import_export/shared.rb', line 36 def active_export_count Dir[File.join(base_path, '*')].count { |name| File.basename(name) != LOCKS_DIRECTORY && File.directory?(name) } end |
#add_error_message(message) ⇒ Object
64 65 66 |
# File 'lib/gitlab/import_export/shared.rb', line 64 def () @errors << () end |
#after_export_in_progress? ⇒ Boolean
68 69 70 |
# File 'lib/gitlab/import_export/shared.rb', line 68 def after_export_in_progress? locks_present? end |
#archive_path ⇒ Object
The path where the tarball is saved
46 47 48 |
# File 'lib/gitlab/import_export/shared.rb', line 46 def archive_path @archive_path ||= Gitlab::ImportExport.export_path(relative_path: relative_archive_path) end |
#base_path ⇒ Object
50 51 52 |
# File 'lib/gitlab/import_export/shared.rb', line 50 def base_path @base_path ||= Gitlab::ImportExport.export_path(relative_path: relative_base_path) end |
#error(error) ⇒ Object
58 59 60 61 62 |
# File 'lib/gitlab/import_export/shared.rb', line 58 def error(error) Gitlab::ErrorTracking.track_exception(error, log_base_data) (error.) end |
#export_path ⇒ Object
The path where the exportable metadata and repository bundle (in case of project) is saved
41 42 43 |
# File 'lib/gitlab/import_export/shared.rb', line 41 def export_path @export_path ||= Gitlab::ImportExport.export_path(relative_path: relative_path) end |
#lock_files_path ⇒ Object
54 55 56 |
# File 'lib/gitlab/import_export/shared.rb', line 54 def lock_files_path @locks_files_path ||= File.join(base_path, LOCKS_DIRECTORY) end |
#locks_present? ⇒ Boolean
72 73 74 |
# File 'lib/gitlab/import_export/shared.rb', line 72 def locks_present? Dir.exist?(lock_files_path) && !Dir.empty?(lock_files_path) end |