Class: UpdateReleaseService

Inherits:
BaseService show all
Defined in:
app/services/update_release_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#abilities, #can?, #deny_visibility_level, #event_service, #initialize, #log_info, #notification_service, #repository, #system_hook_service, #todo_service

Methods included from Gitlab::CurrentSettings

#current_application_settings, #fake_application_settings

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#execute(tag_name, release_description) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/services/update_release_service.rb', line 4

def execute(tag_name, release_description)

  repository = project.repository
  existing_tag = repository.find_tag(tag_name)

  if existing_tag
    release = project.releases.find_by(tag: tag_name)

    if release
      release.update_attributes(description: release_description)

      success(release)
    else
      error('Release does not exist', 404)
    end
  else
    error('Tag does not exist', 404)
  end
end

#success(release) ⇒ Object


24
25
26
27
28
# File 'app/services/update_release_service.rb', line 24

def success(release)
  out = super()
  out[:release] = release
  out
end