mirror of https://github.com/jenkinsci/jenkins.git
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:
parent
8667c02cf9
commit
3c34ccee64
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -60,4 +58,4 @@ ARGF.each do |line|
|
|||
next
|
||||
end
|
||||
puts line
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue