2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-29 09:46:39 +05:30
|
|
|
module Gitlab
|
2018-03-17 18:26:18 +05:30
|
|
|
module LegacyGithubImport
|
2016-09-29 09:46:39 +05:30
|
|
|
class ReleaseFormatter < BaseFormatter
|
|
|
|
def attributes
|
|
|
|
{
|
|
|
|
project: project,
|
|
|
|
tag: raw_data.tag_name,
|
2019-07-31 22:56:46 +05:30
|
|
|
name: raw_data.name,
|
2016-09-29 09:46:39 +05:30
|
|
|
description: raw_data.body,
|
|
|
|
created_at: raw_data.created_at,
|
2019-12-21 20:55:43 +05:30
|
|
|
# Draft releases will have a null published_at
|
|
|
|
released_at: raw_data.published_at || Time.current,
|
2016-09-29 09:46:39 +05:30
|
|
|
updated_at: raw_data.created_at
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
def project_association
|
|
|
|
:releases
|
|
|
|
end
|
|
|
|
|
|
|
|
def find_condition
|
|
|
|
{ tag: raw_data.tag_name }
|
2016-09-29 09:46:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def valid?
|
|
|
|
!raw_data.draft
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|