albacore 0.2.0.preview1 → 0.2.0.preview2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. data/README.markdown +7 -2
  2. data/VERSION +1 -1
  3. data/install_dependencies.rb +1 -1
  4. data/lib/albacore.rb +6 -17
  5. data/lib/albacore/albacoretask.rb +43 -0
  6. data/lib/albacore/assemblyinfo.rb +10 -7
  7. data/lib/albacore/config/assemblyinfoconfig.rb +4 -12
  8. data/lib/albacore/config/config.rb +16 -8
  9. data/lib/albacore/config/cscconfig.rb +2 -7
  10. data/lib/albacore/config/docuconfig.rb +3 -5
  11. data/lib/albacore/config/execconfig.rb +4 -11
  12. data/lib/albacore/config/msbuildconfig.rb +2 -5
  13. data/lib/albacore/config/mspectestrunnerconfig.rb +15 -0
  14. data/lib/albacore/config/nantconfig.rb +4 -11
  15. data/lib/albacore/config/ncoverconsoleconfig.rb +4 -11
  16. data/lib/albacore/config/ncoverreportconfig.rb +4 -11
  17. data/lib/albacore/config/ndependconfig.rb +4 -11
  18. data/lib/albacore/config/netversion.rb +0 -2
  19. data/lib/albacore/config/nunittestrunnerconfig.rb +14 -0
  20. data/lib/albacore/config/specflowreportconfig.rb +2 -5
  21. data/lib/albacore/config/sqlcmdconfig.rb +4 -11
  22. data/lib/albacore/config/unzipconfig.rb +4 -11
  23. data/lib/albacore/config/xbuildconfig.rb +4 -11
  24. data/lib/albacore/config/xunittestrunnerconfig.rb +15 -0
  25. data/lib/albacore/config/zipdirectoryconfig.rb +15 -0
  26. data/lib/albacore/csc.rb +31 -5
  27. data/lib/albacore/docu.rb +2 -3
  28. data/lib/albacore/exec.rb +3 -5
  29. data/lib/albacore/msbuild.rb +3 -3
  30. data/lib/albacore/mspectestrunner.rb +5 -6
  31. data/lib/albacore/nant.rb +4 -6
  32. data/lib/albacore/ncoverconsole.rb +4 -6
  33. data/lib/albacore/ncoverreport.rb +4 -6
  34. data/lib/albacore/ncoverreports/codecoveragebase.rb +2 -2
  35. data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +2 -2
  36. data/lib/albacore/ncoverreports/fullcoveragereport.rb +0 -8
  37. data/lib/albacore/ncoverreports/reportfilterbase.rb +2 -2
  38. data/lib/albacore/ncoverreports/summaryreport.rb +0 -4
  39. data/lib/albacore/ndepend.rb +4 -6
  40. data/lib/albacore/nunittestrunner.rb +4 -5
  41. data/lib/albacore/specflowreport.rb +2 -2
  42. data/lib/albacore/sqlcmd.rb +33 -11
  43. data/lib/albacore/support/createtask.rb +30 -0
  44. data/lib/albacore/support/runcommand.rb +21 -30
  45. data/lib/albacore/support/updateattributes.rb +13 -0
  46. data/lib/albacore/unzip.rb +3 -5
  47. data/lib/albacore/xbuild.rb +5 -6
  48. data/lib/albacore/xunittestrunner.rb +4 -5
  49. data/lib/albacore/zipdirectory.rb +5 -6
  50. data/rakefile.rb +7 -8
  51. data/spec/albacoremodel_spec.rb +20 -2
  52. data/spec/assemblyinfo_spec.rb +27 -14
  53. data/spec/config_spec.rb +17 -2
  54. data/spec/createtask_spec.rb +51 -28
  55. data/spec/csc_spec.rb +135 -3
  56. data/spec/docu_spec.rb +11 -14
  57. data/spec/exec_spec.rb +1 -1
  58. data/spec/msbuild_spec.rb +9 -9
  59. data/spec/nant_spec.rb +4 -4
  60. data/spec/ncoverconsole_spec.rb +13 -13
  61. data/spec/ncoverreport_spec.rb +17 -17
  62. data/spec/ndepend_spec.rb +6 -6
  63. data/spec/runcommand_spec.rb +22 -3
  64. data/spec/sqlcmd_spec.rb +154 -12
  65. data/spec/support/assemblyinfotester.rb +1 -1
  66. data/spec/support/spec_helper.rb +2 -2
  67. data/spec/yamlconfig_spec.rb +3 -3
  68. data/spec/zip_spec.rb +4 -4
  69. metadata +32 -119
  70. data/lib/albacore/albacoremodel.rb +0 -28
  71. data/lib/albacore/config/mspecconfig.rb +0 -21
  72. data/lib/albacore/config/nunitconfig.rb +0 -20
  73. data/lib/albacore/config/xunitconfig.rb +0 -22
  74. data/lib/albacore/config/zipconfig.rb +0 -22
  75. data/lib/rake/assemblyinfotask.rb +0 -3
  76. data/lib/rake/csctask.rb +0 -3
  77. data/lib/rake/docutask.rb +0 -3
  78. data/lib/rake/exectask.rb +0 -3
  79. data/lib/rake/msbuildtask.rb +0 -3
  80. data/lib/rake/mspectask.rb +0 -3
  81. data/lib/rake/nanttask.rb +0 -3
  82. data/lib/rake/ncoverconsoletask.rb +0 -3
  83. data/lib/rake/ncoverreporttask.rb +0 -3
  84. data/lib/rake/ndependtask.rb +0 -3
  85. data/lib/rake/nunittask.rb +0 -3
  86. data/lib/rake/specflowreporttask.rb +0 -3
  87. data/lib/rake/sqlcmdtask.rb +0 -3
  88. data/lib/rake/support/albacoretask.rb +0 -30
  89. data/lib/rake/support/createtask.rb +0 -21
  90. data/lib/rake/unziptask.rb +0 -3
  91. data/lib/rake/xbuildtask.rb +0 -7
  92. data/lib/rake/xunittask.rb +0 -3
  93. data/lib/rake/ziptask.rb +0 -3
  94. data/spec/assemblyinfotask_spec.rb +0 -32
  95. data/spec/csctask_spec.rb +0 -1
  96. data/spec/docutask_spec.rb +0 -52
  97. data/spec/exectask_spec.rb +0 -46
  98. data/spec/msbuildtask_spec.rb +0 -46
  99. data/spec/mspectask_spec.rb +0 -46
  100. data/spec/nanttask_spec.rb +0 -46
  101. data/spec/ncoverconsoletask_spec.rb +0 -46
  102. data/spec/ncoverreporttask_spec.rb +0 -46
  103. data/spec/ndependtask_spec.rb +0 -46
  104. data/spec/nunittask_spec.rb +0 -46
  105. data/spec/spec.opts +0 -1
  106. data/spec/specflowreporttask_spec.rb +0 -48
  107. data/spec/sqlcmdtask_spec.rb +0 -32
  108. data/spec/support/AssemblyInfo/assemblyinfo.yml +0 -2
  109. data/spec/support/CodeCoverage/mspec/assemblies/Machine.Specifications.NUnit.dll +0 -0
  110. data/spec/support/CodeCoverage/mspec/assemblies/Machine.Specifications.dll +0 -0
  111. data/spec/support/CodeCoverage/mspec/assemblies/TestSolution.MSpecTests.dll +0 -0
  112. data/spec/support/CodeCoverage/mspec/assemblies/TestSolution.dll +0 -0
  113. data/spec/support/CodeCoverage/mspec/assemblies/nunit.framework.dll +0 -0
  114. data/spec/support/CodeCoverage/nunit/assemblies/TestSolution.Tests.dll +0 -0
  115. data/spec/support/CodeCoverage/nunit/assemblies/TestSolution.dll +0 -0
  116. data/spec/support/CodeCoverage/nunit/assemblies/nunit.framework.dll +0 -0
  117. data/spec/support/CodeCoverage/nunit/assemblies/with spaces/TestSolution.Tests.dll +0 -0
  118. data/spec/support/CodeCoverage/nunit/assemblies/with spaces/TestSolution.dll +0 -0
  119. data/spec/support/CodeCoverage/nunit/assemblies/with spaces/nunit.framework.dll +0 -0
  120. data/spec/support/CodeCoverage/nunit/failing_assemblies/TestSolution.FailingTests.dll +0 -0
  121. data/spec/support/CodeCoverage/nunit/failing_assemblies/nunit.framework.dll +0 -0
  122. data/spec/support/CodeCoverage/report/coverage.xml +0 -4578
  123. data/spec/support/CodeCoverage/xunit/assemblies/TestSolution.XUnitTests.dll +0 -0
  124. data/spec/support/CodeCoverage/xunit/assemblies/TestSolution.dll +0 -0
  125. data/spec/support/CodeCoverage/xunit/assemblies/xunit.dll +0 -0
  126. data/spec/support/CodeCoverage/xunit/assemblies/xunit.xml +0 -2306
  127. data/spec/support/SpecFlow/TechTalk.SpecFlow.dll +0 -0
  128. data/spec/support/SpecFlow/TestSolution.SpecFlow.dll +0 -0
  129. data/spec/support/SpecFlow/TestSolution.SpecFlow.pdb +0 -0
  130. data/spec/support/SpecFlow/TestSolution.dll +0 -0
  131. data/spec/support/SpecFlow/TestSolution.pdb +0 -0
  132. data/spec/support/SpecFlow/nunit.framework.dll +0 -0
  133. data/spec/support/TestSolution/NDependProject.xml +0 -315
  134. data/spec/support/TestSolution/TestSolution.5.0.ReSharper.user +0 -27
  135. data/spec/support/TestSolution/TestSolution.FailingTests/FailingTestFixture.cs +0 -19
  136. data/spec/support/TestSolution/TestSolution.FailingTests/Properties/AssemblyInfo.cs +0 -36
  137. data/spec/support/TestSolution/TestSolution.FailingTests/TestSolution.FailingTests.csproj +0 -63
  138. data/spec/support/TestSolution/TestSolution.MSpecTests/Properties/AssemblyInfo.cs +0 -36
  139. data/spec/support/TestSolution/TestSolution.MSpecTests/SomeSpecTest.cs +0 -18
  140. data/spec/support/TestSolution/TestSolution.MSpecTests/TestSolution.MSpecTests.csproj +0 -77
  141. data/spec/support/TestSolution/TestSolution.SpecFlow/OneFeature.feature +0 -8
  142. data/spec/support/TestSolution/TestSolution.SpecFlow/OneFeature.feature.cs +0 -73
  143. data/spec/support/TestSolution/TestSolution.SpecFlow/Properties/AssemblyInfo.cs +0 -36
  144. data/spec/support/TestSolution/TestSolution.SpecFlow/StepDefinition.cs +0 -30
  145. data/spec/support/TestSolution/TestSolution.SpecFlow/TestSolution.SpecFlow.csproj +0 -84
  146. data/spec/support/TestSolution/TestSolution.Tests/Properties/AssemblyInfo.cs +0 -36
  147. data/spec/support/TestSolution/TestSolution.Tests/SomeTestFixture.cs +0 -23
  148. data/spec/support/TestSolution/TestSolution.Tests/TestSolution.Tests.csproj +0 -69
  149. data/spec/support/TestSolution/TestSolution.XUnitTests/Class1.cs +0 -19
  150. data/spec/support/TestSolution/TestSolution.XUnitTests/FailingTestFixture.cs +0 -14
  151. data/spec/support/TestSolution/TestSolution.XUnitTests/Properties/AssemblyInfo.cs +0 -36
  152. data/spec/support/TestSolution/TestSolution.XUnitTests/TestSolution.XUnitTests.csproj +0 -70
  153. data/spec/support/TestSolution/TestSolution.build +0 -25
  154. data/spec/support/TestSolution/TestSolution.sln +0 -50
  155. data/spec/support/TestSolution/TestSolution/Class1.cs +0 -17
  156. data/spec/support/TestSolution/TestSolution/Properties/AssemblyInfo.cs +0 -36
  157. data/spec/support/TestSolution/TestSolution/TestSolution.csproj +0 -59
  158. data/spec/support/csc/File1.cs +0 -9
  159. data/spec/support/csc/File2.cs +0 -9
  160. data/spec/support/csc/output/ignorethis.txt +0 -1
  161. data/spec/support/test.yml +0 -4
  162. data/spec/support/yamlconfig/msbuild.yml +0 -5
  163. data/spec/support/yamlconfig/yaml_autoconfig_test.yml +0 -1
  164. data/spec/support/zip/files/subfolder/sub file.txt +0 -1
  165. data/spec/support/zip/files/testfile.txt +0 -1
  166. data/spec/xunittask_spec.rb +0 -32
  167. data/spec/ziptask_spec.rb +0 -33
