Class: Projects::ImportExport::ExportService

Inherits:
BaseService
  • Object
show all
Includes:
Measurable
Defined in:
app/services/projects/import_export/export_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from Gitlab::Utils::Override

#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(*args) ⇒ ExportService

Returns a new instance of ExportService.


8
9
10
11
12
13
# File 'app/services/projects/import_export/export_service.rb', line 8

def initialize(*args)
  super

  @shared = project.import_export_shared
  @logger = Gitlab::Export::Logger.build
end

Instance Method Details

#execute(after_export_strategy = nil) ⇒ Object


15
16
17
18
19
20
21
22
23
24
# File 'app/services/projects/import_export/export_service.rb', line 15

def execute(after_export_strategy = nil)
  unless project.template_source? || can?(current_user, :admin_project, project)
    raise ::Gitlab::ImportExport::Error.permission_error(current_user, project)
  end

  save_all!
  execute_after_export_action(after_export_strategy)
ensure
  cleanup
end

#exportersObject


26
27
28
29
30
31
# File 'app/services/projects/import_export/export_service.rb', line 26

def exporters
  [
    version_saver, avatar_saver, project_tree_saver, uploads_saver,
    repo_saver, wiki_repo_saver, lfs_saver, snippets_repo_saver, design_repo_saver
  ]
end