Class: Gitlab::GitoriousImport::ProjectCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/gitorious_import/project_creator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo, namespace, current_user) ⇒ ProjectCreator


6
7
8
9
10
# File 'lib/gitlab/gitorious_import/project_creator.rb', line 6

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

Instance Attribute Details

#current_userObject (readonly)

Returns the value of attribute current_user


4
5
6
# File 'lib/gitlab/gitorious_import/project_creator.rb', line 4

def current_user
  @current_user
end

#namespaceObject (readonly)

Returns the value of attribute namespace


4
5
6
# File 'lib/gitlab/gitorious_import/project_creator.rb', line 4

def namespace
  @namespace
end

#repoObject (readonly)

Returns the value of attribute repo


4
5
6
# File 'lib/gitlab/gitorious_import/project_creator.rb', line 4

def repo
  @repo
end

Instance Method Details

#executeObject


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gitlab/gitorious_import/project_creator.rb', line 12

def execute
  ::Projects::CreateService.new(
    current_user,
    name: repo.name,
    path: repo.path,
    description: repo.description,
    namespace_id: namespace.id,
    visibility_level: Gitlab::VisibilityLevel::PUBLIC,
    import_type: "gitorious",
    import_source: repo.full_name,
    import_url: repo.import_url
  ).execute
end