@@ -21,7 +21,7 @@ describe NAnt, "when a nant path is not specified" do
21
21
  before :all do
22
22
  @nant.extend(FailPatch)
23
23
  @log_data = @strio.string
24
- @nant.run
24
+ @nant.execute
25
25
  end
26
26
 
27
27
  it "should fail" do
@@ -35,7 +35,7 @@ describe NAnt, "when running a nant build file" do
35
35
  before :all do
36
36
  @nant.command = @testdata.nant_path
37
37
  @nant.build_file = @testdata.build_file_path
38
- @nant.run
38
+ @nant.execute
39
39
  end
40
40
 
41
41
  it "should execute the default task" do
@@ -50,7 +50,7 @@ describe NAnt, "when running specific targets" do
50
50
  @nant.command = @testdata.nant_path
51
51
  @nant.build_file = @testdata.build_file_path
52
52
  @nant.targets :build, :other
53
- @nant.run
53
+ @nant.execute
54
54
  end
55
55
 
56
56
  it "should execute the first task" do
@@ -73,7 +73,7 @@ describe NAnt, "when specifying multiple configuration properties" do
73
73
  @nant.build_file = @testdata.build_file_path
74
74
 
75
75
  @nant.properties :version => "1.2.3", "build.mode" => :fast, :debug => false
