Sha256: c0aa624a0671d7294bbc541bfb56b3db11cb82e7469d10be2149fd555a9cde96
Contents?: true
Size: 989 Bytes
Versions: 2
Compression:
Stored size: 989 Bytes
Contents
# frozen_string_literal: true require 'gitlab' require 'uri' require_relative 'performers/gitlab_repository' module BackupRepos class BackupGitlabEndpoint DEFAULT_ENDPOINT = 'https://gitlab.com/api/v4' attr_reader :endpoint, :private_token def initialize(settings) @endpoint = settings.endpoint || DEFAULT_ENDPOINT @private_token = settings.private_token end def call backup_repositories end def repos @repos ||= client.projects(membership: true).auto_paginate end def client @client ||= ::Gitlab.client( private_token: private_token, endpoint: endpoint ) end def endpoint_host @endpoint_host ||= URI.parse(endpoint).host end private def backup_repositories repos.each do |repo_params| performer = Performers::GitlabRepository.new( repo_params, endpoint_host: endpoint_host ) performer.backup end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
backup_repos-0.5.0 | lib/backup_repos/backup_gitlab_endpoint.rb |
backup_repos-0.4.0 | lib/backup_repos/backup_gitlab_endpoint.rb |