gitlab-org--gitlab-foss/app/services/archive_repository_service.rb

24 lines
525 B
Ruby
Raw Normal View History

class ArchiveRepositoryService
attr_reader :project, :ref, :format
def initialize(project, ref, format)
format ||= 'tar.gz'
2015-03-24 08:24:35 -04:00
@project, @ref, @format = project, ref, format.downcase
end
2015-03-31 07:37:21 -04:00
def execute(options = {})
2015-10-16 12:39:17 -04:00
RepositoryArchiveCacheWorker.perform_async
metadata = project.repository.archive_metadata(ref, storage_path, format)
raise "Repository or ref not found" if metadata.empty?
metadata
end
private
def storage_path
Gitlab.config.gitlab.repository_downloads_path
end
end