project_creator.rb 693 Bytes
Newer Older
Marcin Kulik's avatar
Marcin Kulik committed
1 2 3 4 5 6 7 8 9 10 11 12
module Gitlab
  module GitoriousImport
    class ProjectCreator
      attr_reader :repo, :namespace, :current_user

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

      def execute
13
        ::Projects::CreateService.new(current_user,
Marcin Kulik's avatar
Marcin Kulik committed
14 15 16
          name: repo.name,
          path: repo.path,
          description: repo.description,
17
          namespace_id: namespace.id,
Marcin Kulik's avatar
Marcin Kulik committed
18 19 20 21
          visibility_level: Gitlab::VisibilityLevel::PUBLIC,
          import_type: "gitorious",
          import_source: repo.full_name,
          import_url: repo.import_url
22
        ).execute
Marcin Kulik's avatar
Marcin Kulik committed
23 24 25 26
      end
    end
  end
end