debian-mirror-gitlab/app/services/update_release_service.rb

29 lines
665 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2015-11-26 14:37:03 +05:30
class UpdateReleaseService < BaseService
2018-12-05 23:21:45 +05:30
# rubocop: disable CodeReuse/ActiveRecord
2015-11-26 14:37:03 +05:30
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
2018-11-18 11:00:15 +05:30
release.update(description: release_description)
2015-11-26 14:37:03 +05:30
success(release)
else
error('Release does not exist', 404)
end
else
error('Tag does not exist', 404)
end
end
2018-12-05 23:21:45 +05:30
# rubocop: enable CodeReuse/ActiveRecord
2015-11-26 14:37:03 +05:30
def success(release)
2016-08-24 12:49:21 +05:30
super().merge(release: release)
2015-11-26 14:37:03 +05:30
end
end