-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrakefile.rb
88 lines (73 loc) · 2.57 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
80
81
82
83
84
85
86
87
88
include FileTest
require 'rubygems'
require 'zip/zip'
require 'zip/zipfilesystem'
require 'albacore'
require 'rexml/document'
include REXML
require 'FileUtils'
load 'support/buildUtils.rb'
load "VERSION.txt"
ROOT_NAMESPACE = "FubuMVC.TestRunner"
RESULTS_DIR = "build/test-reports"
BUILD_NUMBER_BASE = "0.1.0"
PRODUCT = ROOT_NAMESPACE
COPYRIGHT = 'Copyright Joshua Arnold 2011. All rights reserved.';
COMMON_ASSEMBLY_INFO = 'src/CommonAssemblyInfo.cs';
CLR_VERSION = "v4.0"
COMPILE_TARGET = "Debug"
props = { :archive => "build", :stage => "stage" }
desc "Compiles and runs unit tests"
task :all => [:default]
desc "**Default**, compiles and runs tests"
task :default => [:compile, :unit_tests, :release]
desc "Update the version information for the build"
assemblyinfo :version do |asm|
tc_build_number = ENV["BUILD_NUMBER"]
build_revision = tc_build_number || Time.new.strftime('5%H%M')
BUILD_NUMBER = "#{BUILD_VERSION}.#{build_revision}"
asm_version = BUILD_VERSION + ".0"
begin
commit = `git log -1 --pretty=format:%H`
rescue
commit = "git unavailable"
end
puts "##teamcity[buildNumber '#{BUILD_NUMBER}']" unless tc_build_number.nil?
puts "Version: #{BUILD_NUMBER}" if tc_build_number.nil?
asm.trademark = commit
asm.product_name = PRODUCT
asm.description = BUILD_NUMBER
asm.version = asm_version
asm.file_version = BUILD_NUMBER
asm.custom_attributes :AssemblyInformationalVersion => asm_version
asm.copyright = COPYRIGHT
asm.output_file = COMMON_ASSEMBLY_INFO
end
desc "Prepares the working directory for a new build"
task :clean do
puts("recreating the build directory")
buildDir = props[:archive]
FileUtils.rm_r(Dir.glob(File.join(buildDir, '*')), :force=>true) if exists?(buildDir)
FileUtils.rm_r(Dir.glob(buildDir), :force=>true) if exists?(buildDir)
Dir.mkdir buildDir unless exists?(buildDir)
Dir.mkdir RESULTS_DIR unless exists?(RESULTS_DIR)
end
desc "Compiles the app"
msbuild :compile => [:clean, :version] do |msb|
msb.properties :configuration => COMPILE_TARGET
msb.targets :Clean, :Build
msb.solution = "src/#{ROOT_NAMESPACE}.sln"
end
desc "Runs unit tests"
task :unit_tests do
end
task :release do
copyOutputFiles "src/FubuMVC.TestRunner/bin/#{COMPILE_TARGET}", "FubuMVC.TestRunner*.{dll,pdb}", props[:archive]
archive = Dir.glob(props[:archive])
# TODO -- create the pak and nugetify it
end
def copyOutputFiles(fromDir, filePattern, outDir)
Dir.glob(File.join(fromDir, filePattern)){|file|
copy(file, outDir) if File.file?(file)
}
end