2018-07-17 16:50:37 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-04-30 08:21:21 +00:00
|
|
|
# This service is responsible of managing the retrieval of the lfs objects,
|
|
|
|
# and call the service LfsDownloadService, which performs the download
|
|
|
|
# for each of the retrieved lfs objects
|
2018-06-06 16:42:18 +00:00
|
|
|
module Projects
|
|
|
|
module LfsPointers
|
|
|
|
class LfsImportService < BaseService
|
|
|
|
def execute
|
2019-04-30 08:21:21 +00:00
|
|
|
return success unless project&.lfs_enabled?
|
2018-06-06 16:42:18 +00:00
|
|
|
|
2019-04-30 08:21:21 +00:00
|
|
|
lfs_objects_to_download = LfsObjectDownloadListService.new(project).execute
|
2018-06-06 16:42:18 +00:00
|
|
|
|
2019-04-30 08:21:21 +00:00
|
|
|
lfs_objects_to_download.each do |lfs_download_object|
|
|
|
|
LfsDownloadService.new(project, lfs_download_object).execute
|
2018-06-06 16:42:18 +00:00
|
|
|
end
|
|
|
|
|
2019-04-30 08:21:21 +00:00
|
|
|
success
|
|
|
|
rescue => e
|
|
|
|
error(e.message)
|
2018-06-06 16:42:18 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|