-
Notifications
You must be signed in to change notification settings - Fork 1
/
rakefile
92 lines (80 loc) · 2.91 KB
/
rakefile
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
require 'rake'
require 'rake/testtask'
require 'pathname'
require 'rubygems'
require 'tools/Ruby/ProjectFile'
require 'tools/Ruby/NUnitResultsEvaluator'
require 'fileutils'
project = "DbFit"
version = 'v2.0.50727'
compileTarget = ENV.include?('target') ? ENV['target'] : 'debug'
frameworkDir = File.join('c:/windows', 'Microsoft.NET', 'Framework', version)
msbuild = File.join(frameworkDir, 'msbuild.exe')
nunit = "tools/NUnit/nunit-console-x86.exe"
task :default => [:help]
task :help do
taskHash = Hash[*(`rake -T`.split(/\n/).collect { |line| line.match(/rake (\S+)\s+\#\s(.+)/).to_a }.collect { |line| [line[1], line[2]] }).flatten]
indent = " "
puts "rake #{indent}#Runs the 'default' task"
taskHash.each_pair do |key, value|
if key.nil?
next
end
puts "rake #{key}#{indent.slice(0, indent.length - key.length)}##{value}"
end
end
desc "Display environment settings"
task :env do
puts "Project: #{project}"
puts ".NET Version: #{version}"
puts "Build Target: #{compileTarget}"
puts "Framework Dir: #{frameworkDir}"
puts "MSBuild Path: #{msbuild}"
end
desc "Launch the Visual Studio Solution"
task :sln do
Thread.new do
sh "c:/Program\\ Files/Microsoft\\ Visual\\ Studio\\ 8/Common7/IDE/devenv FrontEnd/#{project}.sln"
end
end
desc "Build"
task :build do
sh "#{msbuild} impl/dotnet/#{project}.sln /t:Build /property:Configuration=#{compileTarget}"
end
desc "Rebuild"
task :rebuild do
sh "#{msbuild} impl/dotnet/#{project}.sln /t:Rebuild /property:Configuration=#{compileTarget}"
end
desc "Clean"
task :clean do
sh "#{msbuild} impl/dotnet/#{project}.sln /t:Clean /property:Configuration=#{compileTarget}"
end
desc "Run NUnit Tests"
task :test, :filter do | task, parameters |
test_filter = Regexp.new(parameters[:filter] || ".*", Regexp::IGNORECASE)
results = NUnitResultsEvaluator.new()
FileList['**/*Test*.csproj', '**/*Fixtures*.csproj'].each do | projectFile |
project = ProjectFile.new(projectFile)
assemblyPath = project.assembly_path
next unless assemblyPath.match(test_filter) && File.exists?(assemblyPath)
puts "Running unit tests for #{project.project_name}"
results.print_test_results(`#{nunit} #{assemblyPath} /xml=#{project.output_path}/TestResult.xml /config=#{assemblyPath}.config /nologo /nodots`, project.project_name)
raise "Unit tests failed" unless results.failed == 0
end
results.print_statistics
end
desc "Clean Database schema"
task :dbclean do
# Not Implemented
end
desc "Clean up everything"
task :cleanall do
Rake::Task['clean'].execute
Rake::Task['dbclean'].execute
end
desc "all"
task :all do
for each in ['clean','dbclean','build','test','dbclean','fitnesse'] do
Rake::Task[each].execute
end
end