76771c2946
added spec for avatar saver avatar saver! added avatar restorer spec fix spec added avatar restorer class fix export service fix warnings, added changelog fix spec some refactoring based on feedback fixed a few issues after testing i/e avatar
31 lines
612 B
Ruby
31 lines
612 B
Ruby
module Gitlab
|
|
module ImportExport
|
|
class AvatarSaver
|
|
include Gitlab::ImportExport::CommandLineUtil
|
|
|
|
def initialize(project:, shared:)
|
|
@project = project
|
|
@shared = shared
|
|
end
|
|
|
|
def save
|
|
return true unless @project.avatar.exists?
|
|
|
|
copy_files(avatar_path, avatar_export_path)
|
|
rescue => e
|
|
@shared.error(e)
|
|
false
|
|
end
|
|
|
|
private
|
|
|
|
def avatar_export_path
|
|
File.join(@shared.export_path, 'avatar', @project.avatar_identifier)
|
|
end
|
|
|
|
def avatar_path
|
|
@project.avatar.path
|
|
end
|
|
end
|
|
end
|
|
end
|