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

32 lines
650 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
private
def uploads_export_path
File.join(@shared.export_path, 'uploads')
end
def uploads_path
File.join(Rails.root.join('public/uploads'), @project.path_with_namespace)
end
end
end
end