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}"
25 yrange = (year > 2008 ? "2008-#{year}" : "2008")
27 def modify_file(name, &block)
28 ary = IO.readlines(name) rescue return
30 ary.each_with_index { |s, i|
31 s1 = block.call(s.dup)
38 File.rename(name, name + "~")
39 open(name, "wb") { |fp|
40 ary.each { |s| fp.write(s) }
42 File.delete(name + "~")
47 nm = "xcode-build/Info.plist"
52 "\t<string>#{verstr}</string>\n"
54 version = (s =~ /\bCFBundleVersion\b/)
59 # Modify InfoPlist.strings
60 Dir["xcode-build/*.lproj/InfoPlist.strings"].each { |nm|
62 s = s.kconv(Kconv::UTF8, Kconv::UTF16)
63 if s =~ /Copyright/ && s.sub!(/Toshi Nagata, [-0-9]+/, "Toshi Nagata, #{yrange}")
64 s = s.kconv(Kconv::UTF16, Kconv::UTF8)
72 modify_file("msw-build/molby.iss") { |s|
73 if s =~ /AppVerName/ && s.sub!(/\(.*\)*/, "(#{verstr})")
81 modify_file("wxSources/MyVersion.c") { |s|
82 if s =~ /Version/ && s.sub!(/\".*\"/, "\"#{verstr}\"")
84 elsif s =~ /Copyright/ && s =~ /Toshi Nagata/ && s.sub!(/\d\d\d\d(-\d\d\d\d)?/, yrange)
91 # Modify doc_source.html
92 modify_file("Documents/src/doc_source.html") { |s|
93 if s =~ /Version/ && s =~ /<!-- version -->/ && s.sub!(/[Vv][-.0-9 A-Za-z_]*/, "Version #{ver}")
95 elsif s =~ /<!-- copyright -->/ && s.sub!(/\d\d\d\d(-\d\d\d\d)?/, yrange)
103 modify_file("README") { |s|
104 if s =~ / Version/ && s.sub!(/[Vv][-.0-9 A-Za-z_]*/, "Version #{ver}")
106 elsif s =~ / Copyright/ && s =~ /Toshi Nagata/ && s.sub!(/\d\d\d\d(-\d\d\d\d)?/, yrange)