albacore 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/EULA.txt +19 -0
- data/README.markdown +70 -0
- data/VERSION +1 -0
- data/lib/albacore.rb +9 -0
- data/lib/albacore/assemblyinfo.rb +104 -0
- data/lib/albacore/expandtemplates.rb +64 -0
- data/lib/albacore/msbuild.rb +63 -0
- data/lib/albacore/mspectestrunner.rb +33 -0
- data/lib/albacore/ncoverconsole.rb +64 -0
- data/lib/albacore/ncoverreport.rb +61 -0
- data/lib/albacore/ncoverreports/assemblyfilter.rb +10 -0
- data/lib/albacore/ncoverreports/branchcoverage.rb +10 -0
- data/lib/albacore/ncoverreports/classfilter.rb +9 -0
- data/lib/albacore/ncoverreports/codecoveragebase.rb +25 -0
- data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +23 -0
- data/lib/albacore/ncoverreports/documentfilter.rb +9 -0
- data/lib/albacore/ncoverreports/fullcoveragereport.rb +21 -0
- data/lib/albacore/ncoverreports/methodcoverage.rb +10 -0
- data/lib/albacore/ncoverreports/methodfilter.rb +9 -0
- data/lib/albacore/ncoverreports/namespacefilter.rb +9 -0
- data/lib/albacore/ncoverreports/reportfilterbase.rb +26 -0
- data/lib/albacore/ncoverreports/summaryreport.rb +22 -0
- data/lib/albacore/ncoverreports/symbolcoverage.rb +10 -0
- data/lib/albacore/nunittestrunner.rb +38 -0
- data/lib/albacore/sftp.rb +24 -0
- data/lib/albacore/sqlcmd.rb +55 -0
- data/lib/albacore/ssh.rb +25 -0
- data/lib/albacore/support/albacore_helper.rb +4 -0
- data/lib/albacore/support/failure.rb +22 -0
- data/lib/albacore/support/logging.rb +32 -0
- data/lib/albacore/support/runcommand.rb +45 -0
- data/lib/albacore/support/yamlconfig.rb +30 -0
- data/lib/albacore/zipdirectory.rb +55 -0
- data/lib/rake/assemblyinfotask.rb +22 -0
- data/lib/rake/expandtemplatestask.rb +21 -0
- data/lib/rake/msbuildtask.rb +22 -0
- data/lib/rake/ncoverconsoletask.rb +22 -0
- data/lib/rake/ncoverreporttask.rb +22 -0
- data/lib/rake/nunittask.rb +22 -0
- data/lib/rake/renametask.rb +25 -0
- data/lib/rake/sftptask.rb +21 -0
- data/lib/rake/sqlcmdtask.rb +22 -0
- data/lib/rake/sshtask.rb +21 -0
- data/lib/rake/ziptask.rb +21 -0
- data/rakefile.rb +144 -0
- data/spec/assemblyinfo_spec.rb +246 -0
- data/spec/assemblyinfotask_spec.rb +31 -0
- data/spec/expandtemplates_spec.rb +127 -0
- data/spec/expandtemplatestask_spec.rb +31 -0
- data/spec/msbuild_spec.rb +173 -0
- data/spec/msbuildtask_spec.rb +31 -0
- data/spec/ncoverconsole_spec.rb +247 -0
- data/spec/ncoverconsoletask_spec.rb +31 -0
- data/spec/ncoverreport_spec.rb +577 -0
- data/spec/ncoverreporttask_spec.rb +31 -0
- data/spec/nunittask_spec.rb +31 -0
- data/spec/patches/system_patch.rb +16 -0
- data/spec/patches/tasklib_patch.rb +12 -0
- data/spec/renametask_spec.rb +30 -0
- data/spec/sftp_spec.rb +30 -0
- data/spec/sftptask_spec.rb +41 -0
- data/spec/sqlcmd_spec.rb +139 -0
- data/spec/sqlcmdtask_spec.rb +31 -0
- data/spec/ssh_spec.rb +48 -0
- data/spec/sshtask_spec.rb +39 -0
- data/spec/support/AssemblyInfo/assemblyinfo.yml +2 -0
- data/spec/support/CodeCoverage/mspec/assemblies/Machine.Specifications.NUnit.dll +0 -0
- data/spec/support/CodeCoverage/mspec/assemblies/Machine.Specifications.dll +0 -0
- data/spec/support/CodeCoverage/mspec/assemblies/TestSolution.MSpecTests.dll +0 -0
- data/spec/support/CodeCoverage/mspec/assemblies/TestSolution.dll +0 -0
- data/spec/support/CodeCoverage/mspec/assemblies/nunit.framework.dll +0 -0
- data/spec/support/CodeCoverage/nunit/assemblies/TestSolution.Tests.dll +0 -0
- data/spec/support/CodeCoverage/nunit/assemblies/TestSolution.dll +0 -0
- data/spec/support/CodeCoverage/nunit/assemblies/nunit.framework.dll +0 -0
- data/spec/support/CodeCoverage/nunit/failing_assemblies/TestSolution.FailingTests.dll +0 -0
- data/spec/support/CodeCoverage/nunit/failing_assemblies/nunit.framework.dll +0 -0
- data/spec/support/CodeCoverage/report/coverage.xml +4578 -0
- data/spec/support/TestSolution/TestSolution.FailingTests/FailingTestFixture.cs +19 -0
- data/spec/support/TestSolution/TestSolution.FailingTests/Properties/AssemblyInfo.cs +36 -0
- data/spec/support/TestSolution/TestSolution.FailingTests/TestSolution.FailingTests.csproj +63 -0
- data/spec/support/TestSolution/TestSolution.MSpecTests/Properties/AssemblyInfo.cs +36 -0
- data/spec/support/TestSolution/TestSolution.MSpecTests/SomeSpecTest.cs +18 -0
- data/spec/support/TestSolution/TestSolution.MSpecTests/TestSolution.MSpecTests.csproj +77 -0
- data/spec/support/TestSolution/TestSolution.Tests/Properties/AssemblyInfo.cs +36 -0
- data/spec/support/TestSolution/TestSolution.Tests/SomeTestFixture.cs +23 -0
- data/spec/support/TestSolution/TestSolution.Tests/TestSolution.Tests.csproj +69 -0
- data/spec/support/TestSolution/TestSolution.sln +38 -0
- data/spec/support/TestSolution/TestSolution/Class1.cs +17 -0
- data/spec/support/TestSolution/TestSolution/Properties/AssemblyInfo.cs +36 -0
- data/spec/support/TestSolution/TestSolution/TestSolution.csproj +59 -0
- data/spec/support/assemblyinfotester.rb +42 -0
- data/spec/support/expandtemplates/datafiles/multiplevalues.yml +3 -0
- data/spec/support/expandtemplates/datafiles/multitemplate-specificfile.yml +11 -0
- data/spec/support/expandtemplates/datafiles/multitemplate.yml +4 -0
- data/spec/support/expandtemplates/datafiles/sample.yml +1 -0
- data/spec/support/expandtemplates/templates/multipleinstance.config +4 -0
- data/spec/support/expandtemplates/templates/multiplevalues.config +1 -0
- data/spec/support/expandtemplates/templates/sample.config +1 -0
- data/spec/support/expandtemplatestestdata.rb +69 -0
- data/spec/support/msbuildtestdata.rb +32 -0
- data/spec/support/ncoverreporttestdata.rb +26 -0
- data/spec/support/spec_helper.rb +15 -0
- data/spec/support/test.yml +4 -0
- data/spec/support/zip/files/subfolder/sub file.txt +1 -0
- data/spec/support/zip/files/testfile.txt +1 -0
- data/spec/support/ziptestdata.rb +8 -0
- data/spec/yamlconfig_spec.rb +62 -0
- data/spec/zip_spec.rb +18 -0
- data/spec/ziptask_spec.rb +31 -0
- data/yaml_autoconfig_test.yml +1 -0
- metadata +262 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
|
2
|
+
require 'assemblyinfotester'
|
|
3
|
+
require 'albacore/assemblyinfo'
|
|
4
|
+
|
|
5
|
+
describe AssemblyInfo, "when generating an assembly info file" do
|
|
6
|
+
before :all do
|
|
7
|
+
@tester = AssemblyInfoTester.new
|
|
8
|
+
asm = AssemblyInfo.new
|
|
9
|
+
strio = StringIO.new
|
|
10
|
+
asm.log_device = strio
|
|
11
|
+
|
|
12
|
+
@tester.build_and_read_assemblyinfo_file asm
|
|
13
|
+
|
|
14
|
+
@log_data = strio.string
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should log the name of the output file" do
|
|
18
|
+
@log_data.should include(@tester.assemblyinfo_file)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe AssemblyInfo, "when generating an assembly info file in verbose mode" do
|
|
23
|
+
before :all do
|
|
24
|
+
@tester = AssemblyInfoTester.new
|
|
25
|
+
asm = AssemblyInfo.new
|
|
26
|
+
strio = StringIO.new
|
|
27
|
+
asm.log_device = strio
|
|
28
|
+
asm.log_level = :verbose
|
|
29
|
+
|
|
30
|
+
asm.version = @tester.version
|
|
31
|
+
|
|
32
|
+
@tester.build_and_read_assemblyinfo_file asm
|
|
33
|
+
@log_data = strio.string
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "should log the name of the output file" do
|
|
37
|
+
@log_data.should include(@tester.assemblyinfo_file)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "should log the supplied attribute information" do
|
|
41
|
+
@log_data.should include("[assembly: AssemblyVersion(\"#{@tester.version}\")]")
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe AssemblyInfo, "when generating an assembly info file without an output file specified" do
|
|
46
|
+
before :all do
|
|
47
|
+
@tester = AssemblyInfoTester.new
|
|
48
|
+
asm = AssemblyInfo.new
|
|
49
|
+
strio = StringIO.new
|
|
50
|
+
asm.log_device = strio
|
|
51
|
+
|
|
52
|
+
asm.write
|
|
53
|
+
|
|
54
|
+
@log_data = strio.string
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "should log an error message saying the output file is required" do
|
|
58
|
+
@log_data.should include("output_file cannot be nil")
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
describe AssemblyInfo, "when providing custom namespaces" do
|
|
63
|
+
before :all do
|
|
64
|
+
@tester = AssemblyInfoTester.new
|
|
65
|
+
asm = AssemblyInfo.new
|
|
66
|
+
|
|
67
|
+
asm.namespaces ['My.Name.Space', 'Another.Namespace.GoesHere']
|
|
68
|
+
|
|
69
|
+
@filedata = @tester.build_and_read_assemblyinfo_file asm
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "should write the namespaces into the using statements" do
|
|
73
|
+
@filedata.should include("using My.Name.Space;")
|
|
74
|
+
@filedata.should include("using Another.Namespace.GoesHere;")
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
describe AssemblyInfo, "when providing custom attributes" do
|
|
79
|
+
before :all do
|
|
80
|
+
@tester = AssemblyInfoTester.new
|
|
81
|
+
asm = AssemblyInfo.new
|
|
82
|
+
|
|
83
|
+
asm.custom_attributes :CustomAttribute => "custom attribute data", :AnotherAttribute => "more data here"
|
|
84
|
+
|
|
85
|
+
@filedata = @tester.build_and_read_assemblyinfo_file asm
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "should write the custom attributes to the assembly info file" do
|
|
89
|
+
@filedata.should include("[assembly: CustomAttribute(\"custom attribute data\")]")
|
|
90
|
+
@filedata.should include("[assembly: AnotherAttribute(\"more data here\")]")
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
describe AssemblyInfo, "when specifying a custom attribute with no data" do
|
|
95
|
+
before :all do
|
|
96
|
+
@tester = AssemblyInfoTester.new
|
|
97
|
+
asm = AssemblyInfo.new
|
|
98
|
+
|
|
99
|
+
asm.custom_attributes :NoArgsAttribute => nil
|
|
100
|
+
|
|
101
|
+
@filedata = @tester.build_and_read_assemblyinfo_file asm
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it "should write the attribute with an empty argument list" do
|
|
105
|
+
@filedata.should include("[assembly: NoArgsAttribute()]")
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
describe AssemblyInfo, "when specifying an attribute with non-string data" do
|
|
110
|
+
before :all do
|
|
111
|
+
@tester = AssemblyInfoTester.new
|
|
112
|
+
asm = AssemblyInfo.new
|
|
113
|
+
|
|
114
|
+
asm.custom_attributes :NonStringAttribute => true
|
|
115
|
+
|
|
116
|
+
@filedata = @tester.build_and_read_assemblyinfo_file asm
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it "should write the attribute data without quotes" do
|
|
120
|
+
@filedata.should include("[assembly: NonStringAttribute(true)]")
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
describe AssemblyInfo, "when generating an assembly info file with the built in attributes" do
|
|
125
|
+
before :all do
|
|
126
|
+
@tester = AssemblyInfoTester.new
|
|
127
|
+
asm = AssemblyInfo.new
|
|
128
|
+
|
|
129
|
+
asm.company_name = @tester.company_name
|
|
130
|
+
asm.product_name = @tester.product_name
|
|
131
|
+
asm.version = @tester.version
|
|
132
|
+
asm.title = @tester.title
|
|
133
|
+
asm.description = @tester.description
|
|
134
|
+
asm.copyright = @tester.copyright
|
|
135
|
+
asm.com_visible = @tester.com_visible
|
|
136
|
+
asm.com_guid = @tester.com_guid
|
|
137
|
+
asm.file_version = @tester.file_version
|
|
138
|
+
asm.trademark = @tester.trademark
|
|
139
|
+
|
|
140
|
+
@filedata = @tester.build_and_read_assemblyinfo_file asm
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
it "should use the system.reflection namespace" do
|
|
144
|
+
@filedata.should include("using System.Reflection;")
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
it "should use the system.runtime.interopservices namespace" do
|
|
148
|
+
@filedata.should include("using System.Runtime.InteropServices;")
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
it "should contain the specified version information" do
|
|
152
|
+
@filedata.should include("[assembly: AssemblyVersion(\"#{@tester.version}\")]")
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
it "should contain the assembly title" do
|
|
156
|
+
@filedata.should include("[assembly: AssemblyTitle(\"#{@tester.title}\")]")
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
it "should contain the assembly description" do
|
|
160
|
+
@filedata.should include("[assembly: AssemblyDescription(\"#{@tester.description}\")]")
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
it "should contain the copyright information" do
|
|
164
|
+
@filedata.should include("[assembly: AssemblyCopyright(\"#{@tester.copyright}\")]")
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
it "should contain the com visible information" do
|
|
168
|
+
@filedata.should include("[assembly: ComVisible(#{@tester.com_visible})]")
|
|
169
|
+
@filedata.should include("[assembly: Guid(\"#{@tester.com_guid}\")]")
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
it "should contain the company name information" do
|
|
173
|
+
@filedata.should include("[assembly: AssemblyCompany(\"#{@tester.company_name}\")]")
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
it "should contain the product information" do
|
|
177
|
+
@filedata.should include("[assembly: AssemblyProduct(\"#{@tester.product_name}\")]")
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
it "should contain the file version information" do
|
|
181
|
+
@filedata.should include("[assembly: AssemblyFileVersion(\"#{@tester.file_version}\")]")
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
it "should contain the trademark information" do
|
|
185
|
+
@filedata.should include("[assembly: AssemblyTrademark(\"#{@tester.trademark}\")]")
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
describe AssemblyInfo, "when generating an assembly info file with no attributes provided" do
|
|
190
|
+
before :all do
|
|
191
|
+
@tester = AssemblyInfoTester.new
|
|
192
|
+
asm = AssemblyInfo.new
|
|
193
|
+
|
|
194
|
+
@filedata = @tester.build_and_read_assemblyinfo_file asm
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
it "should not contain the specified version information" do
|
|
198
|
+
@filedata.should_not include("[assembly: AssemblyVersion(\"#{@tester.version}\")]")
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
it "should not contain the assembly title" do
|
|
202
|
+
@filedata.should_not include("[assembly: AssemblyTitle(\"#{@tester.title}\")]")
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
it "should not contain the assembly description" do
|
|
206
|
+
@filedata.should_not include("[assembly: AssemblyDescription(\"#{@tester.description}\")]")
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
it "should not contain the copyright information" do
|
|
210
|
+
@filedata.should_not include("[assembly: AssemblyCopyright(\"#{@tester.copyright}\")]")
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
it "should not contain the com visible information" do
|
|
214
|
+
@filedata.should_not include("[assembly: ComVisible(#{@tester.com_visible})]")
|
|
215
|
+
@filedata.should_not include("[assembly: Guid(\"#{@tester.com_guid}\")]")
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
it "should not contain the company name information" do
|
|
219
|
+
@filedata.should_not include("[assembly: AssemblyCompany(\"#{@tester.company_name}\")]")
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
it "should not contain the product information" do
|
|
223
|
+
@filedata.should_not include("[assembly: AssemblyProduct(\"#{@tester.product_name}\")]")
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
it "should not contain the file version information" do
|
|
227
|
+
@filedata.should_not include("[assembly: AssemblyFileVersion(\"#{@tester.file_version}\")]")
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
it "should not contain the trademark information" do
|
|
231
|
+
@filedata.should_not include("[assembly: AssemblyTrademark(\"#{@tester.trademark}\")]")
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
describe AssemblyInfo, "when configuring the assembly info generator with a yaml file" do
|
|
236
|
+
before :all do
|
|
237
|
+
tester = AssemblyInfoTester.new
|
|
238
|
+
@asm = AssemblyInfo.new
|
|
239
|
+
@asm.configure(tester.yaml_file)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
it "should set the values for the provided attributes" do
|
|
243
|
+
@asm.version.should == "0.0.1"
|
|
244
|
+
@asm.company_name.should == "some company name"
|
|
245
|
+
end
|
|
246
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
|
2
|
+
require 'albacore/assemblyinfo'
|
|
3
|
+
require 'rake/assemblyinfotask'
|
|
4
|
+
require 'tasklib_patch'
|
|
5
|
+
|
|
6
|
+
describe Albacore::AssemblyInfoTask, "when running" do
|
|
7
|
+
before :all do
|
|
8
|
+
@task = Albacore::AssemblyInfoTask.new(:task) do |t|
|
|
9
|
+
@yielded_object = t
|
|
10
|
+
end
|
|
11
|
+
@task.extend(TasklibPatch)
|
|
12
|
+
Rake::Task["task"].invoke
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should yield the assembly info api" do
|
|
16
|
+
@yielded_object.kind_of?(AssemblyInfo).should == true
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe Albacore::AssemblyInfoTask, "when execution fails" do
|
|
21
|
+
before :all do
|
|
22
|
+
@task = Albacore::AssemblyInfoTask.new(:failingtask)
|
|
23
|
+
@task.extend(TasklibPatch)
|
|
24
|
+
@task.fail
|
|
25
|
+
Rake::Task["failingtask"].invoke
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should fail the rake task" do
|
|
29
|
+
@task.task_failed.should == true
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
|
2
|
+
require 'albacore/expandtemplates'
|
|
3
|
+
require 'expandtemplatestestdata'
|
|
4
|
+
|
|
5
|
+
shared_examples_for "prepping the sample templates" do
|
|
6
|
+
before :all do
|
|
7
|
+
@testdata = ExpandTemplatesTestData.new
|
|
8
|
+
@testdata.prep_sample_templates
|
|
9
|
+
|
|
10
|
+
@templates = ExpandTemplates.new
|
|
11
|
+
@templates.log_level = :verbose
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe ExpandTemplates, "when expanding a single value into multiple locations" do
|
|
16
|
+
it_should_behave_like "prepping the sample templates"
|
|
17
|
+
|
|
18
|
+
before :all do
|
|
19
|
+
@templates.expand_files = {@testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file}
|
|
20
|
+
@templates.data_file = @testdata.sample_data_file
|
|
21
|
+
@templates.expand
|
|
22
|
+
|
|
23
|
+
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should replace the first location" do
|
|
27
|
+
@output_file_data.should include("first instance of 'the real value' is here.")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should replace the second location" do
|
|
31
|
+
@output_file_data.should include("second instance of 'the real value' goes here.")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe ExpandTemplates, "when expanding multiples value into multiple locations" do
|
|
36
|
+
it_should_behave_like "prepping the sample templates"
|
|
37
|
+
|
|
38
|
+
before :all do
|
|
39
|
+
@templates.expand_files = {@testdata.multiplevalues_template_file => @testdata.multiplevalues_output_file}
|
|
40
|
+
@templates.data_file = @testdata.multiplevalues_data_file
|
|
41
|
+
@templates.expand
|
|
42
|
+
|
|
43
|
+
@output_file_data = @testdata.read_file(@testdata.multiplevalues_output_file)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "should replace the values" do
|
|
47
|
+
@output_file_data.should include("this is a template file with multiple values")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "should write to the specified output file" do
|
|
51
|
+
File.exist?(@testdata.multiplevalues_output_file).should be_true
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
describe ExpandTemplates, "when expanding a template file and specifying an output file" do
|
|
56
|
+
it_should_behave_like "prepping the sample templates"
|
|
57
|
+
|
|
58
|
+
before :all do
|
|
59
|
+
@templates.expand_files = {@testdata.sample_template_file => @testdata.sample_output_file}
|
|
60
|
+
@templates.data_file = @testdata.sample_data_file
|
|
61
|
+
@templates.expand
|
|
62
|
+
|
|
63
|
+
@output_file_data = @testdata.read_file(@testdata.sample_output_file)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "should replace the \#{value} placeholder with 'the real value'" do
|
|
67
|
+
@output_file_data.should include("the real value")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "should write to the specified output file" do
|
|
71
|
+
File.exist?(@testdata.sample_output_file).should be_true
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
describe ExpandTemplates, "when expanding multiple template files" do
|
|
76
|
+
it_should_behave_like "prepping the sample templates"
|
|
77
|
+
|
|
78
|
+
before :all do
|
|
79
|
+
@templates.expand_files = {
|
|
80
|
+
@testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file,
|
|
81
|
+
@testdata.sample_template_file => @testdata.sample_output_file,
|
|
82
|
+
@testdata.multiplevalues_template_file => @testdata.multiplevalues_output_file
|
|
83
|
+
}
|
|
84
|
+
@templates.data_file = @testdata.multitemplate_data_file
|
|
85
|
+
@templates.expand
|
|
86
|
+
|
|
87
|
+
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it "should expand the first template right onto itself" do
|
|
91
|
+
@output_file_data.should include("first instance of 'the real value' is here.")
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it "should expand the second template to the specified location" do
|
|
95
|
+
File.exist?(@testdata.sample_output_file).should be_true
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
describe ExpandTemplates, "when expanding template files and the data file contains entries for specific templates" do
|
|
100
|
+
it_should_behave_like "prepping the sample templates"
|
|
101
|
+
|
|
102
|
+
before :all do
|
|
103
|
+
@templates.expand_files = {
|
|
104
|
+
@testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file,
|
|
105
|
+
@testdata.sample_template_file => @testdata.sample_output_file,
|
|
106
|
+
@testdata.multiplevalues_template_file => @testdata.multiplevalues_output_file
|
|
107
|
+
}
|
|
108
|
+
@templates.data_file = @testdata.multitemplate_specificfile_data_file
|
|
109
|
+
@templates.expand
|
|
110
|
+
|
|
111
|
+
@multiinstance_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
|
112
|
+
@sample_file_data = @testdata.read_file(@testdata.sample_output_file)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it "should expand the specific template with the data specified for it" do
|
|
116
|
+
@multiinstance_file_data.should include("first instance of 'the real value' is here.")
|
|
117
|
+
@multiinstance_file_data.should include("b has a value of this is a second value")
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
it "should use the global data when data for a specific template is not found in that templates specific data" do
|
|
121
|
+
@multiinstance_file_data.should include("the value of a is a template file")
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
it "should not use the data from specified templates when the template name does not match" do
|
|
125
|
+
@sample_file_data.should include("this is not the right one!!!")
|
|
126
|
+
end
|
|
127
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
|
2
|
+
require 'albacore/expandtemplates'
|
|
3
|
+
require 'rake/expandtemplatestask'
|
|
4
|
+
require 'tasklib_patch'
|
|
5
|
+
|
|
6
|
+
describe Albacore::ExpandTemplatesTask, "when running" do
|
|
7
|
+
before :each do
|
|
8
|
+
task = Albacore::ExpandTemplatesTask.new() do |t|
|
|
9
|
+
@yielded_object = t
|
|
10
|
+
end
|
|
11
|
+
task.extend(TasklibPatch)
|
|
12
|
+
Rake::Task[:expandtemplates].invoke
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should yield the expand template api" do
|
|
16
|
+
@yielded_object.kind_of?(ExpandTemplates).should == true
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe Albacore::ExpandTemplatesTask, "when execution fails" do
|
|
21
|
+
before :each do
|
|
22
|
+
@task = Albacore::ExpandTemplatesTask.new(:failingtask)
|
|
23
|
+
@task.extend(TasklibPatch)
|
|
24
|
+
@task.fail
|
|
25
|
+
Rake::Task["failingtask"].invoke
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should fail the rake task" do
|
|
29
|
+
@task.task_failed.should be_true
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
|
2
|
+
require 'albacore/msbuild'
|
|
3
|
+
require 'msbuildtestdata'
|
|
4
|
+
|
|
5
|
+
describe MSBuild, "when building a solution with verbose logging turned on" do
|
|
6
|
+
before :all do
|
|
7
|
+
@testdata = MSBuildTestData.new
|
|
8
|
+
msbuild = @testdata.msbuild
|
|
9
|
+
strio = StringIO.new
|
|
10
|
+
msbuild.log_device = strio
|
|
11
|
+
msbuild.log_level = :verbose
|
|
12
|
+
|
|
13
|
+
msbuild.solution = @testdata.solution_path
|
|
14
|
+
msbuild.build
|
|
15
|
+
|
|
16
|
+
@log_data = strio.string
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should log the msbuild command line being called" do
|
|
20
|
+
@log_data.should include("Executing MSBuild: \"C:\\Windows/Microsoft.NET/Framework/v3.5/MSBuild.exe\"")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe MSBuild, "when building with no solution specified" do
|
|
25
|
+
before :all do
|
|
26
|
+
@testdata = MSBuildTestData.new
|
|
27
|
+
msbuild = @testdata.msbuild
|
|
28
|
+
strio = StringIO.new
|
|
29
|
+
msbuild.log_device = strio
|
|
30
|
+
msbuild.log_level = :verbose
|
|
31
|
+
|
|
32
|
+
msbuild.build
|
|
33
|
+
|
|
34
|
+
@log_data = strio.string
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "should log an error message saying the output file is required" do
|
|
38
|
+
@log_data.should include("solution cannot be nil")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe MSBuild, "when an msbuild path is not specified" do
|
|
43
|
+
before :all do
|
|
44
|
+
@testdata = MSBuildTestData.new
|
|
45
|
+
@msbuild = @testdata.msbuild
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "should default to the .net framework v3.5" do
|
|
49
|
+
@msbuild.path_to_command.should == @testdata.msbuild_path
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe MSBuild, "when an msbuild path is specified" do
|
|
54
|
+
before :all do
|
|
55
|
+
@testdata = MSBuildTestData.new
|
|
56
|
+
@msbuild = @testdata.msbuild "Some Path"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "should use the specified path for the msbuild exe" do
|
|
60
|
+
@msbuild.path_to_command.should == "Some Path"
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
describe MSBuild, "when an invalid msbuild path is specified" do
|
|
65
|
+
before :all do
|
|
66
|
+
@testdata = MSBuildTestData.new
|
|
67
|
+
msbuild = @testdata.msbuild "/an invalid path/does not exist.exe"
|
|
68
|
+
strio = StringIO.new
|
|
69
|
+
msbuild.log_device = strio
|
|
70
|
+
msbuild.log_level = :verbose
|
|
71
|
+
msbuild.solution = @testdata.solution_path
|
|
72
|
+
|
|
73
|
+
msbuild.build
|
|
74
|
+
|
|
75
|
+
@log_data = strio.string
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "should log an error message saying the command was not found" do
|
|
79
|
+
@log_data.should include("Command not found: #{@testdata.msbuild_path}")
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
describe MSBuild, "when building a visual studio solution" do
|
|
84
|
+
before :all do
|
|
85
|
+
@testdata = MSBuildTestData.new
|
|
86
|
+
@msbuild = @testdata.msbuild
|
|
87
|
+
|
|
88
|
+
@msbuild.solution = @testdata.solution_path
|
|
89
|
+
@msbuild.build
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
it "should output the solution's binaries" do
|
|
93
|
+
File.exist?(@testdata.output_path).should == true
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
describe MSBuild, "when building a visual studio solution for a specified configuration" do
|
|
98
|
+
before :all do
|
|
99
|
+
@testdata= MSBuildTestData.new("Release")
|
|
100
|
+
@msbuild = @testdata.msbuild
|
|
101
|
+
|
|
102
|
+
@msbuild.properties = {:configuration => :Release}
|
|
103
|
+
@msbuild.solution = @testdata.solution_path
|
|
104
|
+
@msbuild.build
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it "should build with the specified configuration as a property" do
|
|
108
|
+
$system_command.should include("/p:configuration=\"Release\"")
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "should output the solution's binaries according to the specified configuration" do
|
|
112
|
+
File.exist?(@testdata.output_path).should be_true
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
describe MSBuild, "when specifying targets to build" do
|
|
117
|
+
before :all do
|
|
118
|
+
|
|
119
|
+
@testdata= MSBuildTestData.new
|
|
120
|
+
@msbuild = @testdata.msbuild
|
|
121
|
+
|
|
122
|
+
@msbuild.targets [:Clean, :Build]
|
|
123
|
+
@msbuild.solution = @testdata.solution_path
|
|
124
|
+
@msbuild.build
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it "should build the targets" do
|
|
128
|
+
$system_command.should include("/target:Clean;Build")
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
describe MSBuild, "when building a solution with a specific msbuild verbosity" do
|
|
134
|
+
before :all do
|
|
135
|
+
@testdata= MSBuildTestData.new
|
|
136
|
+
@msbuild = @testdata.msbuild
|
|
137
|
+
|
|
138
|
+
@msbuild.verbosity = "normal"
|
|
139
|
+
@msbuild.solution = @testdata.solution_path
|
|
140
|
+
@msbuild.build
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
it "should call msbuild with the specified verbosity" do
|
|
144
|
+
$system_command.should include("/verbosity:normal")
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
describe MSBuild, "when specifying multiple configuration properties" do
|
|
149
|
+
before :all do
|
|
150
|
+
@testdata= MSBuildTestData.new
|
|
151
|
+
@msbuild = @testdata.msbuild
|
|
152
|
+
|
|
153
|
+
File.delete(@testdata.output_path) if File.exist?(@testdata.output_path)
|
|
154
|
+
|
|
155
|
+
@msbuild.targets [:Clean, :Build]
|
|
156
|
+
@msbuild.properties = {:configuration => :Debug, :DebugSymbols => true }
|
|
157
|
+
@msbuild.solution = @testdata.solution_path
|
|
158
|
+
@msbuild.build
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
it "should specify the first property" do
|
|
162
|
+
$system_command.should include("/p:configuration=\"Debug\"")
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
it "should specifiy the second property" do
|
|
166
|
+
$system_command.should include("/p:DebugSymbols=\"true\"")
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
it "should output the solution's binaries" do
|
|
170
|
+
File.exist?(@testdata.output_path).should == true
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
end
|