forked from mxriverlynn/Albacore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrakefile.rb
297 lines (246 loc) · 8.92 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
$: << './'
require 'lib/albacore'
require 'version_bumper'
task :default => ['albacore:sample']
namespace :specs do
require 'spec/rake/spectask'
@spec_opts = '--colour --format specdoc'
desc "Run all specs for albacore"
Spec::Rake::SpecTask.new :all do |t|
t.spec_files = FileList['spec/**/*_spec.rb'].exclude{ |f|
f if IS_IRONRUBY && (f.include?("zip"))
}
t.spec_opts << @spec_opts
end
desc "CSharp compiler (csc.exe) specs"
Spec::Rake::SpecTask.new :csc do |t|
t.spec_files = FileList['spec/csc*_spec.rb']
t.spec_opts << @spec_opts
end
desc "Assembly info functional specs"
Spec::Rake::SpecTask.new :assemblyinfo do |t|
t.spec_files = FileList['spec/assemblyinfo*_spec.rb']
t.spec_opts << @spec_opts
end
desc "MSBuild functional specs"
Spec::Rake::SpecTask.new :msbuild do |t|
t.spec_files = FileList['spec/msbuild*_spec.rb']
t.spec_opts << @spec_opts
end
desc "SQLServer SQLCmd functional specs"
Spec::Rake::SpecTask.new :sqlcmd do |t|
t.spec_files = FileList['spec/sqlcmd*_spec.rb']
t.spec_opts << @spec_opts
end
desc "Nant functional specs"
Spec::Rake::SpecTask.new :nant do |t|
t.spec_files = FileList['spec/nant*_spec.rb']
t.spec_opts << @spec_opts
end
desc "NCover Console functional specs"
Spec::Rake::SpecTask.new :ncoverconsole do |t|
t.spec_files = FileList['spec/ncoverconsole*_spec.rb']
t.spec_opts << @spec_opts
end
desc "NCover Report functional specs"
Spec::Rake::SpecTask.new :ncoverreport do |t|
t.spec_files = FileList['spec/ncoverreport*_spec.rb']
t.spec_opts << @spec_opts
end
desc "Ndepend functional specs"
Spec::Rake::SpecTask.new :ndepend do |t|
t.spec_files = FileList['spec/ndepend*_spec.rb']
t.spec_opts << @spec_opts
end
desc "Zip functional specs"
Spec::Rake::SpecTask.new :zip do |t|
t.spec_files = FileList['spec/zip*_spec.rb']
t.spec_opts << @spec_opts
end
desc "XUnit functional specs"
Spec::Rake::SpecTask.new :xunit do |t|
t.spec_files = FileList['spec/xunit*_spec.rb']
t.spec_opts << @spec_opts
end
desc "NUnit functional specs"
Spec::Rake::SpecTask.new :nunit do |t|
t.spec_files = FileList['spec/nunit*_spec.rb']
t.spec_opts << @spec_opts
end
desc "MSTest functional specs"
Spec::Rake::SpecTask.new :mstest do |t|
t.spec_files = FileList['spec/mstest*_spec.rb']
t.spec_opts << @spec_opts
end
desc "MSpec functional specs"
Spec::Rake::SpecTask.new :mspec do |t|
t.spec_files = FileList['spec/mspec*_spec.rb']
t.spec_opts << @spec_opts
end
desc "Exec functional specs"
Spec::Rake::SpecTask.new :exec do |t|
t.spec_files = FileList['spec/exec*_spec.rb']
t.spec_opts << @spec_opts
end
desc "Docu functional specs"
Spec::Rake::SpecTask.new :docu do |t|
t.spec_files = FileList['spec/docu*_spec.rb']
t.spec_opts << @spec_opts
end
desc "YAML Config functional specs"
Spec::Rake::SpecTask.new :yamlconfig do |t|
t.spec_files = FileList['spec/yaml*_spec.rb']
t.spec_opts << @spec_opts
end
desc "FluenMigrator functional specs"
Spec::Rake::SpecTask.new :fluentmigrator do |t|
t.spec_files = FileList['spec/fluentmigrator*_spec.rb']
t.spec_opts << @spec_opts
end
desc "Output functional specs"
Spec::Rake::SpecTask.new :output do |t|
t.spec_files = FileList['spec/output*_spec.rb']
t.spec_opts << @spec_opts
end
desc "NChurn functional specs"
Spec::Rake::SpecTask.new :nchurn do |t|
t.spec_files = FileList['spec/nchurn*_spec.rb']
t.spec_opts << @spec_opts
end
end
namespace :albacore do
Albacore.configure do |config|
config.yaml_config_folder = "spec/support/yamlconfig"
config.log_level = :verbose
end
desc "Run a complete Albacore build sample"
task :sample => ['albacore:assemblyinfo',
'albacore:assemblyinfo_modify',
'albacore:msbuild',
'albacore:ncoverconsole',
'albacore:ncoverreport',
'albacore:mspec',
'albacore:nunit',
'albacore:xunit',
'albacore:mstest',
'albacore:fluentmigrator']
desc "Run a sample MSBuild with YAML autoconfig"
msbuild :msbuild
desc "Run a sample assembly info generator"
assemblyinfo do |asm|
asm.version = "0.1.2.3"
asm.company_name = "a test company"
asm.product_name = "a product name goes here"
asm.title = "my assembly title"
asm.description = "this is the assembly description"
asm.copyright = "copyright some year, by some legal entity"
asm.custom_attributes :SomeAttribute => "some value goes here", :AnotherAttribute => "with some data"
asm.output_file = "spec/support/AssemblyInfo/AssemblyInfo.cs"
end
desc "Run a sample assembly info modifier"
assemblyinfo :assemblyinfo_modify do|asm|
# modify existing
asm.version = "0.1.2.3"
asm.company_name = "a test company"
# new attribute
asm.file_version = "4.5.6.7"
asm.input_file = "spec/support/AssemblyInfo/AssemblyInfoInput.test"
asm.output_file = "spec/support/AssemblyInfo/AssemblyInfoOutput.cs"
end
desc "Run a sample NCover Console code coverage"
ncoverconsole do |ncc|
@xml_coverage = "spec/support/CodeCoverage/test-coverage.xml"
File.delete(@xml_coverage) if File.exist?(@xml_coverage)
ncc.log_level = :verbose
ncc.command = "spec/support/Tools/NCover-v3.3/NCover.Console.exe"
ncc.output :xml => @xml_coverage
ncc.working_directory = "spec/support/CodeCoverage/nunit"
nunit = NUnitTestRunner.new("spec/support/Tools/NUnit-v2.5/nunit-console-x86.exe")
nunit.log_level = :verbose
nunit.assemblies "assemblies/TestSolution.Tests.dll"
nunit.options '/noshadow'
ncc.testrunner = nunit
end
desc "Run a sample NCover Report to check code coverage"
ncoverreport :ncoverreport => :ncoverconsole do |ncr|
@xml_coverage = "spec/support/CodeCoverage/test-coverage.xml"
ncr.command = "spec/support/Tools/NCover-v3.3/NCover.Reporting.exe"
ncr.coverage_files @xml_coverage
fullcoveragereport = NCover::FullCoverageReport.new
fullcoveragereport.output_path = "spec/support/CodeCoverage/report/output"
ncr.reports fullcoveragereport
ncr.required_coverage(
NCover::BranchCoverage.new(:minimum => 10),
NCover::CyclomaticComplexity.new(:maximum => 1)
)
end
desc "Run ZipDirectory example"
zip do |zip|
zip.output_path = File.dirname(__FILE__)
zip.directories_to_zip = "lib", "spec"
zip.additional_files "README.markdown"
zip.output_file = 'albacore_example.zip'
end
desc "Run UnZip example"
unzip do |zip|
zip.unzip_path = File.join File.dirname(__FILE__), 'temp'
zip.zip_file = 'albacore_example.zip'
end
desc "MSpec Test Runner Example"
mspec do |mspec|
mspec.command = "spec/support/Tools/Machine.Specification-v0.2/Machine.Specifications.ConsoleRunner.exe"
mspec.assemblies "spec/support/CodeCoverage/mspec/assemblies/TestSolution.MSpecTests.dll"
end
desc "NUnit Test Runner Example"
nunit do |nunit|
nunit.command = "spec/support/Tools/NUnit-v2.5/nunit-console.exe"
nunit.assemblies "spec/support/CodeCoverage/nunit/assemblies/TestSolution.Tests.dll"
end
desc "MSTest Test Runner Example"
mstest do |mstest|
mstest.command = "spec/support/Tools/MSTest-2008/mstest.exe"
mstest.assemblies "spec/support/CodeCoverage/mstest/TestSolution.MsTestTests.dll"
end
desc "XUnit Test Runner Example"
xunit do |xunit|
xunit.command = "spec/support/Tools/XUnit-v1.5/xunit.console.exe"
xunit.assembly = "spec/support/CodeCoverage/xunit/assemblies/TestSolution.XUnitTests.dll"
end
desc "Exec Task Example"
exec do |exec|
exec.command = 'hostname'
end
desc "Mono \ xBuild Example"
mono do |xbuild|
xbuild.properties :configuration => :release, :platform => 'Any CPU'
xbuild.targets :clean, :build
xbuild.solution = "spec/support/TestSolution/TestSolution.sln"
end
desc "FluentMigrator Test Runner Example"
fluentmigrator do |migrator|
db_file = "#{ENV['TEMP']}/fluentmigrator.sqlite3"
File.delete(db_file) if File.exist?(db_file)
migrator.command = "spec/support/Tools/FluentMigrator-0.9/Migrate.exe"
migrator.target = "spec/support/FluentMigrator/TestSolution.FluentMigrator.dll"
migrator.provider = "sqlite"
migrator.connection = "Data Source=#{db_file};"
end
end
namespace :jeweler do
require 'jeweler'
Jeweler::Tasks.new do |gs|
gs.name = "albacore"
gs.summary = "Dolphin-Safe Rake Tasks For .NET Systems"
gs.description = "Easily build your .NET solutions with Ruby and Rake, using this suite of Rake tasks."
gs.email = "albacorebuild@gmail.com"
gs.homepage = "http://albacorebuild.net"
gs.authors = ["Derick Bailey", "etc"]
gs.has_rdoc = false
gs.files.exclude(
"albacore.gemspec",
".gitignore",
"spec/",
"pkg/"
)
end
end