The History class parses a HISTORY file into individual release sections. The file is expected to be in RDoc or simple Mardkdown format with each section beginning with a secondary header (== or ##) giving version and date of release, then a note followed by a point by point outline of changes.
For example:
== 1.0.0 / 2009-10-07 Say something about this version. Changes: * outline oimportant changelog items
Changes: is used as a parsing marker. While optional, it helps the parser find the list of changes, rather than looking for an asterisk or digit, so that ordered and unordered lists can be used in the note section too.
TODO: Deal with ChangeLog like formats? Perhaps just make extendable to handle custom formats.
File glob for finding the HISTORY file.
Match against version number string.
# File lib/pom/history.rb, line 38 def self.find(root) root = Pathname.new(root) root.glob(DEFAULT_FILE, :casefold).first end
New History.
# File lib/pom/history.rb, line 50 def initialize(root, opts={}) @root = Pathname.new(root) @file = opts[:file] || self.class.find(root) read end
Read and parse the Histoy file.
# File lib/pom/history.rb, line 60 def read @releases = [] entry = nil if file file.readlines.each do |line| if HEADER_RE =~ line @releases << Release.new(entry) if entry entry = line else next unless entry entry << line end end @releases << Release.new(entry) end end
Generated with the Darkfish Rdoc Generator 2.