Skip to content

Commit 3c34cce

Browse files
author
kohsuke
committedApr 2, 2009
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
1 parent 8667c02 commit 3c34cce

File tree

2 files changed

+22
-32
lines changed

2 files changed

+22
-32
lines changed
 

‎rc.changelog.rb

+20-28
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/ruby
1+
#!/usr/bin/ruby
22
# The MIT License
33
#
44
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
@@ -22,42 +22,34 @@
2222
# THE SOFTWARE.
2323

2424

25-
# Updates changelog.html
26-
# Usage: update.changelog.rb <nextVer> < changelog.html > output.html
27-
28-
# version number manipulation class
29-
class VersionNumber
30-
def initialize(str)
31-
@tokens = str.split(/\./)
32-
end
33-
def inc
34-
@tokens[-1] = (@tokens[-1].to_i()+1).to_s()
35-
end
36-
def dec
37-
@tokens[-1] = (@tokens[-1].to_i()-1).to_s()
38-
end
39-
def to_s
40-
@tokens.join(".")
41-
end
42-
end
43-
44-
id=VersionNumber.new(ARGV.shift)
45-
id.inc()
25+
# Moves the changelog from the trunk section to the release section
26+
# Usage: rc.changelog.rb < changelog.html > output.html
4627

28+
changelog = []
29+
inside = false;
4730

4831
ARGF.each do |line|
49-
if /=BEGIN=/ =~ line
32+
if /=TRUNK-BEGIN=/ =~ line
33+
inside = true;
5034
puts line
51-
puts "<a name=v#{id}><h3>What's new in #{id}</h3></a>"
35+
# new template
5236
puts "<ul class=image>"
5337
puts " <li class=>"
5438
puts "</ul>"
55-
puts "</div><!--=END=-->"
56-
5739
next
5840
end
59-
if /=END=/ =~ line
41+
if /=TRUNK-END=/ =~ line
42+
inside = false;
43+
puts line
44+
next
45+
end
46+
if inside
47+
changelog << line
48+
next
49+
end
50+
if /=RC-CHANGES=/ =~ line
51+
changelog.each { |line| puts line }
6052
next
6153
end
6254
puts line
63-
end
55+
end

‎update.changelog.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ def to_s
4949
if /=BEGIN=/ =~ line
5050
puts line
5151
puts "<a name=v#{id}><h3>What's new in #{id}</h3></a>"
52-
puts "<ul class=image>"
53-
puts " <li class=>"
54-
puts "</ul>"
52+
puts "<!--=RC-CHANGES=-->"
5553
puts "</div><!--=END=-->"
5654

5755
next
@@ -60,4 +58,4 @@ def to_s
6058
next
6159
end
6260
puts line
63-
end
61+
end

0 commit comments

Comments
 (0)
Please sign in to comment.