class VMLib::Source

This is the class for updating source files with the new version

Public Class Methods

new(vformat = '"%M.%m.%p%r%b"', dir = nil) click to toggle source

Set up the tree to find the root of the source repository

# File lib/vmlib/source.rb, line 16
def initialize(vformat = '"%M.%m.%p%r%b"', dir = nil)
  # Find the primary version file and get the root path
  version = File.new.find_file(dir)
  root = ::File.dirname(version)

  # Find all files below the root which have the filename
  # beginning with 'version'
  @files = ::Dir.glob("#{root}/**/version*")
  @files.delete_if {|f| ! ::File.file? f }

  # Read the primary version file and get the version string from it
  verdata = ::File.read(version)
  v = Version.new
  v.parse verdata
  @verstring = v.format vformat
end

Public Instance Methods

update() click to toggle source

Update all the source files containing the version

# File lib/vmlib/source.rb, line 58
def update
  @files.each {|f| update_file(f) }
end