5 # Get the version string
10 eval IO.read("Version")
16 d = sprintf("%04d%02d%02d", year, month, day)
18 File.open("Version", "w") { |fp|
19 fp.print "version = \"#{version}\"\n"
20 fp.print "date = \"#{d}\"\n"
23 verstr = "v#{ver} #{build}"
24 yrange = (year > 2008 ? "2008-#{year}" : "2008")
26 def modify_file(name, &block)
27 ary = IO.readlines(name)
29 ary.each_with_index { |s, i|
37 File.rename(name, name + "~")
38 open(name, "wb") { |fp|
39 ary.each { |s| fp.write(s) }
45 nm = "xcode-build/Info.plist"
50 "\t<string>#{verstr}</string>\n"
52 version = (s =~ /\bCFBundleVersion\b/)
57 # Modify InfoPlist.strings
58 Dir["xcode-build/*.lproj/InfoPlist.strings"].each { |nm|
60 s = s.kconv(Kconv::UTF8, Kconv::UTF16)
61 if s =~ /Copyright/ && s.sub!(/Toshi Nagata, [-0-9]+/, "Toshi Nagata, #{yrange}")
62 s = s.kconv(Kconv::UTF16, Kconv::UTF8)
70 modify_file("msw-build/molby.iss") { |s|
71 if s =~ /AppVerName/ && s.sub!(/\(.*\)*/, "(#{verstr})")
79 modify_file("wxSources/MyVersion.c") { |s|
80 if s =~ /Version/ && s.sub!(/\".*\"/, "\"#{verstr}\"")
87 # Modify doc_source.html
88 modify_file("Documents/src/doc_source.html") { |s|
89 if s =~ /Version/ && s.sub!(/[Vv][-.0-9 A-Za-z_]*/, "Version #{ver} #{build}")