albacore 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. data/.autotest +4 -4
  2. data/.bundle/config +2 -2
  3. data/.rvmrc +1 -1
  4. data/Gemfile +12 -12
  5. data/README.markdown +92 -68
  6. data/VERSION +1 -1
  7. data/lib/albacore.rb +9 -9
  8. data/lib/albacore/albacoretask.rb +50 -50
  9. data/lib/albacore/aspnetcompiler.rb +58 -58
  10. data/lib/albacore/assemblyinfo.rb +140 -140
  11. data/lib/albacore/assemblyinfolanguages/cppcliengine.rb +17 -0
  12. data/lib/albacore/assemblyinfolanguages/csharpengine.rb +18 -18
  13. data/lib/albacore/assemblyinfolanguages/vbnetengine.rb +18 -18
  14. data/lib/albacore/config/aspnetcompilerconfig.rb +29 -29
  15. data/lib/albacore/config/assemblyinfoconfig.rb +13 -13
  16. data/lib/albacore/config/config.rb +22 -22
  17. data/lib/albacore/config/cscconfig.rb +28 -28
  18. data/lib/albacore/config/docuconfig.rb +23 -23
  19. data/lib/albacore/config/execconfig.rb +15 -15
  20. data/lib/albacore/config/fluentmigratorrunnerconfig.rb +15 -15
  21. data/lib/albacore/config/msbuildconfig.rb +29 -29
  22. data/lib/albacore/config/mspectestrunnerconfig.rb +15 -15
  23. data/lib/albacore/config/mstesttestrunnerconfig.rb +15 -15
  24. data/lib/albacore/config/nantconfig.rb +15 -15
  25. data/lib/albacore/config/nchurnconfig.rb +15 -15
  26. data/lib/albacore/config/ncoverconsoleconfig.rb +15 -15
  27. data/lib/albacore/config/ncoverreportconfig.rb +15 -15
  28. data/lib/albacore/config/ndependconfig.rb +15 -15
  29. data/lib/albacore/config/netversion.rb +21 -21
  30. data/lib/albacore/config/nugetpackconfig.rb +3 -3
  31. data/lib/albacore/config/nugetpublishconfig.rb +19 -0
  32. data/lib/albacore/config/nugetpushconfig.rb +19 -0
  33. data/lib/albacore/config/nunittestrunnerconfig.rb +14 -14
  34. data/lib/albacore/config/specflowreportconfig.rb +24 -24
  35. data/lib/albacore/config/sqlcmdconfig.rb +15 -15
  36. data/lib/albacore/config/unzipconfig.rb +15 -15
  37. data/lib/albacore/config/vssgetconfig.rb +14 -0
  38. data/lib/albacore/config/xbuildconfig.rb +15 -15
  39. data/lib/albacore/config/xunittestrunnerconfig.rb +15 -15
  40. data/lib/albacore/config/zipdirectoryconfig.rb +15 -15
  41. data/lib/albacore/csc.rb +66 -62
  42. data/lib/albacore/docu.rb +41 -41
  43. data/lib/albacore/exec.rb +18 -18
  44. data/lib/albacore/fluentmigratorrunner.rb +51 -46
  45. data/lib/albacore/msbuild.rb +55 -55
  46. data/lib/albacore/mspectestrunner.rb +50 -50
  47. data/lib/albacore/mstesttestrunner.rb +43 -43
  48. data/lib/albacore/nant.rb +38 -38
  49. data/lib/albacore/nchurn.rb +74 -74
  50. data/lib/albacore/ncoverconsole.rb +68 -68
  51. data/lib/albacore/ncoverreport.rb +62 -62
  52. data/lib/albacore/ncoverreports/assemblyfilter.rb +9 -9
  53. data/lib/albacore/ncoverreports/branchcoverage.rb +9 -9
  54. data/lib/albacore/ncoverreports/classfilter.rb +9 -9
  55. data/lib/albacore/ncoverreports/codecoveragebase.rb +25 -25
  56. data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +23 -23
  57. data/lib/albacore/ncoverreports/documentfilter.rb +9 -9
  58. data/lib/albacore/ncoverreports/fullcoveragereport.rb +13 -13
  59. data/lib/albacore/ncoverreports/methodcoverage.rb +9 -9
  60. data/lib/albacore/ncoverreports/methodfilter.rb +9 -9
  61. data/lib/albacore/ncoverreports/namespacefilter.rb +9 -9
  62. data/lib/albacore/ncoverreports/reportfilterbase.rb +26 -26
  63. data/lib/albacore/ncoverreports/summaryreport.rb +18 -18
  64. data/lib/albacore/ncoverreports/symbolcoverage.rb +9 -9
  65. data/lib/albacore/ndepend.rb +33 -33
  66. data/lib/albacore/nugetpublish.rb +47 -0
  67. data/lib/albacore/nugetpush.rb +46 -0
  68. data/lib/albacore/nunittestrunner.rb +41 -41
  69. data/lib/albacore/nuspec.rb +133 -109
  70. data/lib/albacore/output.rb +99 -99
  71. data/lib/albacore/plink.rb +47 -47
  72. data/lib/albacore/specflowreport.rb +62 -62
  73. data/lib/albacore/sqlcmd.rb +80 -80
  74. data/lib/albacore/support/attrmethods.rb +33 -33
  75. data/lib/albacore/support/createtask.rb +50 -30
  76. data/lib/albacore/support/failure.rb +15 -15
  77. data/lib/albacore/support/logging.rb +38 -38
  78. data/lib/albacore/support/openstruct.rb +13 -13
  79. data/lib/albacore/support/runcommand.rb +45 -45
  80. data/lib/albacore/support/supportlinux.rb +23 -23
  81. data/lib/albacore/support/updateattributes.rb +13 -13
  82. data/lib/albacore/support/yamlconfig.rb +18 -18
  83. data/lib/albacore/unzip.rb +28 -28
  84. data/lib/albacore/vssget.rb +44 -0
  85. data/lib/albacore/xbuild.rb +54 -54
  86. data/lib/albacore/xunittestrunner.rb +52 -52
  87. data/lib/albacore/zipdirectory.rb +105 -105
  88. data/rakefile.rb +297 -297
  89. data/spec/albacoremodel_spec.rb +53 -53
  90. data/spec/assemblyinfo_spec.rb +541 -541
  91. data/spec/attrmethods_spec.rb +136 -136
  92. data/spec/config_spec.rb +34 -34
  93. data/spec/createtask_spec.rb +236 -236
  94. data/spec/csc_spec.rb +253 -253
  95. data/spec/docu_spec.rb +109 -109
  96. data/spec/exec_spec.rb +45 -45
  97. data/spec/fluentmigratorrunner_spec.rb +254 -185
  98. data/spec/msbuild_spec.rb +215 -215
  99. data/spec/mspec_spec.rb +28 -28
  100. data/spec/mstesttestrunner_spec.rb +142 -142
  101. data/spec/nant_spec.rb +110 -110
  102. data/spec/nchurn_spec.rb +75 -75
  103. data/spec/ncoverconsole_spec.rb +353 -353
  104. data/spec/ncoverreport_spec.rb +619 -619
  105. data/spec/ndepend_spec.rb +72 -72
  106. data/spec/nunittestrunner_spec.rb +122 -122
  107. data/spec/nuspec_spec.rb +78 -78
  108. data/spec/patches/docu_patch.rb +12 -12
  109. data/spec/patches/fail_patch.rb +8 -8
  110. data/spec/patches/system_patch.rb +20 -20
  111. data/spec/plink_spec.rb +62 -62
  112. data/spec/runcommand_spec.rb +94 -94
  113. data/spec/spec_helper.rb +17 -17
  114. data/spec/specflowreport_spec.rb +146 -146
  115. data/spec/sqlcmd_spec.rb +334 -334
  116. data/spec/support/assemblyinfotester.rb +51 -51
  117. data/spec/support/ironruby_validator.rb +26 -26
  118. data/spec/support/msbuildtestdata.rb +32 -32
  119. data/spec/support/nanttestdata.rb +33 -33
  120. data/spec/support/ncoverconsoletestdata.rb +19 -19
  121. data/spec/support/ncoverreporttestdata.rb +26 -26
  122. data/spec/support/nokogiri_validator.rb +15 -15
  123. data/spec/support/outputtestdata.rb +12 -12
  124. data/spec/support/ziptestdata.rb +12 -12
  125. data/spec/unzip_spec.rb +15 -15
  126. data/spec/xbuild_spec.rb +15 -15
  127. data/spec/xunit_spec.rb +168 -168
  128. data/spec/yamlconfig_spec.rb +49 -49
  129. data/spec/zip_spec.rb +104 -104
  130. data/watchrtesting.rb +8 -8
  131. metadata +15 -119
