7ec8af5017
Enables frozen string for the following: * lib/gitlab/hook_data/**/*.rb * lib/gitlab/i18n/**/*.rb * lib/gitlab/import/**/*.rb * lib/gitlab/import_export/**/*.rb * lib/gitlab/kubernetes/**/*.rb * lib/gitlab/legacy_github_import/**/*.rb * lib/gitlab/manifest_import/**/*.rb * lib/gitlab/metrics/**/*.rb * lib/gitlab/middleware/**/*.rb Partially addresses gitlab-org/gitlab-ce#47424.
33 lines
700 B
Ruby
33 lines
700 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
module ImportExport
|
|
class RepoSaver
|
|
include Gitlab::ImportExport::CommandLineUtil
|
|
|
|
attr_reader :full_path
|
|
|
|
def initialize(project:, shared:)
|
|
@project = project
|
|
@shared = shared
|
|
end
|
|
|
|
def save
|
|
return true if @project.empty_repo? # it's ok to have no repo
|
|
|
|
@full_path = File.join(@shared.export_path, ImportExport.project_bundle_filename)
|
|
bundle_to_disk
|
|
end
|
|
|
|
private
|
|
|
|
def bundle_to_disk
|
|
mkdir_p(@shared.export_path)
|
|
@project.repository.bundle_to_disk(@full_path)
|
|
rescue => e
|
|
@shared.error(e)
|
|
false
|
|
end
|
|
end
|
|
end
|
|
end
|