Module: Albacore::Tools

Defined in:
lib/albacore/tools.rb,
lib/albacore/tools/fluent_migrator.rb,
lib/albacore/tools/restore_hint_paths.rb

Defined Under Namespace

Modules: FluentMigrator, RestoreHintPaths Classes: MatchedRef

Class Method Summary collapse

Class Method Details

.git_release_notesObject

Try to get the release notes from git, but looking at the commit messages



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/albacore/tools.rb', line 7

def self.git_release_notes
  tags = `git tag`.split(/\n/).
            map { |tag| [ ::XSemVer::SemVer.parse_rubygems(tag), tag ] }.
            sort { |a, b| a <=> b }.
            map { |_, tag| tag }
  last_tag = tags[-1]
  # second_last_tag = tags[-2] || `git rev-list --max-parents=0 HEAD`
  # logs = `git log --pretty=format:%s #{second_last_tag}..`.split(/\n/)
  logs = `git log --pretty=format:%s #{last_tag}..`.encode!('UTF-8').split(/\n/)
  "Release Notes:
#{logs.inject('') { |state, line| state + "\n * #{line}" }}"
end