Permalink
Browse files

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
  • Loading branch information...
kohsuke
kohsuke committed Apr 2, 2009
1 parent 8667c02 commit 3c34ccee6439766909bc782b45b606568cce288a
Showing with 22 additions and 32 deletions.
  1. +20 −28 rc.changelog.rb
  2. +2 −4 update.changelog.rb
View
@@ -1,4 +1,4 @@
-#!/bin/ruby
+#!/usr/bin/ruby
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
@@ -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
View
@@ -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
@@ -60,4 +58,4 @@ def to_s
next
end
puts line
-end
+end

0 comments on commit 3c34cce

Please sign in to comment.