Class: Projects::GitlabProjectsImportService

Inherits:
Object
  • Object
show all
Includes:
Gitlab::TemplateHelper, Gitlab::Utils::StrongMemoize
Defined in:
app/services/projects/gitlab_projects_import_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::TemplateHelper

#prepare_template_environment, #tmp_filename

Constructor Details

#initialize(user, import_params, override_params = nil, import_type:) ⇒ GitlabProjectsImportService

Returns a new instance of GitlabProjectsImportService.

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
20
# File 'app/services/projects/gitlab_projects_import_service.rb', line 13

def initialize(user, import_params, override_params = nil, import_type:)
  @current_user = user
  @params = import_params.dup
  @override_params = override_params
  @import_type = import_type.to_s

  raise ArgumentError, 'Invalid import_type provided' unless valid_import_type?
end

Instance Attribute Details

#current_userObject (readonly)

Returns the value of attribute current_user.



11
12
13
# File 'app/services/projects/gitlab_projects_import_service.rb', line 11

def current_user
  @current_user
end

#paramsObject (readonly)

Returns the value of attribute params.



11
12
13
# File 'app/services/projects/gitlab_projects_import_service.rb', line 11

def params
  @params
end

Instance Method Details

#executeObject



22
23
24
25
26
27
28
# File 'app/services/projects/gitlab_projects_import_service.rb', line 22

def execute
  prepare_template_environment(template_file, current_user)

  prepare_import_params

  ::Projects::CreateService.new(current_user, params).execute
end