76
- @nant.run
76
+ @nant.execute
77
77
  end
78
78
 
79
79
  it "should spedify the first property" do
@@ -23,7 +23,7 @@ describe NCoverConsole, "when specifying assemblies to cover" do
23
23
  nunit.options '/noshadow'
24
24
 
25
25
  @ncc.testrunner = nunit
26
- @ncc.run
26
+ @ncc.execute
27
27
  end
28
28
 
29
29
  it "should provide coverage for the specified assemblies" do
@@ -50,7 +50,7 @@ describe NCoverConsole, "when specifying assemblies with spaces in the name" do
50
50
  nunit.options '/noshadow'
51
51
 
52
52
  @ncc.testrunner = nunit
53
- @ncc.run
53
+ @ncc.execute
54
54
  end
55
55
 
56
56
  it "should provide coverage for the specified assemblies" do
@@ -78,7 +78,7 @@ describe NCoverConsole, "when specifying assemblies to ignore" do
78
78
  nunit.options '/noshadow'
79
79
 
80
80
  @ncc.testrunner = nunit
81
- @ncc.run
81
+ @ncc.execute
82
82
  end
83
83
 
84
84
  it "should provide coverage for the specified assemblies" do
@@ -105,7 +105,7 @@ describe NCoverConsole, "when specifying attributes to exclude" do
105
105
  nunit.options '/noshadow'
