Class: Gitlab::ImportExport::LfsRestorer

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/import_export/lfs_restorer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(project:, shared:) ⇒ LfsRestorer

Returns a new instance of LfsRestorer.


10
11
12
13
# File 'lib/gitlab/import_export/lfs_restorer.rb', line 10

def initialize(project:, shared:)
  @project = project
  @shared = shared
end

Instance Attribute Details

#projectObject

Returns the value of attribute project


8
9
10
# File 'lib/gitlab/import_export/lfs_restorer.rb', line 8

def project
  @project
end

#sharedObject

Returns the value of attribute shared


8
9
10
# File 'lib/gitlab/import_export/lfs_restorer.rb', line 8

def shared
  @shared
end

Instance Method Details

#restoreObject


15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gitlab/import_export/lfs_restorer.rb', line 15

def restore
  return true if lfs_file_paths.empty?

  lfs_file_paths.each do |file_path|
    link_or_create_lfs_object!(file_path)
  end

  true
rescue => e
  shared.error(e)
  false
end