@@ -1,72 +1,72 @@
1
- require 'spec_helper'
2
- require 'albacore/ndepend'
3
- require 'albacore/msbuild'
4
-
5
- describe "when executing Ndepend console" do
6
- before :all do
7
- @msbuild = MSBuild.new
8
- @msbuild.properties = {:configuration => :Debug}
9
- @msbuild.targets = [:Clean, :Build]
10
- @msbuild.solution = "spec/support/TestSolution/TestSolution.sln"
11
- @msbuild.execute
12
- end
13
- before :each do
14
- @ndepend = NDepend.new
15
- @ndepend.log_device = StringIO.new
16
- @ndepend.project_file = "spec/support/TestSolution/NDependProject.xml"
17
- @ndepend.command = "spec/support/tools/Ndepend-v2.12/NDepend.Console.exe"
18
-
19
- @logger = StringIO.new
20
- @ndepend.log_device = @logger
21
- @log_data = @logger.string
22
- @ndepend.log_level = :verbose
23
-
24
-
25
- end
26
- it "should execute NdependConsole.exe"do
27
- @ndepend.execute
28
-
29
- @log_data.should include("NDepend.Console.exe" )
30
- end
31
-
32
- it "should include the Ndepend project file" do
33
- @ndepend.execute
34
- @log_data.should include("NDependProject.xml")
35
- end
36
-
37
- it "should fail when the project file is not given" do
38
- @ndepend.project_file = nil
39
- @ndepend.extend(FailPatch)
40
- @ndepend.execute
41
- $task_failed.should be_true
42
- end
43
-
44
- it "should accept other parameters" do
45
- expected_params = "/ViewReport /Silent /Help"
46
- @ndepend.parameters expected_params
47
- @ndepend.extend(FailPatch)
48
- @ndepend.execute
49
- @log_data.should include(expected_params)
50
- end
51
-
52
- it "should order command line properly by including ndepend project file first" do
53
- expected_params = "/Help"
54
- @ndepend.parameters expected_params
55
- @ndepend.extend(FailPatch)
56
- @ndepend.execute
57
- @log_data.should =~ /.*NDepend.Console.exe.*NDependProject.xml.*Help.*/
58
- end
59
- end
60
-
61
- describe NDepend, "when providing configuration" do
62
- let :ndepend do
63
- Albacore.configure do |config|
64
- config.ndepend.command = "configured"
65
- end
66
- ndepend = NDepend.new
67
- end
68
-
69
- it "should use the configured values" do
70
- ndepend.command.should == "configured"
71
- end
72
- end
1
+ require 'spec_helper'
2
+ require 'albacore/ndepend'
3
+ require 'albacore/msbuild'
4
+
5
+ describe "when executing Ndepend console" do
6
+ before :all do
7
+ @msbuild = MSBuild.new
8
+ @msbuild.properties = {:configuration => :Debug}
9
+ @msbuild.targets = [:Clean, :Build]
10
+ @msbuild.solution = "spec/support/TestSolution/TestSolution.sln"
11
+ @msbuild.execute
12
+ end
13
+ before :each do
14
+ @ndepend = NDepend.new
15
+ @ndepend.log_device = StringIO.new
16
+ @ndepend.project_file = "spec/support/TestSolution/NDependProject.xml"
17
+ @ndepend.command = "spec/support/tools/Ndepend-v2.12/NDepend.Console.exe"
18
+
19
+ @logger = StringIO.new
20
+ @ndepend.log_device = @logger
21
+ @log_data = @logger.string
22
+ @ndepend.log_level = :verbose
23
+
24
+
25
+ end
26
+ it "should execute NdependConsole.exe"do
27
+ @ndepend.execute
28
+
29
+ @log_data.should include("NDepend.Console.exe" )
30
+ end
31
+
32
+ it "should include the Ndepend project file" do
33
+ @ndepend.execute
34
+ @log_data.should include("NDependProject.xml")
35
+ end
36
+
37
+ it "should fail when the project file is not given" do
38
+ @ndepend.project_file = nil
39
+ @ndepend.extend(FailPatch)
40
+ @ndepend.execute
41
+ $task_failed.should be_true
42
+ end
43
+
44
+ it "should accept other parameters" do
45
+ expected_params = "/ViewReport /Silent /Help"
46
+ @ndepend.parameters expected_params
47
+ @ndepend.extend(FailPatch)
48
+ @ndepend.execute
49
+ @log_data.should include(expected_params)
50
+ end
51
+
52
+ it "should order command line properly by including ndepend project file first" do
53
+ expected_params = "/Help"
54
+ @ndepend.parameters expected_params
55
+ @ndepend.extend(FailPatch)
56
+ @ndepend.execute
57
+ @log_data.should =~ /.*NDepend.Console.exe.*NDependProject.xml.*Help.*/
58
+ end
59
+ end
60
+
61
+ describe NDepend, "when providing configuration" do
62
+ let :ndepend do
63
+ Albacore.configure do |config|
64
+ config.ndepend.command = "configured"
65
+ end
66
+ ndepend = NDepend.new
67
+ end
68
+
69
+ it "should use the configured values" do
70
+ ndepend.command.should == "configured"
71
+ end
72
+ end
@@ -1,122 +1,122 @@
1
- require 'spec_helper'
2
- require 'albacore/nunittestrunner'
3
-
4
- shared_examples_for "nunit paths" do
5
- before :all do
6
- @nunitpath = File.join(File.dirname(__FILE__), 'support', 'Tools', 'NUnit-v2.5', 'nunit-console-x86.exe')
7
- @test_assembly = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'nunit', 'assemblies', 'TestSolution.Tests.dll')
8
- @failing_test_assembly = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'nunit', 'failing_assemblies', 'TestSolution.FailingTests.dll')
9
- @output_option = "/out=nunit.results.html"
10
- end
11
- end
12
-
13
- describe NUnitTestRunner, "the command parameters for an nunit runner" do
14
- it_should_behave_like "nunit paths"
15
-
16
- before :all do
17
- nunit = NUnitTestRunner.new(@nunitpath)
18
- nunit.assemblies @test_assembly, @failing_test_assembly
19
- nunit.options @output_option
20
-
21
- @command_parameters = nunit.get_command_parameters
22
- end
23
-
24
- it "should not include the path to the command" do
25
- @command_parameters.should_not include(@nunitpath)
26
- end
27
-
28
- it "should include the list of assemblies" do
29
- @command_parameters.should include("\"#{@test_assembly}\" \"#{@failing_test_assembly}\"")
30
- end
31
-
32
- it "should include the list of options" do
33
- @command_parameters.should include(@output_option)
34
- end
35
- end
36
-
37
- describe NUnitTestRunner, "the command line string for an nunit runner" do
38
- it_should_behave_like "nunit paths"
39
-
40
- before :all do
41
- nunit = NUnitTestRunner.new(@nunitpath)
42
- nunit.assemblies @test_assembly
43
- nunit.options @output_option
44
-
45
- @command_line = nunit.get_command_line
46
- @command_parameters = nunit.get_command_parameters.join(" ")
47
- end
48
-
49
- it "should start with the path to the command" do
50
- @command_line.split(" ").first.should == @nunitpath
51
- end
52
-
53
- it "should include the command parameters" do
54
- @command_line.should include(@command_parameters)
55
- end
56
- end
57
-
58
-
59
- describe NUnitTestRunner, "when configured correctly" do
60
- it_should_behave_like "nunit paths"
61
-
62
- before :all do
63
- nunit = NUnitTestRunner.new(@nunitpath)
64
- nunit.extend(FailPatch)
65
- nunit.assemblies @test_assembly
66
- nunit.options '/noshadow'
67
-
68
- nunit.execute
69
- end
70
-
71
- it "should execute" do
72
- $task_failed.should be_false
73
- end
74
- end
75
-
76
- describe NUnitTestRunner, "when using the configuration command and not providing a command in the intializer" do
77
- it_should_behave_like "nunit paths"
78
-
79
- before :all do
80
- Albacore.configure do |config|
81
- config.nunit.command = "configured command"
82
- end
83
- @nunit = NUnitTestRunner.new
84
- end
85
-
86
- it "should use the configuration command" do
87
- @nunit.command.should == "configured command"
88
- end
89
- end
90
-
91
- describe NUnitTestRunner, "when the command has been set through configuration and providing a command in the intializer" do
92
- it_should_behave_like "nunit paths"
93
-
94
- before :all do
95
- Albacore.configure do |config|
96
- config.nunit.command = "configured command"
97
- end
98
- @nunit = NUnitTestRunner.new("initializer command")
99
- end
100
-
101
- it "should use the initializer command" do
102
- @nunit.command.should == "initializer command"
103
- end
104
- end
105
-
106
- describe NUnitTestRunner, "when configuration has been provided" do
107
- before :all do
108
- Albacore.configure do |config|
109
- config.nunit do |nunit|
110
- nunit.assemblies = ["foo.dll", "bar.dll"]
111
- nunit.options = ["/noshadow"]
112
- end
113
- end
114
-
115
- @nunit = NUnitTestRunner.new
116
- end
117
-
118
- it "should use the provided configuration" do
119
- @nunit.assemblies.should == ["foo.dll", "bar.dll"]
120
- @nunit.options.should == ["/noshadow"]
121
- end
122
- end
1
+ require 'spec_helper'
2
+ require 'albacore/nunittestrunner'
3
+
4
+ shared_examples_for "nunit paths" do
5
+ before :all do
6
+ @nunitpath = File.join(File.dirname(__FILE__), 'support', 'Tools', 'NUnit-v2.5', 'nunit-console-x86.exe')
7
+ @test_assembly = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'nunit', 'assemblies', 'TestSolution.Tests.dll')
8
+ @failing_test_assembly = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'nunit', 'failing_assemblies', 'TestSolution.FailingTests.dll')
9
+ @output_option = "/out=nunit.results.html"
10
+ end
11
+ end
12
+
13
+ describe NUnitTestRunner, "the command parameters for an nunit runner" do
14
+ it_should_behave_like "nunit paths"
15
+
16
+ before :all do
17
+ nunit = NUnitTestRunner.new(@nunitpath)
18
+ nunit.assemblies @test_assembly, @failing_test_assembly
19
+ nunit.options @output_option
20
+
21
+ @command_parameters = nunit.get_command_parameters
22
+ end
23
+
24
+ it "should not include the path to the command" do
25
+ @command_parameters.should_not include(@nunitpath)
26
+ end
27
+
28
+ it "should include the list of assemblies" do
29
+ @command_parameters.should include("\"#{@test_assembly}\" \"#{@failing_test_assembly}\"")
30
+ end
31
+
32
+ it "should include the list of options" do
33
+ @command_parameters.should include(@output_option)
34
+ end
35
+ end
36
+
37
+ describe NUnitTestRunner, "the command line string for an nunit runner" do
38
+ it_should_behave_like "nunit paths"
39
+
40
+ before :all do
41
+ nunit = NUnitTestRunner.new(@nunitpath)
42
+ nunit.assemblies @test_assembly
43
+ nunit.options @output_option
44
+
45
+ @command_line = nunit.get_command_line
46
+ @command_parameters = nunit.get_command_parameters.join(" ")
47
+ end
48
+
49
+ it "should start with the path to the command" do
50
+ @command_line.split(" ").first.should == @nunitpath
51
+ end
52
+
53
+ it "should include the command parameters" do
54
+ @command_line.should include(@command_parameters)
55
+ end
56
+ end
57
+
58
+
59
+ describe NUnitTestRunner, "when configured correctly" do
60
+ it_should_behave_like "nunit paths"
61
+
62
+ before :all do
63
+ nunit = NUnitTestRunner.new(@nunitpath)
64
+ nunit.extend(FailPatch)
65
+ nunit.assemblies @test_assembly
66
+ nunit.options '/noshadow'
67
+
68
+ nunit.execute
69
+ end
70
+
71
+ it "should execute" do
72
+ $task_failed.should be_false
73
+ end
74
+ end
75
+
76
+ describe NUnitTestRunner, "when using the configuration command and not providing a command in the intializer" do
77
+ it_should_behave_like "nunit paths"
78
+
79
+ before :all do
80
+ Albacore.configure do |config|
81
+ config.nunit.command = "configured command"
82
+ end
83
+ @nunit = NUnitTestRunner.new
84
+ end
85
+
86
+ it "should use the configuration command" do
87
+ @nunit.command.should == "configured command"
88
+ end
89
+ end
90
+
91
+ describe NUnitTestRunner, "when the command has been set through configuration and providing a command in the intializer" do
92
+ it_should_behave_like "nunit paths"
93
+
94
+ before :all do
95
+ Albacore.configure do |config|
96
+ config.nunit.command = "configured command"
97
+ end
98
+ @nunit = NUnitTestRunner.new("initializer command")
99
+ end
100
+
101
+ it "should use the initializer command" do
102
+ @nunit.command.should == "initializer command"
103
+ end
104
+ end
105
+
106
+ describe NUnitTestRunner, "when configuration has been provided" do
107
+ before :all do
108
+ Albacore.configure do |config|
109
+ config.nunit do |nunit|
110
+ nunit.assemblies = ["foo.dll", "bar.dll"]
111
+ nunit.options = ["/noshadow"]
112
+ end
113
+ end
114
+
115
+ @nunit = NUnitTestRunner.new
116
+ end
117
+
118
+ it "should use the provided configuration" do
119
+ @nunit.assemblies.should == ["foo.dll", "bar.dll"]
120
+ @nunit.options.should == ["/noshadow"]
121
+ end
122
+ end
@@ -1,78 +1,78 @@
1
- require 'fileutils'
2
- require 'spec_helper.rb'
3
- require 'albacore/nuspec.rb'
4
-
5
- if IS_IRONRUBY
6
- require 'support\ironruby_validator'
7
- else
8
- require 'support\nokogiri_validator'
9
- end
10
-
11
- describe Nuspec do
12
- let(:working_dir) do
13
- wd = File.expand_path(File.join(File.dirname(__FILE__), 'support/nuspec/output'))
14
- FileUtils.mkdir(wd) unless File.exist?(wd)
15
- wd
16
- end
17
- let(:nuspec_output) { File.join(working_dir, 'nuspec_test.nuspec') }
18
- let(:schema_file) { File.expand_path(File.join(working_dir, '../', 'nuspec.xsd')) }
19
-
20
- describe 'when creating a file with minimum requirements' do
21
- let(:nuspec) do
22
- nuspec = Nuspec.new
23
- nuspec.id="nuspec_test"
24
- nuspec.output_file = "nuspec_test.nuspec"
25
- nuspec.version = "1.2.3"
26
- nuspec.authors = "Author Name"
27
- nuspec.description = "test_xml_document"
28
- nuspec.working_directory = working_dir
29
- nuspec
30
- end
31
-
32
- before do
33
- nuspec.execute
34
- end
35
-
36
- it "should produce the nuspec xml" do
37
- File.exist?(nuspec_output).should be_true
38
- end
39
-
40
- it "should produce a valid xml file" do
41
- is_valid = XmlValidator.validate(nuspec_output, schema_file)
42
- is_valid.should be_true
43
- end
44
- end
45
-
46
- describe "file targets" do
47
- let(:dll) { File.expand_path(File.join(working_dir, '../', 'somedll.dll')) }
48
-
49
- let(:nuspec) do
50
- nuspec = Nuspec.new
51
- nuspec.id="nuspec_test"
52
- nuspec.output_file = "nuspec_test.nuspec"
53
- nuspec.title = "Title"
54
- nuspec.version = "1.2.3"
55
- nuspec.authors = "Author Name"
56
- nuspec.description = "test_xml_document"
57
- nuspec.working_directory = working_dir
58
- nuspec.file(dll, "lib")
59
- nuspec
60
- end
61
-
62
- before do
63
- nuspec.execute
64
- File.open(nuspec_output, "r") do |f|
65
- @filedata = f.read
66
- end
67
- end
68
-
69
- it "should produce a valid nuspec file" do
70
- is_valid = XmlValidator.validate(nuspec_output, schema_file)
71
- is_valid.should be_true
72
- end
73
-
74
- it "should contain the file and it's target" do
75
- @filedata.should include("<file src='C:/dev/albacore/spec/support/nuspec/somedll.dll' target='lib'/>")
76
- end
77
- end
78
- end
1
+ require 'fileutils'
2
+ require 'spec_helper.rb'
3
+ require 'albacore/nuspec.rb'
4
+
5
+ if IS_IRONRUBY
6
+ require 'support\ironruby_validator'
7
+ else
8
+ require 'support\nokogiri_validator'
9
+ end
10
+
11
+ describe Nuspec do
12
+ let(:working_dir) do
13
+ wd = File.expand_path(File.join(File.dirname(__FILE__), 'support/nuspec/output'))
14
+ FileUtils.mkdir(wd) unless File.exist?(wd)
15
+ wd
16
+ end
17
+ let(:nuspec_output) { File.join(working_dir, 'nuspec_test.nuspec') }
18
+ let(:schema_file) { File.expand_path(File.join(working_dir, '../', 'nuspec.xsd')) }
19
+
20
+ describe 'when creating a file with minimum requirements' do
21
+ let(:nuspec) do
22
+ nuspec = Nuspec.new
23
+ nuspec.id="nuspec_test"
24
+ nuspec.output_file = "nuspec_test.nuspec"
25
+ nuspec.version = "1.2.3"
26
+ nuspec.authors = "Author Name"
27
+ nuspec.description = "test_xml_document"
28
+ nuspec.working_directory = working_dir
29
+ nuspec
30
+ end
31
+
32
+ before do
33
+ nuspec.execute
34
+ end
35
+
36
+ it "should produce the nuspec xml" do
37
+ File.exist?(nuspec_output).should be_true
38
+ end
39
+
40
+ it "should produce a valid xml file" do
41
+ is_valid = XmlValidator.validate(nuspec_output, schema_file)
42
+ is_valid.should be_true
43
+ end
44
+ end
45
+
46
+ describe "file targets" do
47
+ let(:dll) { File.expand_path(File.join(working_dir, '../', 'somedll.dll')) }
48
+
49
+ let(:nuspec) do
50
+ nuspec = Nuspec.new
51
+ nuspec.id="nuspec_test"
52
+ nuspec.output_file = "nuspec_test.nuspec"
53
+ nuspec.title = "Title"
54
+ nuspec.version = "1.2.3"
55
+ nuspec.authors = "Author Name"
56
+ nuspec.description = "test_xml_document"
57
+ nuspec.working_directory = working_dir
58
+ nuspec.file(dll, "lib")
59
+ nuspec
60
+ end
61
+
62
+ before do
63
+ nuspec.execute
64
+ File.open(nuspec_output, "r") do |f|
65
+ @filedata = f.read
66
+ end
67
+ end
68
+
69
+ it "should produce a valid nuspec file" do
70
+ is_valid = XmlValidator.validate(nuspec_output, schema_file)
71
+ is_valid.should be_true
72
+ end
73
+
74
+ it "should contain the file and it's target" do
75
+ @filedata.should include("<file src='C:/dev/albacore/spec/support/nuspec/somedll.dll' target='lib'/>")
76
+ end
77
+ end
78
+ end