106
106
 
107
107
  @ncc.testrunner = nunit
108
- @ncc.run
108
+ @ncc.execute
109
109
  end
110
110
 
111
111
  it "should not provide coverage for the excluded attributes" do
@@ -124,7 +124,7 @@ describe NCoverConsole, "when running with the defaults" do
124
124
  @ncc.command = @testdata.ncoverpath
125
125
  @ncc.testrunner = NUnitTestRunner.new
126
126
 
127
- @ncc.run
127
+ @ncc.execute
128
128
  end
129
129
 
130
130
  it "should include the register flag in the command" do
@@ -144,7 +144,7 @@ describe NCoverConsole, "when opting out of registering the ncover dll" do
144
144
  @ncc.no_registration
145
145
  @ncc.testrunner = NUnitTestRunner.new
146
146
 
147
- @ncc.run
147
+ @ncc.execute
148
148
  end
149
149
 
150
150
  it "should not include the register flag in the command" do
@@ -171,7 +171,7 @@ describe NCoverConsole, "when specifying the types of coverage to analyze" do
171
171
  nunit.options '/noshadow'
172
172
 
173
173
  @ncc.testrunner = nunit
174
- @ncc.run
174
+ @ncc.execute
175
175
  end
176
176
 
177
177
  it "should only run coverage for those metrics" do
@@ -202,7 +202,7 @@ describe NCoverConsole, "when analyzing a test suite with failing tests" do
202
202
 
203
203
  ncc.testrunner = nunit
204
204
 
205
- ncc.run
205
+ ncc.execute
206
206
  @log_data = strio.string
207
207
  end
208
208
 
@@ -223,7 +223,7 @@ describe NCoverConsole, "when running without a testrunner" do
223
223
  strio = StringIO.new
224
224
  ncc.log_device = strio
225
225
 
226
- ncc.run
226
+ ncc.execute
227
227
  @log_data = strio.string
228
228
  end
229
229
 
@@ -254,11 +254,11 @@ describe NCoverConsole, "when producing an xml coverage report with nunit" do
254
254
  nunit.options '/noshadow'
255
255
 
256
256
  @ncc.testrunner = nunit
257
- @ncc.run
257
+ @ncc.execute
258
258
  end
259
259
 
260
260
  it "should execute ncover.console from the specified path" do
261
- @ncc.system_command.should include(@testdata.ncoverpath)
261
+ @ncc.system_command.should include(File.expand_path(@testdata.ncoverpath))
262
262
  end
263
263
 
264
264
  it "should execute with the specified working directory" do
@@ -301,7 +301,7 @@ describe NCoverConsole, "when specifying an html report and an xml coverage repo
301
301
  nunit.options '/noshadow'
302
302
 
303
303
  ncc.testrunner = nunit
304
- ncc.run
304
+ ncc.execute
305
305
  end
306
306
 
307
307
 
@@ -332,7 +332,7 @@ describe NCoverConsole, "when producing a report with machine.specifications" do
332
332
  mspec.html_output = @testdata.mspec_html_output
333
333
 
334
334
  @ncc.testrunner = mspec
335
- @ncc.run
335
+ @ncc.execute
336
336
  end
337
337
 
338
338
  it "should not fail" do
@@ -6,7 +6,7 @@ describe NCoverReport, "when runnign without the ncover report location specifie
6
6
  before :all do
7
7
  @ncover = NCoverReport.new
8
8
  @ncover.extend(FailPatch)
9
- @ncover.run
9
+ @ncover.execute
10
10
  end
