Welcome to mirror list, hosted at ThFree Co, Russian Federation.

client.rb « gitorious_import « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 99fe5bdebfcf1a4cdf26b59373ee9a606bc62c19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Gitlab
  module GitoriousImport
    class Client
      attr_reader :repo_list

      def initialize(repo_list)
        @repo_list = repo_list
      end

      def authorize_url(redirect_uri)
        "#{GITORIOUS_HOST}/gitlab-import?callback_url=#{redirect_uri}"
      end

      def repos
        @repos ||= repo_names.map { |full_name| GitoriousImport::Repository.new(full_name) }
      end

      def repo(id)
        repos.find { |repo| repo.id == id }
      end

      private

      def repo_names
        repo_list.to_s.split(',').map(&:strip).reject(&:blank?)
      end
    end
  end
end