summaryrefslogtreecommitdiff
path: root/lib/gitlab/import_export/project_creator.rb
blob: b8424cb97196a0b7cc2f18e9e8957ac0c4de14b6 (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 ImportExport
    class ProjectCreator

      def initialize(namespace_id, current_user, )
        @repo = repo
        @namespace = Namespace.find_by_id(namespace_id)
        @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