Welcome to mirror list, hosted at ThFree Co, Russian Federation.

release_formatter.rb « legacy_github_import « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2a54a15429b63f73b531a22593c92cb693cf7ab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

module Gitlab
  module LegacyGithubImport
    class ReleaseFormatter < BaseFormatter
      def attributes
        {
          project: project,
          tag: raw_data[:tag_name],
          name: raw_data[:name],
          description: raw_data[:body],
          created_at: raw_data[:created_at],
          # Draft releases will have a null published_at
          released_at: raw_data[:published_at] || Time.current,
          updated_at: raw_data[:created_at]
        }
      end

      def project_association
        :releases
      end

      def find_condition
        { tag: raw_data[:tag_name] }
      end

      def valid?
        !raw_data[:draft] && raw_data[:tag_name].present?
      end
    end
  end
end