debian-mirror-gitlab/lib/gitlab/import_export/uploads_saver.rb

30 lines
601 B
Ruby
Raw Normal View History

2016-06-22 15:30:34 +05:30
module Gitlab
module ImportExport
class UploadsSaver
2016-08-24 12:49:21 +05:30
include Gitlab::ImportExport::CommandLineUtil
2016-06-22 15:30:34 +05:30
def initialize(project:, shared:)
@project = project
@shared = shared
end
def save
return true unless File.directory?(uploads_path)
copy_files(uploads_path, uploads_export_path)
rescue => e
@shared.error(e)
false
end
2018-03-17 18:26:18 +05:30
def uploads_path
FileUploader.absolute_base_dir(@project)
end
2016-06-22 15:30:34 +05:30
def uploads_export_path
File.join(@shared.export_path, 'uploads')
end
end
end
end