forked from HicServices/FAnsiSql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rakefile.rb
79 lines (64 loc) · 2.67 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
load 'rakeconfig.rb'
$MSBUILD15CMD = MSBUILD15CMD.gsub(/\\/,"/")
task :continuous, [:config] => [:setup_connection, :assemblyinfo, :build, :tests]
task :release, [:config] => [:setup_connection, :assemblyinfo, :build_release, :pack]
task :restorepackages do
sh "nuget restore #{SOLUTION}"
end
task :setup_connection do
File.open("Tests/FAnsiTests/TestDatabases.xml", "w") do |f|
f.write("<TestDatabases>
<Settings>
<AllowDatabaseCreation>True</AllowDatabaseCreation>
<TestScratchDatabase>FAnsiTests</TestScratchDatabase>
</Settings>
<TestDatabase>
<DatabaseType>MicrosoftSQLServer</DatabaseType>
<ConnectionString>server=#{DBSERVER};Trusted_Connection=True;</ConnectionString>
</TestDatabase>
<TestDatabase>
<DatabaseType>MySql</DatabaseType>
<ConnectionString>Server=#{MYSQLDB};Uid=#{MYSQLUSR};Pwd=#{MYSQLPASS};Ssl-Mode=Required</ConnectionString>
</TestDatabase>
<!--<TestDatabase>
<DatabaseType>Oracle</DatabaseType>
<ConnectionString>Data Source=localhost:1521/orclpdb.dundee.uni;User Id=ora;Password=zombie;</ConnectionString>
</TestDatabase>-->
</TestDatabases>")
end
end
task :build, [:config] => :restorepackages do |msb, args|
sh "\"#{$MSBUILD15CMD}\" #{SOLUTION} \/t:Clean;Build \/p:Configuration=#{args.config}"
end
task :tests do
sh 'dotnet test --logger:"nunit;LogFilePath=test-result.xml"'
end
task :build_release => :restorepackages do
sh "\"#{$MSBUILD15CMD}\" #{SOLUTION} \/t:Clean;Build \/p:Configuration=Release"
end
desc "Sets the version number from GIT"
task :assemblyinfo do |asm|
asminfoversion = File.read("SharedAssemblyInfo.cs").match(/AssemblyInformationalVersion\("(\d+)\.(\d+)\.(\d+)(-.*)?"/)
puts asminfoversion.inspect
major = asminfoversion[1]
minor = asminfoversion[2]
patch = asminfoversion[3]
suffix = asminfoversion[4]
version = "#{major}.#{minor}.#{patch}"
puts "version: #{version}#{suffix}"
# DO NOT REMOVE! needed by build script!
f = File.new('version', 'w')
f.write "#{version}#{suffix}"
f.close
# ----
end
desc "Pushes the plugin packages into the specified folder"
task :pack, [:config] do |t, args|
args.with_defaults(:config => :Release)
version = File.open('version') {|f| f.readline}
puts "version: #{version}"
Dir.chdir('NuGet') do
sh "nuget pack Fansi.NuGet.nuspec -Properties Configuration=#{args.config} -IncludeReferencedProjects -Symbols -Version #{version}"
sh "nuget push HIC.FansiSql.#{version}.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey #{NUGETKEY}"
end
end