Class: Gitlab::Release::Changelog::Generator

Inherits:
ApiClient
  • Object
show all
Defined in:
lib/gitlab/release/changelog/generator.rb

Overview

This class generates the changelog entries

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Generator

Returns a new instance of Generator.

Parameters:

  • [String] (Hash)

    a customizable set of options

  • [Integer] (Hash)

    a customizable set of options



19
20
21
22
23
# File 'lib/gitlab/release/changelog/generator.rb', line 19

def initialize(options = {})
  @max_loops_merge_requests = options[:max_loops_merge_requests] || 2000
  @max_loop_issues = options[:max_loop_issues] || 2000
  super(options)
end

Instance Method Details

#changelog(version_name, options = {}) ⇒ Entries

Generate the changelog.

Parameters:

  • version_name (String)

    Required. The name of the version. (ex: 1.0)

  • [String (Hash)

    a customizable set of options

  • [Boolean] (Hash)

    a customizable set of options

  • [Array[String]] (Hash)

    a customizable set of options

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/gitlab/release/changelog/generator.rb', line 37

def changelog(version_name, options = {})
  project_id = options[:project_id] || ENV["CI_PROJECT_ID"]
  include_mrs = options[:include_mrs] || true
  include_issues = options[:include_issues] || false
  filtering_mrs_labels = options[:filtering_mrs_labels] || options[:filtering_labels] || []
  filtering_issue_labels = options[:filtering_issues_labels] || options[:filtering_labels] || []

  entries = Entries.new
  if include_mrs
    changelog_from_merge_requests(entries,
                                  project_id,
                                  version_name,
                                  filtering_mrs_labels)
  end
  if include_issues
    changelog_from_issues(entries,
                          project_id,
                          version_name,
                          filtering_issue_labels)
  end
  entries
end