Parent

Namespace

Files

POM::History

History File

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.

Constants

DEFAULT_FILE

File glob for finding the HISTORY file.

HEADER_RE

Match against version number string.

Attributes

file[R]

HISTORY file’s pathname.

releases[R]

List of release entries.

Public Class Methods

find(root) click to toggle source
# File lib/pom/history.rb, line 38
def self.find(root)
  root = Pathname.new(root)
  root.glob(DEFAULT_FILE, :casefold).first
end
new(root, opts={}) click to toggle source

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

Public Instance Methods

read() click to toggle source

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
release() click to toggle source

Returns first entry in releases list.

# File lib/pom/history.rb, line 78
def release
   releases.first
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.