summaryrefslogtreecommitdiff
path: root/app/services/bulk_imports/repository_bundle_export_service.rb
blob: 31a2ed6d1af64355f884ed6a37a453ba70d8e8c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module BulkImports
  class RepositoryBundleExportService
    def initialize(repository, export_path, export_filename)
      @repository = repository
      @export_path = export_path
      @export_filename = export_filename
    end

    def execute
      repository.bundle_to_disk(bundle_filepath) if repository.exists?
    end

    private

    attr_reader :repository, :export_path, :export_filename

    def bundle_filepath
      File.join(export_path, "#{export_filename}.bundle")
    end
  end
end