summaryrefslogtreecommitdiff
path: root/lib/gitlab/gitorious_import/repository.rb
blob: c88f1ae358d1ce61b9ea95c84707577ad1c458ac (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
30
31
32
33
34
35
module Gitlab
  module GitoriousImport
    Repository = Struct.new(:full_name) do
      def id
        Digest::SHA1.hexdigest(full_name)
      end

      def namespace
        segments.first
      end

      def path
        segments.last
      end

      def name
        path.titleize
      end

      def description
        ""
      end

      def import_url
        "#{GITORIOUS_HOST}/#{full_name}.git"
      end

      private

      def segments
        full_name.split('/')
      end
    end
  end
end