Skip to content

Commit

Permalink
completed the script to manipulate changelog.html
Browse files Browse the repository at this point in the history
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@16783 71c3de6d-444a-0410-be80-ed276b4c234a
  • Loading branch information
kohsuke committed Apr 2, 2009
1 parent 8667c02 commit 3c34cce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 32 deletions.
48 changes: 20 additions & 28 deletions rc.changelog.rb
@@ -1,4 +1,4 @@
#!/bin/ruby
#!/usr/bin/ruby
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Expand All @@ -22,42 +22,34 @@
# 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
end
end
6 changes: 2 additions & 4 deletions update.changelog.rb
Expand Up @@ -49,9 +49,7 @@ def to_s
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
Expand All @@ -60,4 +58,4 @@ def to_s
next
end
puts line
end
end

0 comments on commit 3c34cce

Please sign in to comment.