forked from continuoustests/ContinuousTests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.rb
93 lines (80 loc) · 2.67 KB
/
version.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
if ARGV.length != 1
exit
end
version = ARGV[0]
def set_version(filepath, version)
lines = File.readlines(filepath)
.select {|line|
!line.start_with?("[assembly: AssemblyVersion(") &&
!line.start_with?("[assembly: AssemblyFileVersion(")
}
File.open(filepath, "w") { |file|
lines.each{|line| file.puts line}
file.puts "[assembly: AssemblyVersion(\"" + version + "\")]"
file.puts "[assembly: AssemblyFileVersion(\"" + version + "\")]"
}
end
def update_installer(filepath, version)
lines = File.readlines(filepath)
.map {|line|
modified = line
if line.start_with?("AppVersion=")
modified = "AppVersion=" + version
end
if line.start_with?("AppVerName=")
modified = "AppVerName=ContinuousTests " + version
end
if line.start_with?("OutputBaseFilename=")
modified = "OutputBaseFilename=ContinuousTests-v" + version
end
modified
}
File.open(filepath, "w") { |file|
lines.each{|line| file.puts line}
}
end
def update_download(filepath, version)
lines = File.readlines(filepath)
.map {|line|
modified = line
if line.include?(">Windows installer package (with Visual Studio integration)</a>")
modified = " <a href=\"ContinuousTests-v" + version + ".exe\">Windows installer package (with Visual Studio integration)</a><br><br>"
end
if line.include?(">Cross platform standalone client</a>")
modified = " <a href=\"ContinuousTests-Standalone-v" + version + ".zip\">Cross platform standalone client</a><br>"
end
modified
}
File.open(filepath, "w") { |file|
lines.each{|line| file.puts line}
}
end
def update_version_xml(filepath, version)
lines = File.readlines(filepath)
.map {|line|
modified = line
if line.include?("<version>")
modified = " <version>" + version + "</version>"
end
modified
}
File.open(filepath, "w") { |file|
lines.each{|line| file.puts line}
}
end
puts "Updateing Client"
set_version("src\\AutoTest.Client\\Properties\\AssemblyInfo.cs", version)
puts "Updateing Profiler"
set_version("src\\AutoTest.Profiler\\Properties\\AssemblyInfo.cs", version)
puts "Updateing VM"
set_version("src\\AutoTest.VM\\Properties\\AssemblyInfo.cs", version)
puts "Updateing VM Messages"
set_version("src\\AutoTest.VM.Messages\\Properties\\AssemblyInfo.cs", version)
puts "Updateing Minimizer"
set_version("src\\AutoTest.Minimizer\\Properties\\AssemblyInfo.cs", version)
puts "Updating Installer"
update_installer("Installer\\ATEInstaller.iss", version)
puts "Updating download.html"
update_download("www\\download.html", version)
puts "Updating version.xml"
update_version_xml("www\\version.xml", version)