Class: MinaRevisioneer::GroupedChangeLog

Inherits:
MessageExtractor show all
Defined in:
lib/mina_revisioneer/grouped_change_log.rb

Overview

Uses the markers inside the commit message to generate change groups

can be configured by setting

:revisioneer_markers

must be a hash of GroupName => Marker

Instance Attribute Summary

Attributes inherited from MessageExtractor

#api_token, #binding, #host

Instance Method Summary collapse

Methods inherited from MessageExtractor

#initialize, #last_deploy, #last_deploy_date, #last_deploy_sha, #number_of_new_commits, #repo, #sha

Constructor Details

This class inherits a constructor from MinaRevisioneer::MessageExtractor

Instance Method Details

#messagesObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mina_revisioneer/grouped_change_log.rb', line 8

def messages
  groups = Hash.new

  walker = Rugged::Walker.new(repo)
  walker.push sha
  walker.hide last_deploy_sha if last_deploy_sha
  walker.each do |commit|
    revisioneer_markers.each do |marker, pattern|
      commit.message.lines.each do |line|
        if line =~ pattern
          (groups[marker] ||= []) << line.strip
        end
      end
    end
  end

  messages = []
  groups.each do |key, ms|
    messages << "#{key}:\n#{ms.join("\n")}"
  end
  messages
end

#revisioneer_markersObject



31
32
33
# File 'lib/mina_revisioneer/grouped_change_log.rb', line 31

def revisioneer_markers
  eval "revisioneer_markers", binding
end