completed the script to manipulate changelog.html

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@16783 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke 2009-04-02 02:20:31 +00:00
parent 8667c02cf9
commit 3c34ccee64
2 changed files with 22 additions and 32 deletions

View File

@ -1,4 +1,4 @@
#!/bin/ruby
#!/usr/bin/ruby
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
@ -22,41 +22,33 @@
# THE SOFTWARE.
# Updates changelog.html
# Usage: update.changelog.rb <nextVer> < changelog.html > output.html
# version number manipulation class
class VersionNumber
def initialize(str)
@tokens = str.split(/\./)
end
def inc
@tokens[-1] = (@tokens[-1].to_i()+1).to_s()
end
def dec
@tokens[-1] = (@tokens[-1].to_i()-1).to_s()
end
def to_s
@tokens.join(".")
end
end
id=VersionNumber.new(ARGV.shift)
id.inc()
# Moves the changelog from the trunk section to the release section
# Usage: rc.changelog.rb < changelog.html > output.html
changelog = []
inside = false;
ARGF.each do |line|
if /=BEGIN=/ =~ line
if /=TRUNK-BEGIN=/ =~ line
inside = true;
puts line
puts "<a name=v#{id}><h3>What's new in #{id}</h3></a>"
# new template
puts "<ul class=image>"
puts " <li class=>"
puts "</ul>"
puts "</div><!--=END=-->"
next
end
if /=END=/ =~ line
if /=TRUNK-END=/ =~ line
inside = false;
puts line
next
end
if inside
changelog << line
next
end
if /=RC-CHANGES=/ =~ line
changelog.each { |line| puts line }
next
end
puts line

View File

@ -49,9 +49,7 @@ ARGF.each do |line|
if /=BEGIN=/ =~ line
puts line
puts "<a name=v#{id}><h3>What's new in #{id}</h3></a>"
puts "<ul class=image>"
puts " <li class=>"
puts "</ul>"
puts "<!--=RC-CHANGES=-->"
puts "</div><!--=END=-->"
next