class Omnibus::ChangeLog
Constants
- CHANGELOG_TAG
Attributes
end_ref[R]
git_repo[R]
Public Class Methods
new(start_ref = nil, end_ref = "HEAD", git_repo = GitRepository.new("./"))
click to toggle source
# File lib/omnibus/changelog.rb, line 8 def initialize(start_ref = nil, end_ref = "HEAD", git_repo = GitRepository.new("./")) @start_ref = start_ref @end_ref = end_ref @git_repo = git_repo end
Public Instance Methods
changelog_entries()
click to toggle source
# File lib/omnibus/changelog.rb, line 18 def changelog_entries entries = [] current_entry = [] git_repo.commit_messages(start_ref, end_ref).each do |l| if blank?(l) entries << current_entry current_entry = [] elsif tagged?(l) entries << current_entry current_entry = Array(l.sub(/^#{CHANGELOG_TAG}:[\s]*/, "")) elsif !current_entry.empty? current_entry << l end end entries << current_entry entries.reject(&:empty?).map(&:join) end
start_ref()
click to toggle source
# File lib/omnibus/changelog.rb, line 36 def start_ref @start_ref ||= git_repo.latest_tag end
Private Instance Methods
blank?(line)
click to toggle source
# File lib/omnibus/changelog.rb, line 44 def blank?(line) line =~ /^[\s]*$/ end
tagged?(line)
click to toggle source
# File lib/omnibus/changelog.rb, line 48 def tagged?(line) line =~ /^#{CHANGELOG_TAG}:/ end