This repository has been archived by the owner on Dec 31, 2018. It is now read-only.
/
rakefile.rb
91 lines (75 loc) · 2.75 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
89
90
91
require 'albacore'
require 'rbconfig'
require_relative './src/.nuget/nuget'
def with_mono_properties msb
solution_dir = File.join(File.dirname(__FILE__),'src')
nuget_tools_path = File.join(solution_dir, '.nuget')
msb.prop :SolutionDir, solution_dir
msb.prop :NuGetToolsPath, nuget_tools_path
msb.prop :NuGetExePath, File.join(nuget_tools_path, 'NuGet.exe')
msb.prop :PackagesDir, File.join(solution_dir, 'packages')
end
desc "build"
build :build => [:install_packages] do |msb|
msb.prop :configuration, :Debug
msb.prop :platform, "Mixed Platforms"
if NuGet::os != :windows
with_mono_properties msb
end
msb.target = :Rebuild
msb.be_quiet
msb.nologo
msb.sln =File.join('.',"src", "ElasticElmah.Core.sln")
end
desc "test using nunit console"
test_runner :test => [:build] do |nunit|
nunit.exe = NuGet::nunit_path
files = [File.join(File.dirname(__FILE__),"src","ElasticElmah.Appender.Tests","bin","Debug","ElasticElmah.Appender.Tests.dll")]
nunit.files = files
end
task :core_copy_to_nuspec => [:build] do
output_directory_lib = File.join('.',"nuget/ElasticElmah.Appender/lib/40/")
mkdir_p output_directory_lib
cp Dir.glob("./src/ElasticElmah.Appender/bin/Debug/ElasticElmah.Appender.dll"), output_directory_lib
end
task :runners_copy_to_nuspec => [:build] do
output_directory_lib = File.join('.',"nuget/ElasticElmah.Tail/tools/")
mkdir_p output_directory_lib
cp Dir.glob("./src/ElasticElmah.Tail/bin/Debug/ElasticElmah.Tail.exe"), output_directory_lib
cp Dir.glob("./src/ElasticElmah.Tail/bin/Debug/log4net.dll"), output_directory_lib
end
desc "create the nuget package"
task :nugetpack => [:core_nugetpack, :runners_nugetpack]
task :core_nugetpack => [:core_copy_to_nuspec] do |nuget|
cd File.join('.',"nuget/ElasticElmah.Appender") do
NuGet::exec "pack ElasticElmah.Appender.nuspec"
end
end
task :runners_nugetpack => [:runners_copy_to_nuspec] do |nuget|
cd File.join('.',"nuget/ElasticElmah.Tail") do
NuGet::exec "pack ElasticElmah.Tail.nuspec"
end
end
desc "Install missing NuGet packages."
task :install_packages do
package_paths = FileList["src/**/packages.config"]+["src/.nuget/packages.config"]
package_paths.each.each do |filepath|
begin
NuGet::exec("i #{filepath} -o ./src/packages -source http://www.nuget.org/api/v2/")
rescue
puts "Failed to install missing packages ..."
end
end
end
namespace :ruby do
require 'bundler/gem_helper'
Bundler::GemHelper.install_tasks({:dir=>File.dirname(__FILE__),:name=>'elasticelmah'})
require 'rake/testtask'
desc "test ruby version"
Rake::TestTask.new(:test) do |t|
dir = File.join(File.dirname(__FILE__),'tests')
t.libs << "test"
t.test_files = FileList[File.join(dir,'*_test*.rb')]
t.verbose = true
end
end