11
11
 
12
12
  it "should fail execution" do
@@ -29,7 +29,7 @@ describe NCoverReport, "when running a full coverage report with a specified out
29
29
  fullcoveragereport.output_path = NCoverReportTestData.output_folder
30
30
  @ncover.reports fullcoveragereport
31
31
 
32
- @ncover.run
32
+ @ncover.execute
33
33
  end
34
34
 
35
35
  it "should execute ncover.reporting" do
@@ -60,7 +60,7 @@ describe NCoverReport, "when running a summary report with a specified output fo
60
60
  summaryreport.output_path = NCoverReportTestData.summary_output_file
61
61
  @ncover.reports summaryreport
62
62
 
63
- @ncover.run
63
+ @ncover.execute
64
64
  end
65
65
 
66
66
  it "should execute ncover.reporting" do
@@ -95,7 +95,7 @@ describe NCoverReport, "when running multiple ncover reports - a summary and a f
95
95
  fullcoveragereport.output_path = @fullcoverage_output_folder
96
96
  @ncover.reports summaryreport, fullcoveragereport
97
97
 
98
- @ncover.run
98
+ @ncover.execute
99
99
  end
100
100
 
101
101
  it "should tell ncover.reporting to produce a full coverage html report in the specified folder" do
@@ -127,7 +127,7 @@ describe NCoverReport, "when running a report with a specified minimum symbol co
127
127
  symbolcoverage.minimum = 10
128
128
  @ncover.required_coverage symbolcoverage
129
129
 
130
- @ncover.run
130
+ @ncover.execute
131
131
  end
132
132
 
133
133
  it "should tell ncover.reporting to check for the specified minimum coverage" do
@@ -163,7 +163,7 @@ describe NCoverReport, "when running a report with a specified minimum symbol co
163
163
  symbolcoverage.minimum = 100
164
164
  @ncover.required_coverage symbolcoverage
165
165
 
166
- @ncover.run
166
+ @ncover.execute
167
167
  end
168
168
 
169
169
  it "should tell ncover.reporting to check for the specified minimum coverage" do
@@ -200,7 +200,7 @@ describe NCoverReport, "when specifying the coverage item type to check" do
200
200
  symbolcoverage.item_type = :Class
201
201
  @ncover.required_coverage symbolcoverage
202
202
 
203
- @ncover.run
203
+ @ncover.execute
204
204
  end
205
205
 
206
206
  it "should tell ncover.reporting to check for the specified item type" do
@@ -234,7 +234,7 @@ describe NCoverReport, "when checking more than one type of coverage and all fai
234
234
  NCover::MethodCoverage.new(:minimum => 100, :item_type => :Class)
235
235
  )
236
236
 
237
- @ncover.run
237
+ @ncover.execute
238
238
  end
239
239
 
240
240
  it "should tell ncover.reporting to check for the symbol coverage" do
@@ -280,7 +280,7 @@ describe NCoverReport, "when checking more than one type of coverage and all pas
280
280
  NCover::MethodCoverage.new(:minimum => 0, :item_type => :Class)
281
281
  )
282
282
 
283
- @ncover.run
283
+ @ncover.execute
284
284
  end
285
285
 
286
286
  it "should tell ncover.reporting to check for the symbol coverage" do
@@ -325,7 +325,7 @@ describe NCoverReport, "when checking more than one type of coverage and one fai
325
325
  NCover::BranchCoverage.new(:minimum => 0, :item_type => :Class)
326
326
  )
327
327
 
328
- @ncover.run
328
+ @ncover.execute
329
329
  end
330
330
 
331
331
  it "should tell ncover.reporting to check for the symbol coverage" do
@@ -364,7 +364,7 @@ describe NCoverReport, "when running a report with a cyclomatic complexity highe
364
364
  coverage = NCover::CyclomaticComplexity.new(:maximum => 1, :item_type => :Class)
365
365
  @ncover.required_coverage coverage
366
366
 
367
- @ncover.run
367
+ @ncover.execute
368
368
  end
369
369
 
370
370
  it "should tell ncover.reporting to check for the maximum cyclomatic complexity" do
@@ -399,7 +399,7 @@ describe NCoverReport, "when running a report with a cyclomatic complexity under
399
399
  coverage = NCover::CyclomaticComplexity.new(:maximum => 1000)
400
400
  @ncover.required_coverage coverage
401
401
 
402
- @ncover.run
402
+ @ncover.execute
403
403
  end
404
404
 
405
405
  it "should tell ncover.reporting to check for the maximum cyclomatic complexity" do
@@ -437,7 +437,7 @@ describe NCoverReport, "when filtering on Assembly coverage data" do
437
437
  NCover::AssemblyFilter.new(:filter_type => :include, :filter => "TestSolution.*")
438
438
  )
