class PrChangelog::NotReleasedChanges

Calculates a list of not released changes from `base_ref` to `current_ref` those changes consist of the merged pull-request title

Attributes

commits_strategy[R]

Public Class Methods

new(commits_strategy) click to toggle source
# File lib/pr_changelog/not_released_changes.rb, line 9
def initialize(commits_strategy)
  @commits_strategy = commits_strategy
end

Public Instance Methods

emoji_tags() click to toggle source
# File lib/pr_changelog/not_released_changes.rb, line 13
def emoji_tags
  tags = {}

  PrChangelog.config.tags.each_with_index do |item, index|
    tags[item[:prefix]] = Tag.new(item[:emoji], item[:title], index)
  end

  tags
end
formatted_changelog() click to toggle source
# File lib/pr_changelog/not_released_changes.rb, line 23
def formatted_changelog
  if parsed_change_list.count.positive?
    parsed_change_list.map(&:to_s).join("\n")
  else
    no_changes_found
  end
end
grouped_formatted_changelog() click to toggle source
# File lib/pr_changelog/not_released_changes.rb, line 31
def grouped_formatted_changelog
  if parsed_change_list.count.positive?
    GroupedChanges.new(parsed_change_list, emoji_tags).to_s
  else
    no_changes_found
  end
end

Private Instance Methods

no_changes_found() click to toggle source
# File lib/pr_changelog/not_released_changes.rb, line 41
def no_changes_found
  'No changes found'
end
parsed_change_list() click to toggle source
# File lib/pr_changelog/not_released_changes.rb, line 45
def parsed_change_list
  @parsed_change_list ||= commits_strategy.parsed_commits.map do |commit_info|
    commits_strategy.format_commit(commit_info)
  end
end