class CommitChangelog
Filters commit messages for changelog entries.
Attributes
changelog[R]
Contains changelog entries of the commits.
Public Class Methods
new(to_commit, from_commit)
click to toggle source
Instantiates an object containing changelog entries between two git commits.
@param [String] to_commit
Most recent commit whose changelog lines to include. @param [String] from_commit Earlier commit whose changelog lines will _not_ be included. @return [Array] Array of changelog lines, or nil if none were found.
# File lib/commit_changelog.rb, line 34 def initialize(to_commit, from_commit) pattern = ChangelogFilter.pattern messages = Git.get_filtered_messages(from_commit, to_commit, pattern) filter = ChangelogFilter.FromString(messages) @changelog = filter.changelog end
Public Instance Methods
add_commit(commit)
click to toggle source
Adds changelog information contained in a specific commit message. This method is typically used to parse the initial commit's commit message.
@param [String] commit
Sha-1 of the commit whose commit message to filter for changelog lines.
@return
Undefined
# File lib/commit_changelog.rb, line 50 def add_commit(commit) pattern = ChangelogFilter.pattern filtered_text = Git.get_filtered_message(commit, pattern) if filtered_text filtered_lines = filtered_text.split("\n").uniq if @changelog @changelog = @changelog.concat(filtered_lines).uniq else @changelog = filtered_lines end end end