gitlab-org--gitlab-foss/lib/gitlab/import_export/repo_saver.rb

32 lines
669 B
Ruby
Raw Normal View History

module Gitlab
module ImportExport
class RepoSaver
include Gitlab::ImportExport::CommandLineUtil
attr_reader :full_path
2016-05-16 04:13:00 -04:00
def initialize(project:, shared:)
@project = project
@shared = shared
end
def save
2016-07-18 05:02:07 -04:00
return true if @project.empty_repo? # it's ok to have no repo
2016-06-14 04:15:20 -04:00
2016-05-13 11:39:03 -04:00
@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