-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile.rb
59 lines (45 loc) · 1.21 KB
/
Rakefile.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
require 'versionomy'
require 'os'
DIR = File.dirname(__FILE__)
hotfix = ENV["hotfix"] || "1"
task :default => [:build]
task :build do
sh "dotnet build"
end
task :test do
sh "dotnet test"
end
desc "Run a version bump on assemblyinfo.cs"
task :version do
puts "versioning PostXING.MetaWeblogProxy..."
file_path = "#{DIR}/PostXING.MetaWeblogProxy.csproj"
pattern = /\d+\.\d+\.\d+\.\d+/
hotfix = ENV["hotfix"] || "1"
t = Time.now
major = (t.year - 1980) / 10
#major = major.floor + 1
d = t.strftime "%d"
y = t.year - (t.year - (t.year % 10)) #first year of the decade
f = File.read file_path
match = f.match pattern
version = match != nil ? Versionomy.parse(match[0]) : Versionomy.parse("1.#{y}.0.0")
day = version.tiny
#puts "day is #{day}"
if day == "#{t.month}#{d}".to_i then
hotfix = version.tiny2
puts "\r\nincrementing hotfix...original version is #{hotfix}"
hotfix += 1
end
version = "#{major}.#{y}.#{t.month}#{d}.#{hotfix}"
assembly_info = f.sub(pattern, "#{version}")
File.write(file_path, assembly_info)
puts "Done. Version is: #{version}"
end
desc "opens visual studio"
task :vs do
if OS.doze?
sh "start *.sln"
else
sh "open *.sln"
end
end