-
Notifications
You must be signed in to change notification settings - Fork 43
/
Rakefile.rb
64 lines (53 loc) · 1.71 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
# Rakefile.rb
require 'rubygems'
require 'ftools'
ILMERGE = "ilmerge"
DEVENV = "\"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\devenv.exe\""
SOLUTION_ROOT = Dir.pwd
SOLUTION_FILE = "\"#{SOLUTION_ROOT}\\src\\automoq.sln\""
BIN_DIRECTORY = "#{SOLUTION_ROOT}\\src\\AutoMoq\\bin\\Release"
DEPLOY_DIRECTORY = "#{SOLUTION_ROOT}\\deploy"
DEPLOY_FILE = "#{DEPLOY_DIRECTORY}\\AutoMoq.dll"
task :default=>[:say_hi]
desc "Says hi"
task :say_hi do
puts "Hi there. Rake is working."
puts "Type rake --tasks."
end
desc "Count the files of each type in this solution"
task :file_count do
report = {}
Dir['./**/**'].each do |f|
report[File.extname(f)].nil? ? report[File.extname(f)] = 1 : report[File.extname(f)] += 1
end
report.each do |type, count|
puts "#{type}: #{count}"
end
end
desc "Cleans the solution"
task :clean do
sh "#{DEVENV} #{SOLUTION_FILE} /clean"
end
desc "Builds the release version"
task :release_build do
sh "#{DEVENV} #{SOLUTION_FILE} /build Release"
end
desc "Create the AutoMoq.dll in /deploy"
task :create_deploy do
Rake::Task['release_build'].execute
mkdir "#{DEPLOY_DIRECTORY}" unless File.exists?(DEPLOY_DIRECTORY)
includes = []
Dir["#{BIN_DIRECTORY}/*.dll"].each do |f|
if (File.extname(f) == '.dll')
includes.push f
end
end
sh "#{ILMERGE} /t:library /out:#{DEPLOY_FILE} #{includes.join(" ")}"
Rake::Task['clean'].execute
end
desc "Delete the /deploy directory"
task :clean_deploy do
File.delete "#{DEPLOY_DIRECTORY + "/AutoMoq.dll"}" if File.exists?(DEPLOY_DIRECTORY + "/AutoMoq.dll")
File.delete "#{DEPLOY_DIRECTORY + "/AutoMoq.pdb"}" if File.exists?(DEPLOY_DIRECTORY + "/AutoMoq.pdb")
Dir.delete "#{DEPLOY_DIRECTORY}" if File.exists?(DEPLOY_DIRECTORY)
end