Class: Packages::Go::SyncPackagesService

Inherits:
BaseService show all
Includes:
Gitlab::Golang
Defined in:
app/services/packages/go/sync_packages_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from Gitlab::Golang

#go_path, #local_module_prefix, #package_url, #parse_pseudo_version, #parse_semver, #pkg_go_dev_url, #pseudo_version?, #semver_tag?, #validate_pseudo_version

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(project, ref, path = '') ⇒ SyncPackagesService

Returns a new instance of SyncPackagesService.

Raises:

  • (ArgumentError)

8
9
10
11
12
13
14
15
16
17
# File 'app/services/packages/go/sync_packages_service.rb', line 8

def initialize(project, ref, path = '')
  super(project)

  @ref = ref
  @path = path

  raise ArgumentError, 'project is required' unless project
  raise ArgumentError, 'ref is required' unless ref
  raise ArgumentError, "ref #{ref} not found" unless project.repository.find_tag(ref) || project.repository.find_branch(ref)
end

Instance Method Details

#execute_asyncObject


19
20
21
# File 'app/services/packages/go/sync_packages_service.rb', line 19

def execute_async
  Packages::Go::SyncPackagesWorker.perform_async(project.id, @ref, @path)
end