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,109 +1,109 @@
1
- require 'spec_helper'
2
- require 'albacore/docu'
3
- require 'docu_patch'
4
-
5
- describe Docu, "when building docs without any assemblies specified" do
6
- before :all do
7
- @docu = Docu.new
8
- @docu.execute
9
- end
10
-
11
- it "should fail with a missing assemblies message" do
12
- @docu.failed.should be_true
13
- @docu.failure_message.should eql('Docu Failed. No assemblies specified')
14
- end
15
- end
16
-
17
- describe Docu, "when building docs fails" do
18
- before :all do
19
- @docu = Docu.new
20
- @docu.command_result = false
21
- @docu.assemblies 'test.dll'
22
- @docu.execute
23
- end
24
-
25
- it "should fail with a generic message" do
26
- @docu.failed.should be_true
27
- @docu.failure_message.should eql('Docu Failed. See Build Log For Detail')
28
- end
29
- end
30
-
31
- describe Docu, "when building docs with assemblies specified" do
32
- before :all do
33
- @docu = Docu.new
34
- @docu.command_result = true
35
- @docu.assemblies 'test.dll'
36
- @docu.execute
37
- end
38
-
39
- it "should pass the assemblies in the command-line arguments" do
40
- @docu.command_parameters.should include('test.dll')
41
- end
42
- end
43
-
44
- describe Docu, "when building docs with assemblies and xml files specified" do
45
- before :all do
46
- @docu = Docu.new
47
- @docu.command_result = true
48
- @docu.xml_files 'test.xml'
49
- @docu.assemblies 'test.dll'
50
- @docu.execute
51
- end
52
-
53
- it "should pass the xml files in the command-line arguments after the assemblies" do
54
- @docu.command_parameters.should include('test.dll test.xml')
55
- end
56
- end
57
-
58
- describe Docu, "when building docs with an output location specified" do
59
- before :all do
60
- @docu = Docu.new
61
- @docu.command_result = true
62
- @docu.assemblies 'test.dll'
63
- @docu.output_location = 'output_location'
64
- @docu.execute
65
- end
66
-
67
- it "should pass the output location using the --output switch" do
68
- @docu.command_parameters.should include('--output="output_location"')
69
- end
70
- end
71
-
72
- describe Docu, "when no command has been specified" do
73
- let :docu do
74
- docu = Docu.new
75
- docu
76
- end
77
-
78
- it "should default to the standard docu.exe" do
79
- docu.command.should == "Docu.exe"
80
- end
81
- end
82
-
83
- describe Docu, "when the command has been provided through configuration" do
84
- let :docu do
85
- Albacore.configure do |config|
86
- config.docu.command = "configured"
87
- end
88
- docu = Docu.new
89
- docu
90
- end
91
-
92
- it "should use the configured command" do
93
- docu.command.should == "configured"
94
- end
95
- end
96
-
97
- describe Docu, "when the command has been provided through configuration and is overriden through the initializer" do
98
- let :docu do
99
- Albacore.configure do |config|
100
- config.docu.command = "configured"
101
- end
102
- docu = Docu.new("override")
103
- docu
104
- end
105
-
106
- it "should use the override" do
107
- docu.command.should == "override"
108
- end
109
- end
1
+ require 'spec_helper'
2
+ require 'albacore/docu'
3
+ require 'docu_patch'
4
+
5
+ describe Docu, "when building docs without any assemblies specified" do
6
+ before :all do
7
+ @docu = Docu.new
8
+ @docu.execute
9
+ end
10
+
11
+ it "should fail with a missing assemblies message" do
12
+ @docu.failed.should be_true
13
+ @docu.failure_message.should eql('Docu Failed. No assemblies specified')
14
+ end
15
+ end
16
+
17
+ describe Docu, "when building docs fails" do
18
+ before :all do
19
+ @docu = Docu.new
20
+ @docu.command_result = false
21
+ @docu.assemblies 'test.dll'
22
+ @docu.execute
23
+ end
24
+
25
+ it "should fail with a generic message" do
26
+ @docu.failed.should be_true
27
+ @docu.failure_message.should eql('Docu Failed. See Build Log For Detail')
28
+ end
29
+ end
30
+
31
+ describe Docu, "when building docs with assemblies specified" do
32
+ before :all do
33
+ @docu = Docu.new
34
+ @docu.command_result = true
35
+ @docu.assemblies 'test.dll'
36
+ @docu.execute
37
+ end
38
+
39
+ it "should pass the assemblies in the command-line arguments" do
40
+ @docu.command_parameters.should include('test.dll')
41
+ end
42
+ end
43
+
44
+ describe Docu, "when building docs with assemblies and xml files specified" do
45
+ before :all do
46
+ @docu = Docu.new
47
+ @docu.command_result = true
48
+ @docu.xml_files 'test.xml'
49
+ @docu.assemblies 'test.dll'
50
+ @docu.execute
51
+ end
52
+
53
+ it "should pass the xml files in the command-line arguments after the assemblies" do
54
+ @docu.command_parameters.should include('test.dll test.xml')
55
+ end
56
+ end
57
+
58
+ describe Docu, "when building docs with an output location specified" do
59
+ before :all do
60
+ @docu = Docu.new
61
+ @docu.command_result = true
62
+ @docu.assemblies 'test.dll'
63
+ @docu.output_location = 'output_location'
64
+ @docu.execute
65
+ end
66
+
67
+ it "should pass the output location using the --output switch" do
68
+ @docu.command_parameters.should include('--output="output_location"')
69
+ end
70
+ end
71
+
72
+ describe Docu, "when no command has been specified" do
73
+ let :docu do
74
+ docu = Docu.new
75
+ docu
76
+ end
77
+
78
+ it "should default to the standard docu.exe" do
79
+ docu.command.should == "Docu.exe"
80
+ end
81
+ end
82
+
83
+ describe Docu, "when the command has been provided through configuration" do
84
+ let :docu do
85
+ Albacore.configure do |config|
86
+ config.docu.command = "configured"
87
+ end
88
+ docu = Docu.new
89
+ docu
90
+ end
91
+
92
+ it "should use the configured command" do
93
+ docu.command.should == "configured"
94
+ end
95
+ end
96
+
97
+ describe Docu, "when the command has been provided through configuration and is overriden through the initializer" do
98
+ let :docu do
99
+ Albacore.configure do |config|
100
+ config.docu.command = "configured"
101
+ end
102
+ docu = Docu.new("override")
103
+ docu
104
+ end
105
+
106
+ it "should use the override" do
107
+ docu.command.should == "override"
108
+ end
109
+ end
@@ -1,45 +1,45 @@
1
- require 'spec_helper'
2
- require 'albacore/exec'
3
-
4
- describe Exec, "when executing a command with parameters" do
5
- before :all do
6
- @nunit = File.join(File.dirname(__FILE__), 'support', 'Tools', 'NUnit-v2.5', 'nunit-console-x86.exe')
7
-
8
- @cmd = Exec.new
9
- @cmd.log_level = :verbose
10
- @cmd.extend(SystemPatch)
11
- @cmd.extend(FailPatch)
12
- @cmd.command = @nunit
13
- @cmd.parameters "--help"
14
- @cmd.execute
15
- end
16
-
17
- it "should run the command with the parameters" do
18
- @cmd.system_command.should include("\"#{File.expand_path(@nunit)}\" --help")
19
- end
20
-
21
- it "should specify the parameters only once" do
22
- @cmd.system_command.scan(/--help/).length.should be(1)
23
- end
24
-
25
- it "should not fail" do
26
- $task_failed.should be_false
27
- end
28
- end
29
-
30
- describe Exec, "when providing configuration" do
31
- let :exec do
32
- Albacore.configure do |config|
33
- config.exec do |exe|
34
- exe.command = "foo.exe"
35
- exe.parameters = ["bar", "baz"]
36
- end
37
- end
38
- exec = Exec.new
39
- end
40
-
41
- it "should use the configuration" do
42
- exec.command.should == "foo.exe"
43
- exec.parameters.should == ["bar", "baz"]
44
- end
45
- end
1
+ require 'spec_helper'
2
+ require 'albacore/exec'
3
+
4
+ describe Exec, "when executing a command with parameters" do
5
+ before :all do
6
+ @nunit = File.join(File.dirname(__FILE__), 'support', 'Tools', 'NUnit-v2.5', 'nunit-console-x86.exe')
7
+
8
+ @cmd = Exec.new
9
+ @cmd.log_level = :verbose
10
+ @cmd.extend(SystemPatch)
11
+ @cmd.extend(FailPatch)
12
+ @cmd.command = @nunit
13
+ @cmd.parameters "--help"
14
+ @cmd.execute
15
+ end
16
+
17
+ it "should run the command with the parameters" do
18
+ @cmd.system_command.should include("\"#{File.expand_path(@nunit)}\" --help")
19
+ end
20
+
21
+ it "should specify the parameters only once" do
22
+ @cmd.system_command.scan(/--help/).length.should be(1)
23
+ end
24
+
25
+ it "should not fail" do
26
+ $task_failed.should be_false
27
+ end
28
+ end
29
+
30
+ describe Exec, "when providing configuration" do
31
+ let :exec do
32
+ Albacore.configure do |config|
33
+ config.exec do |exe|
34
+ exe.command = "foo.exe"
35
+ exe.parameters = ["bar", "baz"]
36
+ end
37
+ end
38
+ exec = Exec.new
39
+ end
40
+
41
+ it "should use the configuration" do
42
+ exec.command.should == "foo.exe"
43
+ exec.parameters.should == ["bar", "baz"]
44
+ end
45
+ end
@@ -1,185 +1,254 @@
1
- require 'spec_helper'
2
- require 'albacore/fluentmigratorrunner'
3
-
4
- shared_examples_for "fluentmigrator paths" do
5
- before :all do
6
- @fluent_migrator_path = File.join(File.dirname(__FILE__), 'support', 'Tools', 'FluentMigrator-0.9', 'Migrate.exe')
7
- @test_assembly = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'fluentmigrator', 'assemblies', 'TestSolution.FluentMigrator.dll')
8
- end
9
- end
10
-
11
- describe FluentMigratorRunner, "the command parameters for an migrator runner" do
12
- it_should_behave_like "fluentmigrator paths"
13
-
14
- before :all do
15
- @migrator = FluentMigratorRunner.new(@fluent_migrator_path)
16
- end
17
-
18
- context "Required params" do
19
- before :all do
20
- @command_parameters = @migrator.get_command_parameters
21
- end
22
-
23
- it "doesn't include command" do
24
- @command_parameters.should_not include(@fluent_migrator_path)
25
- end
26
-
27
- it "includes target" do
28
- @command_parameters.should include("/target")
29
- end
30
-
31
- it "includes provider" do
32
- @command_parameters.should include("/provider")
33
- end
34
-
35
- it "includes connection" do
36
- @command_parameters.should include("/connection")
37
- end
38
- end
39
-
40
- context "Optional options" do
41
- before :all do
42
- @migrator.namespace = 'namespace'
43
- @migrator.output = 'output.txt'
44
- @migrator.preview = 1
45
- @migrator.steps = 1
46
- @migrator.task = 'migrate:up'
47
- @migrator.version = '001'
48
- @migrator.verbose = 1
49
- @migrator.script_directory = 'c:\scripts'
50
- @migrator.profile = 'MyProfile'
51
- @migrator.timeout = 90
52
- @command_parameters = @migrator.get_command_parameters
53
- end
54
-
55
- it "includes ns" do
56
- @command_parameters.should include('/ns')
57
- end
58
-
59
- it "includes ouy" do
60
- @command_parameters.should include('/out')
61
- end
62
-
63
- it "includes preview" do
64
- @command_parameters.should include('/preview')
65
- end
66
-
67
- it "includes steps" do
68
- @command_parameters.should include('/steps')
69
- end
70
-
71
- it "includes task" do
72
- @command_parameters.should include('/task')
73
- end
74
-
75
- it "includes version" do
76
- @command_parameters.should include('/version')
77
- end
78
-
79
- it "includes verbose" do
80
- @command_parameters.should include('/verbose')
81
- end
82
-
83
- it "includes wd" do
84
- @command_parameters.should include('/wd')
85
- end
86
-
87
- it "includes profile" do
88
- @command_parameters.should include('/profile')
89
- end
90
-
91
- it "includes timeout" do
92
- @command_parameters.should include('/timeout')
93
- end
94
- end
95
- end
96
-
97
- describe FluentMigratorRunner, "the command line string for an fluentmigrator runner" do
98
- it_should_behave_like "fluentmigrator paths"
99
-
100
- before :all do
101
- migrator = FluentMigratorRunner.new(@fluent_migrator_path)
102
- migrator.target = @test_assembly
103
-
104
- @command_line = migrator.get_command_line
105
- @command_parameters = migrator.get_command_parameters
106
- end
107
-
108
- it "starts with the path to the command" do
109
- @command_line.should =~ /^#{@fluent_migrator_path}.*$/
110
- end
111
-
112
- it "includes the command parameters" do
113
- @command_line.downcase.should include(@command_parameters.downcase)
114
- end
115
- end
116
-
117
- describe FluentMigratorRunner, "when using the configuration command and not providing a command in the intializer" do
118
- it_should_behave_like "fluentmigrator paths"
119
-
120
- before :all do
121
- Albacore.configure do |config|
122
- config.fluentmigrator.command = "configured command"
123
- end
124
- @migrator = FluentMigratorRunner.new
125
- end
126
-
127
- it "uses the configuration command" do
128
- @migrator.command.should == "configured command"
129
- end
130
- end
131
-
132
- describe FluentMigratorRunner, "when the command has been set through configuration and providing a command in the intializer" do
133
- it_should_behave_like "fluentmigrator paths"
134
-
135
- before :all do
136
- Albacore.configure do |config|
137
- config.fluentmigrator.command = "configured command"
138
- end
139
- @migrator = FluentMigratorRunner.new("initializer command")
140
- end
141
-
142
- it "uses the initializer command" do
143
- @migrator.command.should == "initializer command"
144
- end
145
- end
146
-
147
- describe FluentMigratorRunner, "when configuration has been provided" do
148
- before :all do
149
- Albacore.configure do |config|
150
- config.fluentmigrator do |migrator|
151
- migrator.target = 'target.dll'
152
- migrator.provider = 'provider'
153
- migrator.connection = 'connection'
154
- migrator.namespace = 'namespace'
155
- migrator.output = 'output.txt'
156
- migrator.preview = true
157
- migrator.steps = 1
158
- migrator.task = 'migrate:up'
159
- migrator.version = '001'
160
- migrator.verbose = true
161
- migrator.script_directory = 'c:\scripts'
162
- migrator.profile = 'MyProfile'
163
- migrator.timeout = 90
164
- end
165
- end
166
-
167
- @migrator = FluentMigratorRunner.new
168
- end
169
-
170
- it "uses the provided configuration" do
171
- @migrator.target.should == 'target.dll'
172
- @migrator.provider.should == 'provider'
173
- @migrator.connection.should == 'connection'
174
- @migrator.namespace.should == 'namespace'
175
- @migrator.output.should == 'output.txt'
176
- @migrator.preview.should == true
177
- @migrator.steps.should == 1
178
- @migrator.task.should == 'migrate:up'
179
- @migrator.version.should == '001'
180
- @migrator.verbose.should == true
181
- @migrator.script_directory.should == 'c:\scripts'
182
- @migrator.profile.should == 'MyProfile'
183
- @migrator.timeout.should == 90
184
- end
185
- end
1
+ require 'spec_helper'
2
+ require 'albacore/fluentmigratorrunner'
3
+
4
+ shared_examples_for "fluentmigrator paths" do
5
+ before :all do
6
+ @fluent_migrator_path = File.join(File.dirname(__FILE__), 'support', 'Tools', 'FluentMigrator-0.9', 'Migrate.exe')
7
+ @test_assembly = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'fluentmigrator', 'assemblies', 'TestSolution.FluentMigrator.dll')
8
+ end
9
+ end
10
+
11
+ describe FluentMigratorRunner, "the command parameters for an migrator runner" do
12
+ it_should_behave_like "fluentmigrator paths"
13
+
14
+ before :all do
15
+ @migrator = FluentMigratorRunner.new(@fluent_migrator_path)
16
+ end
17
+
18
+ context "Required params" do
19
+ before :all do
20
+ @command_parameters = @migrator.get_command_parameters
21
+ end
22
+
23
+ it "doesn't include command" do
24
+ @command_parameters.should_not include(@fluent_migrator_path)
25
+ end
26
+
27
+ it "includes target" do
28
+ @command_parameters.should include("/target")
29
+ end
30
+
31
+ it "includes provider" do
32
+ @command_parameters.should include("/provider")
33
+ end
34
+
35
+ it "includes connection" do
36
+ @command_parameters.should include("/connection")
37
+ end
38
+ end
39
+
40
+ context "Optional options" do
41
+ before :all do
42
+ @migrator.namespace = 'namespace'
43
+ @migrator.output = true
44
+ @migrator.output_filename = "output.txt"
45
+ @migrator.preview = true
46
+ @migrator.steps = 1
47
+ @migrator.task = 'migrate:up'
48
+ @migrator.version = '001'
49
+ @migrator.verbose = true
50
+ @migrator.script_directory = 'c:\scripts'
51
+ @migrator.profile = 'MyProfile'
52
+ @migrator.timeout = 90
53
+ @command_parameters = @migrator.get_command_parameters
54
+ end
55
+
56
+ it "includes ns" do
57
+ @command_parameters.should include('/ns')
58
+ end
59
+
60
+ it "includes out" do
61
+ @command_parameters.should include('/out')
62
+ end
63
+
64
+ it "includes outfile" do
65
+ @command_parameters.should include('/outfile')
66
+ end
67
+
68
+ it "includes preview" do
69
+ @command_parameters.should include('/preview')
70
+ end
71
+
72
+ it "includes steps" do
73
+ @command_parameters.should include('/steps')
74
+ end
75
+
76
+ it "includes task" do
77
+ @command_parameters.should include('/task')
78
+ end
79
+
80
+ it "includes version" do
81
+ @command_parameters.should include('/version')
82
+ end
83
+
84
+ it "includes verbose" do
85
+ @command_parameters.should include('/verbose')
86
+ end
87
+
88
+ it "includes wd" do
89
+ @command_parameters.should include('/wd')
90
+ end
91
+
92
+ it "includes profile" do
93
+ @command_parameters.should include('/profile')
94
+ end
95
+
96
+ it "includes timeout" do
97
+ @command_parameters.should include('/timeout')
98
+ end
99
+
100
+ it "excludes help" do
101
+ @command_parameters.should_not include("/?")
102
+ end
103
+ end
104
+
105
+ context "Help option" do
106
+ it "includes help flag when specifed" do
107
+ @migrator.show_help = true
108
+ command_parameters = @migrator.get_command_parameters
109
+ command_parameters.should == " /?"
110
+ end
111
+
112
+ it "excludes help flag when not specifed" do
113
+ @migrator.show_help = false
114
+ command_parameters = @migrator.get_command_parameters
115
+ command_parameters.should_not include "/?"
116
+ end
117
+ end
118
+
119
+ context "Boolean options" do
120
+ before :all do
121
+ @migrator.output = false
122
+ @migrator.preview = false
123
+ @migrator.verbose = false
124
+ end
125
+
126
+ it "includes /out when output is true" do
127
+ @migrator.output = true
128
+ @migrator.get_command_parameters.should include "/out"
129
+ end
130
+
131
+ it "excludes /out when output not true" do
132
+ @migrator.output = false
133
+ @migrator.get_command_parameters.should_not include "/out"
134
+ @migrator.output = "a"
135
+ @migrator.get_command_parameters.should_not include "/out"
136
+ end
137
+
138
+ it "includes /preview when preview is true" do
139
+ @migrator.preview = true
140
+ @migrator.get_command_parameters.should include "/preview"
141
+ end
142
+
143
+ it "excludes /preview when preview is not true" do
144
+ @migrator.preview = false
145
+ @migrator.get_command_parameters.should_not include "/preview"
146
+
147
+ @migrator.preview = "a"
148
+ @migrator.get_command_parameters.should_not include "/preview"
149
+ end
150
+
151
+ it "includes /verbose when verbose is true" do
152
+ @migrator.verbose = true
153
+ @migrator.get_command_parameters.should include "/verbose=true"
154
+ end
155
+
156
+ it "excludes /verbose when verbose is not true" do
157
+ @migrator.verbose = false
158
+ @migrator.get_command_parameters.should_not include "/verbose="
159
+
160
+ @migrator.verbose = "a"
161
+ @migrator.get_command_parameters.should_not include "/verbose="
162
+ end
163
+ end
164
+ end
165
+
166
+ describe FluentMigratorRunner, "the command line string for an fluentmigrator runner" do
167
+ it_should_behave_like "fluentmigrator paths"
168
+
169
+ before :all do
170
+ migrator = FluentMigratorRunner.new(@fluent_migrator_path)
171
+ migrator.target = @test_assembly
172
+
173
+ @command_line = migrator.get_command_line
174
+ @command_parameters = migrator.get_command_parameters
175
+ end
176
+
177
+ it "starts with the path to the command" do
178
+ @command_line.should =~ /^#{@fluent_migrator_path}.*$/
179
+ end
180
+
181
+ it "includes the command parameters" do
182
+ @command_line.downcase.should include(@command_parameters.downcase)
183
+ end
184
+ end
185
+
186
+ describe FluentMigratorRunner, "when using the configuration command and not providing a command in the intializer" do
187
+ it_should_behave_like "fluentmigrator paths"
188
+
189
+ before :all do
190
+ Albacore.configure do |config|
191
+ config.fluentmigrator.command = "configured command"
192
+ end
193
+ @migrator = FluentMigratorRunner.new
194
+ end
195
+
196
+ it "uses the configuration command" do
197
+ @migrator.command.should == "configured command"
198
+ end
199
+ end
200
+
201
+ describe FluentMigratorRunner, "when the command has been set through configuration and providing a command in the intializer" do
202
+ it_should_behave_like "fluentmigrator paths"
203
+
204
+ before :all do
205
+ Albacore.configure do |config|
206
+ config.fluentmigrator.command = "configured command"
207
+ end
208
+ @migrator = FluentMigratorRunner.new("initializer command")
209
+ end
210
+
211
+ it "uses the initializer command" do
212
+ @migrator.command.should == "initializer command"
213
+ end
214
+ end
215
+
216
+ describe FluentMigratorRunner, "when configuration has been provided" do
217
+ before :all do
218
+ Albacore.configure do |config|
219
+ config.fluentmigrator do |migrator|
220
+ migrator.target = 'target.dll'
221
+ migrator.provider = 'provider'
222
+ migrator.connection = 'connection'
223
+ migrator.namespace = 'namespace'
224
+ migrator.output = 'output.txt'
225
+ migrator.preview = true
226
+ migrator.steps = 1
227
+ migrator.task = 'migrate:up'
228
+ migrator.version = '001'
229
+ migrator.verbose = true
230
+ migrator.script_directory = 'c:\scripts'
231
+ migrator.profile = 'MyProfile'
232
+ migrator.timeout = 90
233
+ end
234
+ end
235
+
236
+ @migrator = FluentMigratorRunner.new
237
+ end
238
+
239
+ it "uses the provided configuration" do
240
+ @migrator.target.should == 'target.dll'
241
+ @migrator.provider.should == 'provider'
242
+ @migrator.connection.should == 'connection'
243
+ @migrator.namespace.should == 'namespace'
244
+ @migrator.output.should == 'output.txt'
245
+ @migrator.preview.should == true
246
+ @migrator.steps.should == 1
247
+ @migrator.task.should == 'migrate:up'
248
+ @migrator.version.should == '001'
249
+ @migrator.verbose.should == true
250
+ @migrator.script_directory.should == 'c:\scripts'
251
+ @migrator.profile.should == 'MyProfile'
252
+ @migrator.timeout.should == 90
253
+ end
254
+ end