439
439
 
440
- @ncover.run
440
+ @ncover.execute
441
441
  end
442
442
 
443
443
  it "should exclude the specified assemblies data" do
@@ -475,7 +475,7 @@ describe NCoverReport, "when filtering on Namespace coverage data" do
475
475
  NCover::NamespaceFilter.new(:filter_type => :include, :filter => "TestSolution.*")
476
476
  )
477
477
 
478
- @ncover.run
478
+ @ncover.execute
479
479
  end
480
480
 
481
481
  it "should exclude the specified data" do
@@ -513,7 +513,7 @@ describe NCoverReport, "when filtering on Class coverage data" do
513
513
  NCover::ClassFilter.new(:filter_type => :include, :filter => "Bar")
514
514
  )
515
515
 
516
- @ncover.run
516
+ @ncover.execute
517
517
  end
518
518
 
519
519
  it "should exclude the specified data" do
@@ -551,7 +551,7 @@ describe NCoverReport, "when filtering on Method coverage data" do
551
551
  NCover::MethodFilter.new(:filter_type => :include, :filter => "Bar")
552
552
  )
553
553
 
554
- @ncover.run
554
+ @ncover.execute
555
555
  end
556
556
 
557
557
  it "should exclude the specified data" do
@@ -589,7 +589,7 @@ describe NCoverReport, "when filtering on Document coverage data" do
589
589
  NCover::DocumentFilter.new(:filter_type => :include, :filter => "Bar")
590
590
  )
591
591
 
592
- @ncover.run
592
+ @ncover.execute
593
593
  end
594
594
 
595
595
  it "should exclude the specified data" do
@@ -8,7 +8,7 @@ describe "when executing Ndepend console" do
8
8
  @msbuild.properties = {:configuration => :Debug}
9
9
  @msbuild.targets = [:Clean, :Build]
10
10
  @msbuild.solution = "spec/support/TestSolution/TestSolution.sln"
11
- @msbuild.build
11
+ @msbuild.execute
12
12
  end
13
13
  before :each do
14
14
  @ndepend = NDepend.new
@@ -24,20 +24,20 @@ describe "when executing Ndepend console" do
24
24
 
25
25
  end
26
26
  it "should execute NdependConsole.exe"do
27
- @ndepend.run
27
+ @ndepend.execute
28
28
 
29
29
  @log_data.should include("NDepend.Console.exe" )
30
30
  end
31
31
 
32
32
  it "should include the Ndepend project file" do
33
- @ndepend.run
33
+ @ndepend.execute
34
34
  @log_data.should include("NDependProject.xml")
35
35
  end
36
36
 
37
37
  it "should fail when the project file is not given" do
38
38
  @ndepend.project_file = nil
39
39
  @ndepend.extend(FailPatch)
40
- @ndepend.run
40
+ @ndepend.execute
41
41
  $task_failed.should be_true
42
42
  end
43
43
 
@@ -45,7 +45,7 @@ describe "when executing Ndepend console" do
45
45
  expected_params = "/ViewReport /Silent /Help"
46
46
  @ndepend.parameters expected_params
47
47
  @ndepend.extend(FailPatch)
48
- @ndepend.run
48
+ @ndepend.execute
49
49
  @log_data.should include(expected_params)
50
50
  end
51
51
 
@@ -53,7 +53,7 @@ describe "when executing Ndepend console" do
53
53
  expected_params = "/Help"
54
54
  @ndepend.parameters expected_params
55
55
  @ndepend.extend(FailPatch)
56
- @ndepend.run
56
+ @ndepend.execute
57
57
  @log_data.should =~ /.*NDepend.Console.exe.*NDependProject.xml.*Help.*/
58
58
  end
59
59
  end
@@ -1,9 +1,9 @@
1
1
  require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
- require 'albacore/albacoremodel'
2
+ require 'albacore/albacoretask'
3
3
  require 'system_patch'
4
4
 
5
5
  class RunCommandObject
6
- include AlbacoreModel
6
+ include AlbacoreTask
7
7
  include RunCommand
8
8
 
9
9
  def execute
@@ -25,7 +25,7 @@ describe "when setting the command" do
25
25
  end
26
26
  end
27
27
 
28
- describe "when specifying a parmaeter to a command" do
28
+ describe "when specifying a parameter to a command" do
29
29
  before :all do
30
30
  @runme = RunCommandObject.new
31
31
  @runme.extend SystemPatch
@@ -73,3 +73,22 @@ describe "when executing a runcommand object twice" do
73
73
  @runmetwo.system_command.should == "\"test.exe\" 1 2 3"
74
74
  end
75
75
  end
