summaryrefslogtreecommitdiff
path: root/lib/gitlab/google_code_import/project_creator.rb
blob: 326cfcaa8af64c49cfcc398a4def2a64d37de662 (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
module Gitlab
  module GoogleCodeImport
    class ProjectCreator
      attr_reader :repo, :namespace, :current_user, :user_map

      def initialize(repo, namespace, current_user, user_map = nil)
        @repo = repo
        @namespace = namespace
        @current_user = current_user
        @user_map = user_map
      end

      def execute
        ::Projects::CreateService.new(
          current_user,
          name: repo.name,
          path: repo.name,
          description: repo.summary,
          namespace: namespace,
          creator: current_user,
          visibility_level: Gitlab::VisibilityLevel::PUBLIC,
          import_type: "google_code",
          import_source: repo.name,
          import_url: repo.import_url,
          import_data: { data: { 'repo' => repo.raw_data, 'user_map' => user_map } }
        ).execute
      end
    end
  end
end