BigW Consortium Gitlab

project_creator.rb 867 Bytes
Newer Older
1 2 3
module Gitlab
  module GoogleCodeImport
    class ProjectCreator
4
      attr_reader :repo, :namespace, :current_user, :user_map
5

6
      def initialize(repo, namespace, current_user, user_map = nil)
7 8 9
        @repo = repo
        @namespace = namespace
        @current_user = current_user
10
        @user_map = user_map
11 12 13
      end

      def execute
14
        ::Projects::CreateService.new(
15
          current_user,
16 17 18 19 20 21 22 23
          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,
24 25
          import_url: repo.import_url,
          import_data: { data: { 'repo' => repo.raw_data, 'user_map' => user_map } }
26
        ).execute
27 28 29 30
      end
    end
  end
end