# and place the & help entry appropriately above the highest version
# level
#
+#
+class Array
+ def tabulate(rowwidth=80,spacing=8)
+ width = inject(0) { |m,i| [m,i.length].max } + spacing
+ cols = rowwidth / width
+ rows = [[]]
+ each { |i|
+ rows << [] if rows.last.size >= cols
+ rows.last << i
+ }
+ rows.map { |i| i.map { |j| j.ljust(width) }.join.strip }
+ end
+end
+
+
$cur_version = "0.00"
+entry_header = "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"
+
# Simple add changes to it
def chfname(filename)
end
end
+# Next Split our changes list into 2 seperate areas.. old & the new version schemes
+newversions = Array.new
+oldversions = Array.new
+ni = 0
+oi = 0
+changes_files.each do |file|
+ if FileTest.file?("changes/#{file}")
+ if /^\d.\d\d?[ab]?([p-]\d)?[ab]?$/ =~ file then
+ newversions[ni] = file
+ ni += 1
+ else
+ oldversions[oi] = file
+ oi += 1
+ end
+ end
+end
+newversions = newversions.sort.reverse
+oldversions = oldversions.sort.reverse
+
# Ok.. Nowe that we have cur_version.. Now we're gonna compile our master helpfile.
# Whenever we run across cur_version that is where we'll thrwo the & help
# entry right ontop
# Open our new changes.txt first
cfile = File.new("changes.txt", "w")
-changes_files.each do |file|
- if FileTest.file?(chfname(file))
- if $cur_version == file then
- cfile << "& help\n"
- end
- cfile << File.read(chfname(file))
+newversions.each do |file|
+ if $cur_version == file then
+ cfile << "& help\n"
end
+ cfile << File.read(chfname(file))
end
+oldversions.each do |file|
+ cfile << File.read(chfname(file))
+end
+
+# close the file.. so.. we may reloop through this & build our entries ending thingie
cfile.close
+
+# Now we're gonna reopen the changes file in append and read mode to add our entries
+# entry
+changes = File.open("changes.txt", "a+")
+i = -1
+entries = Array.new
+
+
+changes.each_line do |cur_line|
+ if i == -1
+ i = 0
+ # This is where we open a new file.. a
+ elsif cur_line[0,1] == "&"
+ curname = String.new(cur_line)
+ curname[0] = " "
+ curname = curname.strip
+ entries[i] = curname
+ i += 1
+ end
+end
+
+changes << "& Entries\n"
+changes << entry_header
+line = 0
+page = 1
+entries.tabulate.each do |entry|
+ line += 1
+ if line == 9 then
+ page += 1
+ changes << "\n"
+ changes << "More changes entries listed in entries#{page}".center(80)
+ changes << "\n"
+ changes << entry_header
+ changes << "& Entries#{page}\n"
+ changes << entry_header
+ line = 0
+ end
+ changes << "#{entry}\n"
+end
+
+changes << entry_header
+changes.close