blob: a7e0f9986662e8ee5dc0e6b574baf1031bf4025a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# frozen_string_literal: true
module BulkImports
class FileExportService
include Gitlab::ImportExport::CommandLineUtil
def initialize(portable, export_path, relation)
@portable = portable
@export_path = export_path
@relation = relation
end
def execute
export_service.execute
archive_exported_data
end
def exported_filename
"#{relation}.tar"
end
private
attr_reader :export_path, :portable, :relation
def export_service
case relation
when FileTransfer::ProjectConfig::UPLOADS_RELATION
UploadsExportService.new(portable, export_path)
else
raise BulkImports::Error, 'Unsupported relation export type'
end
end
def archive_exported_data
archive_file = File.join(export_path, exported_filename)
tar_cf(archive: archive_file, dir: export_path)
end
end
end
|