76
+
77
+ describe "when the command exists relative to the project root" do
78
+ before :all do
79
+ @runme = RunCommandObject.new
80
+ @runme.extend SystemPatch
81
+
82
+ File.open('test.exe', 'w') {}
83
+ @runme.command = "test.exe"
84
+ @runme.execute
85
+ end
86
+
87
+ after :all do
88
+ FileUtils.rm_f('test.exe')
89
+ end
90
+
91
+ it "should expand the path" do
92
+ @runme.system_command.should == "\"#{File.expand_path('test.exe')}\""
93
+ end
94
+ end
@@ -1,6 +1,97 @@
1
1
  require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
2
  require 'albacore/sqlcmd'
3
3
 
4
+ describe SQLCmd, "when running a script the easy way" do
5
+ before :all do
6
+ @cmd = SQLCmd.new
7
+ @cmd.log_level = :verbose
8
+ @cmd.extend(SystemPatch)
9
+ @cmd.disable_system = true
10
+
11
+ @cmd.scripts "somescript.sql"
12
+
13
+ @cmd.execute
14
+ end
15
+
16
+ it "should use localhost as server default" do
17
+ @cmd.system_command.should include("-S \".\"")
18
+ end
19
+
20
+ it "should have no database designation (because it could be embedded in the sql file)" do
21
+ @cmd.system_command.should_not include("-d")
22
+ end
23
+
24
+ it "should use integrated security instead of username/password" do
25
+ @cmd.system_command.should include("-E")
26
+ end
27
+
28
+ it "should not include username" do
29
+ @cmd.system_command.should_not include("-U")
30
+ end
31
+
32
+ it "should not include password" do
33
+ @cmd.system_command.should_not include("-P")
34
+ end
35
+
36
+ it "should find the location of the sqlcmd exe for the user" do
37
+ @cmd.system_command.should include("SQLCMD.EXE")
38
+ end
39
+
40
+ it "should specify the script file" do
41
+ @cmd.system_command.should include("-i \"somescript.sql\"")
42
+ end
43
+
44
+ it "should not contain the -b option" do
45
+ @cmd.system_command.should_not include("-b")
46
+ end
47
+ end
48
+
49
+ describe SQLCmd, "when turning off trusted_connection" do
50
+ before :all do
51
+ @cmd = SQLCmd.new
52
+ @cmd.log_level = :verbose
53
+ @cmd.extend(SystemPatch)
54
+ @cmd.disable_system = true
55
+
56
+ @cmd.scripts "somescript.sql"
57
+ @cmd.trusted_connection = false
58
+
59
+ @cmd.execute
60
+ end
61
+
62
+ it "should not specify the -E option" do
63
+ @cmd.system_command.should_not include("-E")
64
+ end
65
+ end
66
+
67
+ describe SQLCmd, "when using a trusted connection with a username and password" do
68
+ before :all do
69
+ @cmd = SQLCmd.new
70
+ @cmd.log_level = :verbose
71
+ @cmd.extend(SystemPatch)
72
+ @cmd.disable_system = true
73
+
74
+ @cmd.scripts "somescript.sql"
75
+ @cmd.trusted_connection = true
76
+ @cmd.username = "user"
77
+ @cmd.password = "password"
78
+
79
+ @cmd.execute
80
+ end
81
+
82
+ it "should override the trusted connection and not specify the -E option" do
83
+ @cmd.system_command.should_not include("-E")
84
+ end
85
+
86
+ it "should specify the username" do
87
+ @cmd.system_command.should include("-U \"user\"")
88
+ end
89
+
90
+ it "should specify the password" do
91
+ @cmd.system_command.should include("-P \"password\"")
92
+ end
93
+ end
94
+
4
95
  describe SQLCmd, "when running a script file against a database with authentication information" do
5
96
  before :all do
6
97
  @cmd = SQLCmd.new
@@ -15,11 +106,11 @@ describe SQLCmd, "when running a script file against a database with authenticat
15
106
  @cmd.password="shh! it's a secret!"
16
107
  @cmd.scripts "somescript.sql"
17
108
 
18
- @cmd.run
109
+ @cmd.execute
19
110
  end
20
111
 
21
112
  it "should specify the location of the sqlcmd exe" do
22
- @cmd.system_command.should include("sqlcmd.exe")
113
+ @cmd.system_command.should include("SQLCMD.EXE")
23
114
  end
24
115
 
25
116
  it "should specify the script file" do
@@ -41,6 +132,10 @@ describe SQLCmd, "when running a script file against a database with authenticat
41
132
  it "should specify the password" do
42
133
  @cmd.system_command.should include("-P \"shh! it's a secret!\"")
43
134
  end
135
+
136
+ it "should not contain the -b option" do
137
+ @cmd.system_command.should_not include("-b")
138
+ end
44
139
  end
45
140
 
46
141
  describe SQLCmd, "when running with no command path specified" do
@@ -53,16 +148,18 @@ describe SQLCmd, "when running with no command path specified" do
53
148
  @cmd.extend(FailPatch)
