Module: ReleaseNotes Private

Extended by:
T::Sig
Defined in:
brew/Library/Homebrew/release_notes.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Helper functions for generating release notes.

Class Method Summary collapse

Class Method Details

.generate_release_notes(start_ref, end_ref, markdown: false) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Returns:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'brew/Library/Homebrew/release_notes.rb', line 16

def generate_release_notes(start_ref, end_ref, markdown: false)
  log_output = Utils.popen_read(
    "git", "-C", HOMEBREW_REPOSITORY, "log", "--pretty=format:'%s >> - %b%n'", "#{start_ref}..#{end_ref}"
  ).lines.grep(/Merge pull request/)

  log_output.map! do |s|
    s.gsub(%r{.*Merge pull request #(\d+) from ([^/]+)/[^>]*(>>)*},
           "https://github.com/Homebrew/brew/pull/\\1 (@\\2)")
  end

  if markdown
    log_output.map! do |s|
      /(.*\d)+ \(@(.+)\) - (.*)/ =~ s
      "- [#{Regexp.last_match(3)}](#{Regexp.last_match(1)}) (@#{Regexp.last_match(2)})\n"
    end
  end

  log_output.join
end