debian-mirror-gitlab/app/services/archive_repository_service.rb

24 lines
525 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
class ArchiveRepositoryService
2015-04-26 12:48:37 +05:30
attr_reader :project, :ref, :format
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
def initialize(project, ref, format)
format ||= 'tar.gz'
@project, @ref, @format = project, ref, format.downcase
end
def execute(options = {})
2015-10-24 18:46:33 +05:30
RepositoryArchiveCacheWorker.perform_async
2015-04-26 12:48:37 +05:30
2015-10-24 18:46:33 +05:30
metadata = project.repository.archive_metadata(ref, storage_path, format)
raise "Repository or ref not found" if metadata.empty?
2015-04-26 12:48:37 +05:30
2015-10-24 18:46:33 +05:30
metadata
2015-04-26 12:48:37 +05:30
end
private
def storage_path
Gitlab.config.gitlab.repository_downloads_path
end
2014-09-02 18:07:02 +05:30
end