54
149
  @cmd.disable_system = true
55
150
 
56
- @cmd.run
151
+ @cmd.execute
57
152
  @log_data = strio.string
58
153
  end
59
154
 
60
- it "should fail" do
61
- $task_failed.should be_true
62
- end
155
+ it "should find sqlcmd in the standard places or bail" do
156
+ $task_failed.should be_false if (File.exists?(File.join(ENV['SystemDrive'],'program files','microsoft sql server','100','tools','binn', 'sqlcmd.exe')))
157
+ $task_failed.should be_false if (File.exists?(File.join(ENV['SystemDrive'],'program files','microsoft sql server','90','tools','binn', 'sqlcmd.exe')))
158
+ $task_failed.should be_true if ((!(File.exists?(File.join(ENV['SystemDrive'],'program files','microsoft sql server','100','tools','binn', 'sqlcmd.exe')))) and (!(File.exists?(File.join(ENV['SystemDrive'],'program files','microsoft sql server','90','tools','binn', 'sqlcmd.exe')))))
159
+ end
63
160
 
64
- it "should log a failure message" do
65
- @log_data.should include('SQLCmd.command cannot be nil.')
161
+ it "should log a failure message if it cannot find sqlcmd in the standard places" do
162
+ @log_data.should include('SQLCmd.command cannot be nil.') if ((!(File.exists?(File.join(ENV['SystemDrive'],'program files','microsoft sql server','100','tools','binn', 'sqlcmd.exe')))) and (!(File.exists?(File.join(ENV['SystemDrive'],'program files','microsoft sql server','90','tools','binn', 'sqlcmd.exe')))))
66
163
  end
67
164
  end
68
165
 
@@ -78,7 +175,7 @@ describe SQLCmd, "when execution of sqlcmd fails" do
78
175
  @cmd.disable_system = true
79
176
  @cmd.force_system_failure = true
80
177
 
81
- @cmd.run
178
+ @cmd.execute
82
179
  @log_data = strio.string
83
180
  end
84
181
 
@@ -100,9 +197,49 @@ describe SQLCmd, "when running multiple script files" do
100
197
  @cmd.extend(SystemPatch)
101
198
  @cmd.disable_system = true
102
199
 
103
- @cmd.scripts "did you get.sql", "that thing.sql", "i sent you.sql"
200
+ scriptnames = Array.new
201
+ scriptnames << "did you get.sql\r\n"
202
+ scriptnames << "that thing.sql"
203
+ scriptnames << "i sent you.sql\r\n"
204
+ @cmd.scripts = scriptnames
205
+
206
+ @cmd.execute
207
+ end
208
+
209
+ it "should specify the first script file" do
210
+ @cmd.system_command.should include("-i \"did you get.sql\"")
211
+ end
212
+
213
+ it "should specify the second script file" do
214
+ @cmd.system_command.should include("-i \"that thing.sql\"")
215
+ end
216
+
217
+ it "should specify the third script file" do
218
+ @cmd.system_command.should include("-i \"i sent you.sql\"")
219
+ end
220
+
221
+ it "should include the -b option" do
222
+ @cmd.system_command.should include("-b")
223
+ end
224
+
225
+ end
226
+
227
+ describe SQLCmd, "when running multiple script files with batch_abort set to false" do
228
+ before :all do
229
+ @cmd = SQLCmd.new
230
+ @cmd.command = "sqlcmd.exe"
231
+ @cmd.log_level = :verbose
232
+ @cmd.extend(SystemPatch)
233
+ @cmd.disable_system = true
234
+ @cmd.batch_abort = false
235
+
236
+ scriptnames = Array.new
237
+ scriptnames << "did you get.sql\r\n"
238
+ scriptnames << "that thing.sql"
239
+ scriptnames << "i sent you.sql\r\n"
240
+ @cmd.scripts = scriptnames
104
241
 
105
- @cmd.run
242
+ @cmd.execute
106
243
  end
107
244
 
108
245
  it "should specify the first script file" do
@@ -116,6 +253,11 @@ describe SQLCmd, "when running multiple script files" do
116
253
  it "should specify the third script file" do
117
254
  @cmd.system_command.should include("-i \"i sent you.sql\"")
118
255
  end
256
+
257
+ it "should not include the -b option" do
258
+ @cmd.system_command.should_not include("-b")
259
+ end
260
+
119
261
  end
120
262
 
121
263
  describe SQLCmd, "when running with variables specified" do
@@ -129,7 +271,7 @@ describe SQLCmd, "when running with variables specified" do
129
271
 
130
272
  @cmd.variables :myvar => "my value", :another_var => :another_value
131
273
 
132
- @cmd.run
274
+ @cmd.execute
133
275
  end
134
276
 
135
277
  it "should supply the variables to sqlcmd" do