This repository has been archived by the owner on Jun 12, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
rakefile.rb
73 lines (61 loc) · 2.62 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
require 'albacore'
require 'fileutils'
version = IO.read("src/CommonAssemblyInfo.cs").split(/AssemblyInformationalVersion\("/, 2)[1].split(/"/).first
xunit_command_net20 = "packages/xunit.runners.1.9.2/tools/xunit.console.exe"
xunit_command_net40 = "packages/xunit.runners.1.9.2/tools/xunit.console.clr4.exe"
nuget_command = "packages/NuGet.CommandLine.2.7.0/tools/NuGet.exe"
solution = "src/XBehave.sln"
output = "bin"
specs = [
{ :command => xunit_command_net20, :assembly => "src/test/Xbehave.Sdk.Specifications.Net35/bin/Release/Xbehave.Sdk.Specifications.Net35.dll" },
{ :command => xunit_command_net20, :assembly => "src/test/Xbehave.Specifications.Net35/bin/Release/Xbehave.Specifications.Net35.dll" },
{ :command => xunit_command_net40, :assembly => "src/test/Xbehave.Sdk.Specifications.Net40/bin/Release/Xbehave.Sdk.Specifications.Net40.dll" },
{ :command => xunit_command_net40, :assembly => "src/test/Xbehave.Specifications.Net40/bin/Release/Xbehave.Specifications.Net40.dll" }
]
features = [
{ :command => xunit_command_net20, :assembly => "src/test/Xbehave.Features.Net35/bin/Release/Xbehave.Features.Net35.dll" },
{ :command => xunit_command_net40, :assembly => "src/test/Xbehave.Features.Net40/bin/Release/Xbehave.Features.Net40.dll" },
{ :command => xunit_command_net40, :assembly => "src/test/Xbehave.Features.Net45/bin/Release/Xbehave.Features.Net45.dll" }
]
nuspec = "src/Xbehave.nuspec"
Albacore.configure do |config|
config.log_level = :verbose
end
desc "Execute default tasks"
task :default => [:spec, :feature, :pack]
desc "Clean solution"
msbuild :clean do |msb|
FileUtils.rmtree output
msb.properties = { :configuration => :Release }
msb.targets = [:Clean]
msb.solution = solution
end
desc "Build solution"
msbuild :build => [:clean] do |msb|
msb.properties = { :configuration => :Release }
msb.targets = [:Build]
msb.solution = solution
end
desc "Execute specs"
task :spec => [:build] do
execute_xunit specs
end
desc "Execute features"
task :feature => [:build] do
execute_xunit features
end
desc "Create the nuget package"
exec :pack => [:build] do |cmd|
FileUtils.mkpath output
cmd.command = nuget_command
cmd.parameters "pack " + nuspec + " -Version " + version + " -OutputDirectory " + output
end
def execute_xunit(tests)
tests.each do |test|
xunit = XUnitTestRunner.new
xunit.command = test[:command]
xunit.assembly = test[:assembly]
xunit.options "/html", File.expand_path(test[:assembly] + ".TestResults.html"), "/xml", File.expand_path(test[:assembly] + ".TestResults.xml")
xunit.execute
end
end