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,53 +1,53 @@
1
- require 'spec_helper'
2
- require 'albacore/albacoretask'
3
-
4
- class ModelTest
5
- include Albacore::Task
6
- attr_accessor :foo, :bar
7
- attr_hash :a_hash
8
- attr_array :a_array
9
- end
10
-
11
- class NamedTaskExample
12
- TaskName = [:namedtask, :anothername]
13
- include Albacore::Task
14
- end
15
-
16
- describe "when updating object attributes with a valid set of hash keys" do
17
- before :each do
18
- @model = ModelTest.new
19
- @model << {:foo => "test", :bar => "whatever"}
20
- end
21
-
22
- it "should set the attributes correctly" do
23
- @model.foo.should == "test"
24
- @model.bar.should == "whatever"
25
- end
26
- end
27
-
28
- describe "when updating an object attributes with an invalid hash key" do
29
- before :each do
30
- @model = ModelTest.new
31
- str = StringIO.new
32
- @model.log_device = str
33
- @model << {:something => "broken"}
34
- @log = str.string
35
- end
36
-
37
- it "should warn about the attribute not being found" do
38
- @log.should include("something is not a settable attribute on ModelTest")
39
- end
40
- end
41
-
42
- describe "when an class includes albacoretask" do
43
- it "should create a rake task for that class" do
44
- respond_to?(:modeltest).should be_true
45
- end
46
- end
47
-
48
- describe "when an albacoretask class specifies task names" do
49
- it "should create a task with the specified names" do
50
- respond_to?(:namedtask).should be_true
51
- respond_to?(:anothername).should be_true
52
- end
53
- end
1
+ require 'spec_helper'
2
+ require 'albacore/albacoretask'
3
+
4
+ class ModelTest
5
+ include Albacore::Task
6
+ attr_accessor :foo, :bar
7
+ attr_hash :a_hash
8
+ attr_array :a_array
9
+ end
10
+
11
+ class NamedTaskExample
12
+ TaskName = [:namedtask, :anothername]
13
+ include Albacore::Task
14
+ end
15
+
16
+ describe "when updating object attributes with a valid set of hash keys" do
17
+ before :each do
18
+ @model = ModelTest.new
19
+ @model << {:foo => "test", :bar => "whatever"}
20
+ end
21
+
22
+ it "should set the attributes correctly" do
23
+ @model.foo.should == "test"
24
+ @model.bar.should == "whatever"
25
+ end
26
+ end
27
+
28
+ describe "when updating an object attributes with an invalid hash key" do
29
+ before :each do
30
+ @model = ModelTest.new
31
+ str = StringIO.new
32
+ @model.log_device = str
33
+ @model << {:something => "broken"}
34
+ @log = str.string
35
+ end
36
+
37
+ it "should warn about the attribute not being found" do
38
+ @log.should include("something is not a settable attribute on ModelTest")
39
+ end
40
+ end
41
+
42
+ describe "when an class includes albacoretask" do
43
+ it "should create a rake task for that class" do
44
+ respond_to?(:modeltest).should be_true
45
+ end
46
+ end
47
+
48
+ describe "when an albacoretask class specifies task names" do
49
+ it "should create a task with the specified names" do
50
+ respond_to?(:namedtask).should be_true
51
+ respond_to?(:anothername).should be_true
52
+ end
53
+ end
@@ -1,541 +1,541 @@
1
- require '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.downcase.should include(@tester.assemblyinfo_file.downcase)
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.downcase.should include(@tester.assemblyinfo_file.downcase)
38
- end
39
- end
40
-
41
- describe AssemblyInfo, "when generating an assembly info file without an output file specified" do
42
- before :all do
43
- @tester = AssemblyInfoTester.new
44
- asm = AssemblyInfo.new
45
- asm.extend(FailPatch)
46
-
47
- strio = StringIO.new
48
- asm.log_device = strio
49
-
50
- asm.execute
51
-
52
- @log_data = strio.string
53
- end
54
-
55
- it "should log an error message saying the output file is required" do
56
- @log_data.should include("output_file cannot be nil")
57
- end
58
- end
59
-
60
- describe AssemblyInfo, "when providing a custom namespace without specifiying the language" do
61
- before :all do
62
- @tester = AssemblyInfoTester.new
63
- asm = AssemblyInfo.new
64
-
65
- asm.namespaces 'My.Name.Space'
66
-
67
- # Generate the same file twice.
68
- @tester.build_and_read_assemblyinfo_file asm
69
- @filedata = @tester.build_and_read_assemblyinfo_file asm
70
- end
71
-
72
- it "should default to c# for the generated assemby info" do
73
- @filedata.scan('using My.Name.Space;').length.should == 1
74
- end
75
- end
76
-
77
- describe AssemblyInfo, "when providing custom namespaces and specifying C#" do
78
- before :all do
79
- @tester = AssemblyInfoTester.new
80
- @tester.lang_engine = CSharpEngine.new
81
- asm = AssemblyInfo.new
82
- asm.lang_engine = CSharpEngine.new
83
-
84
- asm.namespaces 'My.Name.Space', 'Another.Namespace.GoesHere'
85
-
86
- # Generate the same file twice.
87
- @tester.build_and_read_assemblyinfo_file asm
88
- @filedata = @tester.build_and_read_assemblyinfo_file asm
89
- end
90
-
91
- it "should.execute the namespaces into the using statements" do
92
- @filedata.scan('using My.Name.Space;').length.should == 1
93
- @filedata.scan('using Another.Namespace.GoesHere;').length.should == 1
94
- end
95
- end
96
-
97
- describe AssemblyInfo, "when providing custom namespaces and specifying VB.NET" do
98
- before :all do
99
- @tester = AssemblyInfoTester.new
100
- @tester.lang_engine = VbNetEngine.new
101
- asm = AssemblyInfo.new
102
- asm.lang_engine = VbNetEngine.new
103
-
104
- asm.namespaces 'My.Name.Space', 'Another.Namespace.GoesHere'
105
-
106
- # Generate the same file twice.
107
- @tester.build_and_read_assemblyinfo_file asm
108
- @filedata = @tester.build_and_read_assemblyinfo_file asm
109
- end
110
-
111
- it "should.execute the namespaces into the imports statements" do
112
- @filedata.scan('Imports My.Name.Space').length.should == 1
113
- @filedata.scan('Imports Another.Namespace.GoesHere').length.should == 1
114
- end
115
- end
116
-
117
- describe AssemblyInfo, "when providing custom attributes without specifying a language" do
118
- before :all do
119
- @tester = AssemblyInfoTester.new
120
- asm = AssemblyInfo.new
121
-
122
- asm.custom_attributes :CustomAttribute => "custom attribute data", :AnotherAttribute => "more data here"
123
-
124
- # Generate the same file twice.
125
- @tester.build_and_read_assemblyinfo_file asm
126
- @filedata = @tester.build_and_read_assemblyinfo_file asm
127
- end
128
-
129
- it "should.execute the custom attributes to the assembly info file" do
130
- @filedata.scan('[assembly: CustomAttribute("custom attribute data")]').length.should == 1
131
- @filedata.scan('[assembly: AnotherAttribute("more data here")]').length.should == 1
132
- end
133
- end
134
-
135
- describe AssemblyInfo, "when providing custom attributes and specifying C#" do
136
- before :all do
137
- @tester = AssemblyInfoTester.new
138
- @tester.lang_engine = CSharpEngine.new
139
- asm = AssemblyInfo.new
140
- asm.lang_engine = CSharpEngine.new
141
-
142
- asm.custom_attributes :CustomAttribute => "custom attribute data", :AnotherAttribute => "more data here"
143
-
144
- # Generate the same file twice.
145
- @tester.build_and_read_assemblyinfo_file asm
146
- @filedata = @tester.build_and_read_assemblyinfo_file asm
147
- end
148
-
149
- it "should.execute the custom attributes to the assembly info file" do
150
- @filedata.scan('[assembly: CustomAttribute("custom attribute data")]').length.should == 1
151
- @filedata.scan('[assembly: AnotherAttribute("more data here")]').length.should == 1
152
- end
153
- end
154
-
155
- describe AssemblyInfo, "when providing custom attributes and specifying VB.NET" do
156
- before :all do
157
- @tester = AssemblyInfoTester.new
158
- @tester.lang_engine = VbNetEngine.new
159
- asm = AssemblyInfo.new
160
- asm.lang_engine = VbNetEngine.new
161
-
162
- asm.custom_attributes :CustomAttribute => "custom attribute data", :AnotherAttribute => "more data here"
163
-
164
- # Generate the same file twice.
165
- @tester.build_and_read_assemblyinfo_file asm
166
- @filedata = @tester.build_and_read_assemblyinfo_file asm
167
- end
168
-
169
- it "should.execute the custom attributes to the assembly info file" do
170
- @filedata.scan('<assembly: CustomAttribute("custom attribute data")>').length.should == 1
171
- @filedata.scan('<assembly: AnotherAttribute("more data here")>').length.should == 1
172
- end
173
- end
174
-
175
- describe AssemblyInfo, "when specifying a custom attribute with no data" do
176
- before :all do
177
- @tester = AssemblyInfoTester.new
178
- asm = AssemblyInfo.new
179
-
180
- asm.custom_attributes :NoArgsAttribute => nil
181
-
182
- # Generate the same file twice.
183
- @tester.build_and_read_assemblyinfo_file asm
184
- @filedata = @tester.build_and_read_assemblyinfo_file asm
185
- end
186
-
187
- it "should.execute the attribute with an empty argument list" do
188
- @filedata.scan('[assembly: NoArgsAttribute()]').length.should == 1
189
- end
190
- end
191
-
192
- describe AssemblyInfo, "when specifying an attribute with non-string data" do
193
- before :all do
194
- @tester = AssemblyInfoTester.new
195
- asm = AssemblyInfo.new
196
-
197
- asm.custom_attributes :NonStringAttribute => true
198
-
199
- # Generate the same file twice.
200
- @tester.build_and_read_assemblyinfo_file asm
201
- @filedata = @tester.build_and_read_assemblyinfo_file asm
202
- end
203
-
204
- it "should.execute the attribute data without quotes" do
205
- @filedata.scan('[assembly: NonStringAttribute(true)]').length.should == 1
206
- end
207
- end
208
-
209
- describe AssemblyInfo, "when generating an assembly info file with the built in attributes and no language specified" do
210
- before :all do
211
- @tester = AssemblyInfoTester.new
212
- asm = AssemblyInfo.new
213
-
214
- asm.company_name = @tester.company_name
215
- asm.product_name = @tester.product_name
216
- asm.version = @tester.version
217
- asm.title = @tester.title
218
- asm.description = @tester.description
219
- asm.copyright = @tester.copyright
220
- asm.com_visible = @tester.com_visible
221
- asm.com_guid = @tester.com_guid
222
- asm.file_version = @tester.file_version
223
- asm.trademark = @tester.trademark
224
-
225
- # Generate the same file twice.
226
- @tester.build_and_read_assemblyinfo_file asm
227
- @filedata = @tester.build_and_read_assemblyinfo_file asm
228
- end
229
-
230
- it "should use the system.reflection namespace" do
231
- @filedata.scan('using System.Reflection;').length.should == 1
232
- end
233
-
234
- it "should use the system.runtime.interopservices namespace" do
235
- @filedata.scan('using System.Runtime.InteropServices;').length.should == 1
236
- end
237
-
238
- it "should contain the specified version information" do
239
- @filedata.scan(%Q|[assembly: AssemblyVersion("#{@tester.version}")]|).length.should == 1
240
- end
241
-
242
- it "should contain the assembly title" do
243
- @filedata.scan(%Q|[assembly: AssemblyTitle("#{@tester.title}")]|).length.should == 1
244
- end
245
-
246
- it "should contain the assembly description" do
247
- @filedata.scan(%Q|[assembly: AssemblyDescription("#{@tester.description}")|).length.should == 1
248
- end
249
-
250
- it "should contain the copyright information" do
251
- @filedata.scan(%Q|[assembly: AssemblyCopyright("#{@tester.copyright}")]|).length.should == 1
252
- end
253
-
254
- it "should contain the com visible information" do
255
- @filedata.scan(%Q|[assembly: ComVisible(#{@tester.com_visible})]|).length.should == 1
256
- @filedata.scan(%Q|[assembly: Guid("#{@tester.com_guid}")]|).length.should == 1
257
- end
258
-
259
- it "should contain the company name information" do
260
- @filedata.scan(%Q|[assembly: AssemblyCompany("#{@tester.company_name}")]|).length.should == 1
261
- end
262
-
263
- it "should contain the product information" do
264
- @filedata.scan(%Q|[assembly: AssemblyProduct("#{@tester.product_name}")]|).length.should == 1
265
- end
266
-
267
- it "should contain the file version information" do
268
- @filedata.scan(%Q|[assembly: AssemblyFileVersion("#{@tester.file_version}")]|).length.should == 1
269
- end
270
-
271
- it "should contain the trademark information" do
272
- @filedata.scan(%Q|[assembly: AssemblyTrademark("#{@tester.trademark}")]|).length.should == 1
273
- end
274
- end
275
-
276
- describe AssemblyInfo, "when generating an assembly info file with the built in attributes and C# specified" do
277
- before :all do
278
- @tester = AssemblyInfoTester.new
279
- @tester.lang_engine = CSharpEngine.new
280
- asm = AssemblyInfo.new
281
- asm.lang_engine = CSharpEngine.new
282
-
283
- asm.company_name = @tester.company_name
284
- asm.product_name = @tester.product_name
285
- asm.version = @tester.version
286
- asm.title = @tester.title
287
- asm.description = @tester.description
288
- asm.copyright = @tester.copyright
289
- asm.com_visible = @tester.com_visible
290
- asm.com_guid = @tester.com_guid
291
- asm.file_version = @tester.file_version
292
- asm.trademark = @tester.trademark
293
-
294
- # Generate the same file twice.
295
- @tester.build_and_read_assemblyinfo_file asm
296
- @filedata = @tester.build_and_read_assemblyinfo_file asm
297
- end
298
-
299
- it "should use the system.reflection namespace" do
300
- @filedata.scan('using System.Reflection;').length.should == 1
301
- end
302
-
303
- it "should use the system.runtime.interopservices namespace" do
304
- @filedata.scan('using System.Runtime.InteropServices;').length.should == 1
305
- end
306
-
307
- it "should contain the specified version information" do
308
- @filedata.scan(%Q|[assembly: AssemblyVersion("#{@tester.version}")]|).length.should == 1
309
- end
310
-
311
- it "should contain the assembly title" do
312
- @filedata.scan(%Q|[assembly: AssemblyTitle("#{@tester.title}")]|).length.should == 1
313
- end
314
-
315
- it "should contain the assembly description" do
316
- @filedata.scan(%Q|[assembly: AssemblyDescription("#{@tester.description}")]|).length.should == 1
317
- end
318
-
319
- it "should contain the copyright information" do
320
- @filedata.scan(%Q|[assembly: AssemblyCopyright("#{@tester.copyright}")]|).length.should == 1
321
- end
322
-
323
- it "should contain the com visible information" do
324
- @filedata.scan(%Q|[assembly: ComVisible(#{@tester.com_visible})]|).length.should == 1
325
- @filedata.scan(%Q|[assembly: Guid("#{@tester.com_guid}")]|).length.should == 1
326
- end
327
-
328
- it "should contain the company name information" do
329
- @filedata.scan(%Q|[assembly: AssemblyCompany("#{@tester.company_name}")]|).length.should == 1
330
- end
331
-
332
- it "should contain the product information" do
333
- @filedata.scan(%Q|[assembly: AssemblyProduct("#{@tester.product_name}")]|).length.should == 1
334
- end
335
-
336
- it "should contain the file version information" do
337
- @filedata.scan(%Q|[assembly: AssemblyFileVersion("#{@tester.file_version}")]|).length.should == 1
338
- end
339
-
340
- it "should contain the trademark information" do
341
- @filedata.scan(%Q|[assembly: AssemblyTrademark("#{@tester.trademark}")]|).length.should == 1
342
- end
343
- end
344
-
345
- describe AssemblyInfo, "when generating an assembly info file with the built in attributes and VB.NET specified" do
346
- before :all do
347
- @tester = AssemblyInfoTester.new
348
- @tester.lang_engine = VbNetEngine.new
349
- asm = AssemblyInfo.new
350
- asm.lang_engine = VbNetEngine.new
351
-
352
- asm.company_name = @tester.company_name
353
- asm.product_name = @tester.product_name
354
- asm.version = @tester.version
355
- asm.title = @tester.title
356
- asm.description = @tester.description
357
- asm.copyright = @tester.copyright
358
- asm.com_visible = @tester.com_visible
359
- asm.com_guid = @tester.com_guid
360
- asm.file_version = @tester.file_version
361
- asm.trademark = @tester.trademark
362
-
363
- # Generate the same file twice.
364
- @tester.build_and_read_assemblyinfo_file asm
365
- @filedata = @tester.build_and_read_assemblyinfo_file asm
366
- end
367
-
368
- it "should use the system.reflection namespace" do
369
- @filedata.scan('Imports System.Reflection').length.should == 1
370
- end
371
-
372
- it "should use the system.runtime.interopservices namespace" do
373
- @filedata.scan('Imports System.Runtime.InteropServices').length.should == 1
374
- end
375
-
376
- it "should contain the specified version information" do
377
- @filedata.scan(%Q|<assembly: AssemblyVersion("#{@tester.version}")>|).length.should == 1
378
- end
379
-
380
- it "should contain the assembly title" do
381
- @filedata.scan(%Q|<assembly: AssemblyTitle("#{@tester.title}")>|).length.should == 1
382
- end
383
-
384
- it "should contain the assembly description" do
385
- @filedata.scan(%Q|<assembly: AssemblyDescription("#{@tester.description}")>|).length.should == 1
386
- end
387
-
388
- it "should contain the copyright information" do
389
- @filedata.scan(%Q|<assembly: AssemblyCopyright("#{@tester.copyright}")>|).length.should == 1
390
- end
391
-
392
- it "should contain the com visible information" do
393
- @filedata.scan(%Q|<assembly: ComVisible(#{@tester.com_visible})>|).length.should == 1
394
- @filedata.scan(%Q|<assembly: Guid("#{@tester.com_guid}")>|).length.should == 1
395
- end
396
-
397
- it "should contain the company name information" do
398
- @filedata.scan(%Q|<assembly: AssemblyCompany("#{@tester.company_name}")>|).length.should == 1
399
- end
400
-
401
- it "should contain the product information" do
402
- @filedata.scan(%Q|<assembly: AssemblyProduct("#{@tester.product_name}")>|).length.should == 1
403
- end
404
-
405
- it "should contain the file version information" do
406
- @filedata.scan(%Q|<assembly: AssemblyFileVersion("#{@tester.file_version}")>|).length.should == 1
407
- end
408
-
409
- it "should contain the trademark information" do
410
- @filedata.scan(%Q|<assembly: AssemblyTrademark("#{@tester.trademark}")>|).length.should == 1
411
- end
412
- end
413
-
414
- describe AssemblyInfo, "when generating an assembly info file with no attributes provided" do
415
- before :all do
416
- @tester = AssemblyInfoTester.new
417
- asm = AssemblyInfo.new
418
-
419
- # Generate the same file twice.
420
- @tester.build_and_read_assemblyinfo_file asm
421
- @filedata = @tester.build_and_read_assemblyinfo_file asm
422
- end
423
-
424
- it "should not contain the specified version information" do
425
- @filedata.scan(%Q|[assembly: AssemblyVersion("#{@tester.version}")]|).should be_empty
426
- end
427
-
428
- it "should not contain the assembly title" do
429
- @filedata.scan(%Q|[assembly: AssemblyTitle("#{@tester.title}")]|).should be_empty
430
- end
431
-
432
- it "should not contain the assembly description" do
433
- @filedata.scan(%Q|[assembly: AssemblyDescription("#{@tester.description}")]|).should be_empty
434
- end
435
-
436
- it "should not contain the copyright information" do
437
- @filedata.scan(%Q|[assembly: AssemblyCopyright("#{@tester.copyright}")]|).should be_empty
438
- end
439
-
440
- it "should not contain the com visible information" do
441
- @filedata.scan(%Q|[assembly: ComVisible(#{@tester.com_visible})]|).should be_empty
442
- @filedata.scan(%Q|[assembly: Guid("#{@tester.com_guid}")]|).should be_empty
443
- end
444
-
445
- it "should not contain the company name information" do
446
- @filedata.scan(%Q|[assembly: AssemblyCompany("#{@tester.company_name}")]|).should be_empty
447
- end
448
-
449
- it "should not contain the product information" do
450
- @filedata.scan(%Q|[assembly: AssemblyProduct("#{@tester.product_name}")]|).should be_empty
451
- end
452
-
453
- it "should not contain the file version information" do
454
- @filedata.scan(%Q|[assembly: AssemblyFileVersion("#{@tester.file_version}")]|).should be_empty
455
- end
456
-
457
- it "should not contain the trademark information" do
458
- @filedata.scan(%Q|[assembly: AssemblyTrademark("#{@tester.trademark}")]|).should be_empty
459
- end
460
- end
461
-
462
- describe AssemblyInfo, "when configuring the assembly info generator with a yaml file" do
463
- before :all do
464
- tester = AssemblyInfoTester.new
465
- @asm = AssemblyInfo.new
466
- @asm.configure(tester.yaml_file)
467
- end
468
-
469
- it "should set the values for the provided attributes" do
470
- @asm.version.should == "0.0.1"
471
- @asm.company_name.should == "some company name"
472
- end
473
- end
474
-
475
- describe AssemblyInfo, "when assembly info configuration is provided" do
476
- let :asm do
477
- Albacore.configure do |config|
478
- config.assemblyinfo do |asm|
479
- asm.company_name = "foo"
480
- asm.version = "bar"
481
- end
482
- end
483
- AssemblyInfo.new
484
- end
485
- it "should use the supplied info" do
486
- asm.company_name.should == "foo"
487
- asm.version.should == "bar"
488
- end
489
- end
490
-
491
- describe AssemblyInfo, "when specifying custom data" do
492
- before :all do
493
- @tester = AssemblyInfoTester.new
494
- asm = AssemblyInfo.new
495
-
496
- asm.custom_data "// foo", "// bar"
497
-
498
- # Generate the same file twice.
499
- @tester.build_and_read_assemblyinfo_file asm
500
- @filedata = @tester.build_and_read_assemblyinfo_file asm
501
- end
502
-
503
- it "should write data unmodified to the output" do
504
- @filedata.scan('// foo').length.should == 1
505
- @filedata.scan('// bar').length.should == 1
506
- end
507
- end
508
-
509
- describe AssemblyInfo, "when an input file is provided" do
510
- before :all do
511
- @tester = AssemblyInfoTester.new
512
- asm = AssemblyInfo.new
513
-
514
- asm.version = @tester.version
515
- asm.file_version = @tester.file_version
516
-
517
- asm.custom_data "// foo", "// baz"
518
-
519
- # make it use existing file
520
- @tester.use_input_file
521
-
522
- # Generate the same file twice.
523
- @tester.build_and_read_assemblyinfo_file asm
524
- @filedata = @tester.build_and_read_assemblyinfo_file asm
525
- end
526
- it "should contain correct version attribute" do
527
- @filedata.scan(%Q|[assembly: AssemblyVersion("#{@tester.version}")]|).length.should == 1
528
- end
529
- it "shoud leave comment untouched" do
530
- @filedata.scan(%Q|// A comment we want to see maintained|).length.should == 1
531
- end
532
- it "should introduce a new fileversion attribute" do
533
- @filedata.scan(%Q|[assembly: AssemblyFileVersion("#{@tester.file_version}")]|).length.should == 1
534
- end
535
- it "should still leave custom data that's already in there intact" do
536
- @filedata.scan(%Q|// foo|).length.should == 1
537
- end
538
- it "should add custom data that's still missing" do
539
- @filedata.scan(%Q|// baz|).length.should == 1
540
- end
541
- end
1
+ require '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.downcase.should include(@tester.assemblyinfo_file.downcase)
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.downcase.should include(@tester.assemblyinfo_file.downcase)
38
+ end
39
+ end
40
+
41
+ describe AssemblyInfo, "when generating an assembly info file without an output file specified" do
42
+ before :all do
43
+ @tester = AssemblyInfoTester.new
44
+ asm = AssemblyInfo.new
45
+ asm.extend(FailPatch)
46
+
47
+ strio = StringIO.new
48
+ asm.log_device = strio
49
+
50
+ asm.execute
51
+
52
+ @log_data = strio.string
53
+ end
54
+
55
+ it "should log an error message saying the output file is required" do
56
+ @log_data.should include("output_file cannot be nil")
57
+ end
58
+ end
59
+
60
+ describe AssemblyInfo, "when providing a custom namespace without specifiying the language" do
61
+ before :all do
62
+ @tester = AssemblyInfoTester.new
63
+ asm = AssemblyInfo.new
64
+
65
+ asm.namespaces 'My.Name.Space'
66
+
67
+ # Generate the same file twice.
68
+ @tester.build_and_read_assemblyinfo_file asm
69
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
70
+ end
71
+
72
+ it "should default to c# for the generated assemby info" do
73
+ @filedata.scan('using My.Name.Space;').length.should == 1
74
+ end
75
+ end
76
+
77
+ describe AssemblyInfo, "when providing custom namespaces and specifying C#" do
78
+ before :all do
79
+ @tester = AssemblyInfoTester.new
80
+ @tester.lang_engine = CSharpEngine.new
81
+ asm = AssemblyInfo.new
82
+ asm.lang_engine = CSharpEngine.new
83
+
84
+ asm.namespaces 'My.Name.Space', 'Another.Namespace.GoesHere'
85
+
86
+ # Generate the same file twice.
87
+ @tester.build_and_read_assemblyinfo_file asm
88
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
89
+ end
90
+
91
+ it "should.execute the namespaces into the using statements" do
92
+ @filedata.scan('using My.Name.Space;').length.should == 1
93
+ @filedata.scan('using Another.Namespace.GoesHere;').length.should == 1
94
+ end
95
+ end
96
+
97
+ describe AssemblyInfo, "when providing custom namespaces and specifying VB.NET" do
98
+ before :all do
99
+ @tester = AssemblyInfoTester.new
100
+ @tester.lang_engine = VbNetEngine.new
101
+ asm = AssemblyInfo.new
102
+ asm.lang_engine = VbNetEngine.new
103
+
104
+ asm.namespaces 'My.Name.Space', 'Another.Namespace.GoesHere'
105
+
106
+ # Generate the same file twice.
107
+ @tester.build_and_read_assemblyinfo_file asm
108
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
109
+ end
110
+
111
+ it "should.execute the namespaces into the imports statements" do
112
+ @filedata.scan('Imports My.Name.Space').length.should == 1
113
+ @filedata.scan('Imports Another.Namespace.GoesHere').length.should == 1
114
+ end
115
+ end
116
+
117
+ describe AssemblyInfo, "when providing custom attributes without specifying a language" do
118
+ before :all do
119
+ @tester = AssemblyInfoTester.new
120
+ asm = AssemblyInfo.new
121
+
122
+ asm.custom_attributes :CustomAttribute => "custom attribute data", :AnotherAttribute => "more data here"
123
+
124
+ # Generate the same file twice.
125
+ @tester.build_and_read_assemblyinfo_file asm
126
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
127
+ end
128
+
129
+ it "should.execute the custom attributes to the assembly info file" do
130
+ @filedata.scan('[assembly: CustomAttribute("custom attribute data")]').length.should == 1
131
+ @filedata.scan('[assembly: AnotherAttribute("more data here")]').length.should == 1
132
+ end
133
+ end
134
+
135
+ describe AssemblyInfo, "when providing custom attributes and specifying C#" do
136
+ before :all do
137
+ @tester = AssemblyInfoTester.new
138
+ @tester.lang_engine = CSharpEngine.new
139
+ asm = AssemblyInfo.new
140
+ asm.lang_engine = CSharpEngine.new
141
+
142
+ asm.custom_attributes :CustomAttribute => "custom attribute data", :AnotherAttribute => "more data here"
143
+
144
+ # Generate the same file twice.
145
+ @tester.build_and_read_assemblyinfo_file asm
146
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
147
+ end
148
+
149
+ it "should.execute the custom attributes to the assembly info file" do
150
+ @filedata.scan('[assembly: CustomAttribute("custom attribute data")]').length.should == 1
151
+ @filedata.scan('[assembly: AnotherAttribute("more data here")]').length.should == 1
152
+ end
153
+ end
154
+
155
+ describe AssemblyInfo, "when providing custom attributes and specifying VB.NET" do
156
+ before :all do
157
+ @tester = AssemblyInfoTester.new
158
+ @tester.lang_engine = VbNetEngine.new
159
+ asm = AssemblyInfo.new
160
+ asm.lang_engine = VbNetEngine.new
161
+
162
+ asm.custom_attributes :CustomAttribute => "custom attribute data", :AnotherAttribute => "more data here"
163
+
164
+ # Generate the same file twice.
165
+ @tester.build_and_read_assemblyinfo_file asm
166
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
167
+ end
168
+
169
+ it "should.execute the custom attributes to the assembly info file" do
170
+ @filedata.scan('<assembly: CustomAttribute("custom attribute data")>').length.should == 1
171
+ @filedata.scan('<assembly: AnotherAttribute("more data here")>').length.should == 1
172
+ end
173
+ end
174
+
175
+ describe AssemblyInfo, "when specifying a custom attribute with no data" do
176
+ before :all do
177
+ @tester = AssemblyInfoTester.new
178
+ asm = AssemblyInfo.new
179
+
180
+ asm.custom_attributes :NoArgsAttribute => nil
181
+
182
+ # Generate the same file twice.
183
+ @tester.build_and_read_assemblyinfo_file asm
184
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
185
+ end
186
+
187
+ it "should.execute the attribute with an empty argument list" do
188
+ @filedata.scan('[assembly: NoArgsAttribute()]').length.should == 1
189
+ end
190
+ end
191
+
192
+ describe AssemblyInfo, "when specifying an attribute with non-string data" do
193
+ before :all do
194
+ @tester = AssemblyInfoTester.new
195
+ asm = AssemblyInfo.new
196
+
197
+ asm.custom_attributes :NonStringAttribute => true
198
+
199
+ # Generate the same file twice.
200
+ @tester.build_and_read_assemblyinfo_file asm
201
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
202
+ end
203
+
204
+ it "should.execute the attribute data without quotes" do
205
+ @filedata.scan('[assembly: NonStringAttribute(true)]').length.should == 1
206
+ end
207
+ end
208
+
209
+ describe AssemblyInfo, "when generating an assembly info file with the built in attributes and no language specified" do
210
+ before :all do
211
+ @tester = AssemblyInfoTester.new
212
+ asm = AssemblyInfo.new
213
+
214
+ asm.company_name = @tester.company_name
215
+ asm.product_name = @tester.product_name
216
+ asm.version = @tester.version
217
+ asm.title = @tester.title
218
+ asm.description = @tester.description
219
+ asm.copyright = @tester.copyright
220
+ asm.com_visible = @tester.com_visible
221
+ asm.com_guid = @tester.com_guid
222
+ asm.file_version = @tester.file_version
223
+ asm.trademark = @tester.trademark
224
+
225
+ # Generate the same file twice.
226
+ @tester.build_and_read_assemblyinfo_file asm
227
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
228
+ end
229
+
230
+ it "should use the system.reflection namespace" do
231
+ @filedata.scan('using System.Reflection;').length.should == 1
232
+ end
233
+
234
+ it "should use the system.runtime.interopservices namespace" do
235
+ @filedata.scan('using System.Runtime.InteropServices;').length.should == 1
236
+ end
237
+
238
+ it "should contain the specified version information" do
239
+ @filedata.scan(%Q|[assembly: AssemblyVersion("#{@tester.version}")]|).length.should == 1
240
+ end
241
+
242
+ it "should contain the assembly title" do
243
+ @filedata.scan(%Q|[assembly: AssemblyTitle("#{@tester.title}")]|).length.should == 1
244
+ end
245
+
246
+ it "should contain the assembly description" do
247
+ @filedata.scan(%Q|[assembly: AssemblyDescription("#{@tester.description}")|).length.should == 1
248
+ end
249
+
250
+ it "should contain the copyright information" do
251
+ @filedata.scan(%Q|[assembly: AssemblyCopyright("#{@tester.copyright}")]|).length.should == 1
252
+ end
253
+
254
+ it "should contain the com visible information" do
255
+ @filedata.scan(%Q|[assembly: ComVisible(#{@tester.com_visible})]|).length.should == 1
256
+ @filedata.scan(%Q|[assembly: Guid("#{@tester.com_guid}")]|).length.should == 1
257
+ end
258
+
259
+ it "should contain the company name information" do
260
+ @filedata.scan(%Q|[assembly: AssemblyCompany("#{@tester.company_name}")]|).length.should == 1
261
+ end
262
+
263
+ it "should contain the product information" do
264
+ @filedata.scan(%Q|[assembly: AssemblyProduct("#{@tester.product_name}")]|).length.should == 1
265
+ end
266
+
267
+ it "should contain the file version information" do
268
+ @filedata.scan(%Q|[assembly: AssemblyFileVersion("#{@tester.file_version}")]|).length.should == 1
269
+ end
270
+
271
+ it "should contain the trademark information" do
272
+ @filedata.scan(%Q|[assembly: AssemblyTrademark("#{@tester.trademark}")]|).length.should == 1
273
+ end
274
+ end
275
+
276
+ describe AssemblyInfo, "when generating an assembly info file with the built in attributes and C# specified" do
277
+ before :all do
278
+ @tester = AssemblyInfoTester.new
279
+ @tester.lang_engine = CSharpEngine.new
280
+ asm = AssemblyInfo.new
281
+ asm.lang_engine = CSharpEngine.new
282
+
283
+ asm.company_name = @tester.company_name
284
+ asm.product_name = @tester.product_name
285
+ asm.version = @tester.version
286
+ asm.title = @tester.title
287
+ asm.description = @tester.description
288
+ asm.copyright = @tester.copyright
289
+ asm.com_visible = @tester.com_visible
290
+ asm.com_guid = @tester.com_guid
291
+ asm.file_version = @tester.file_version
292
+ asm.trademark = @tester.trademark
293
+
294
+ # Generate the same file twice.
295
+ @tester.build_and_read_assemblyinfo_file asm
296
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
297
+ end
298
+
299
+ it "should use the system.reflection namespace" do
300
+ @filedata.scan('using System.Reflection;').length.should == 1
301
+ end
302
+
303
+ it "should use the system.runtime.interopservices namespace" do
304
+ @filedata.scan('using System.Runtime.InteropServices;').length.should == 1
305
+ end
306
+
307
+ it "should contain the specified version information" do
308
+ @filedata.scan(%Q|[assembly: AssemblyVersion("#{@tester.version}")]|).length.should == 1
309
+ end
310
+
311
+ it "should contain the assembly title" do
312
+ @filedata.scan(%Q|[assembly: AssemblyTitle("#{@tester.title}")]|).length.should == 1
313
+ end
314
+
315
+ it "should contain the assembly description" do
316
+ @filedata.scan(%Q|[assembly: AssemblyDescription("#{@tester.description}")]|).length.should == 1
317
+ end
318
+
319
+ it "should contain the copyright information" do
320
+ @filedata.scan(%Q|[assembly: AssemblyCopyright("#{@tester.copyright}")]|).length.should == 1
321
+ end
322
+
323
+ it "should contain the com visible information" do
324
+ @filedata.scan(%Q|[assembly: ComVisible(#{@tester.com_visible})]|).length.should == 1
325
+ @filedata.scan(%Q|[assembly: Guid("#{@tester.com_guid}")]|).length.should == 1
326
+ end
327
+
328
+ it "should contain the company name information" do
329
+ @filedata.scan(%Q|[assembly: AssemblyCompany("#{@tester.company_name}")]|).length.should == 1
330
+ end
331
+
332
+ it "should contain the product information" do
333
+ @filedata.scan(%Q|[assembly: AssemblyProduct("#{@tester.product_name}")]|).length.should == 1
334
+ end
335
+
336
+ it "should contain the file version information" do
337
+ @filedata.scan(%Q|[assembly: AssemblyFileVersion("#{@tester.file_version}")]|).length.should == 1
338
+ end
339
+
340
+ it "should contain the trademark information" do
341
+ @filedata.scan(%Q|[assembly: AssemblyTrademark("#{@tester.trademark}")]|).length.should == 1
342
+ end
343
+ end
344
+
345
+ describe AssemblyInfo, "when generating an assembly info file with the built in attributes and VB.NET specified" do
346
+ before :all do
347
+ @tester = AssemblyInfoTester.new
348
+ @tester.lang_engine = VbNetEngine.new
349
+ asm = AssemblyInfo.new
350
+ asm.lang_engine = VbNetEngine.new
351
+
352
+ asm.company_name = @tester.company_name
353
+ asm.product_name = @tester.product_name
354
+ asm.version = @tester.version
355
+ asm.title = @tester.title
356
+ asm.description = @tester.description
357
+ asm.copyright = @tester.copyright
358
+ asm.com_visible = @tester.com_visible
359
+ asm.com_guid = @tester.com_guid
360
+ asm.file_version = @tester.file_version
361
+ asm.trademark = @tester.trademark
362
+
363
+ # Generate the same file twice.
364
+ @tester.build_and_read_assemblyinfo_file asm
365
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
366
+ end
367
+
368
+ it "should use the system.reflection namespace" do
369
+ @filedata.scan('Imports System.Reflection').length.should == 1
370
+ end
371
+
372
+ it "should use the system.runtime.interopservices namespace" do
373
+ @filedata.scan('Imports System.Runtime.InteropServices').length.should == 1
374
+ end
375
+
376
+ it "should contain the specified version information" do
377
+ @filedata.scan(%Q|<assembly: AssemblyVersion("#{@tester.version}")>|).length.should == 1
378
+ end
379
+
380
+ it "should contain the assembly title" do
381
+ @filedata.scan(%Q|<assembly: AssemblyTitle("#{@tester.title}")>|).length.should == 1
382
+ end
383
+
384
+ it "should contain the assembly description" do
385
+ @filedata.scan(%Q|<assembly: AssemblyDescription("#{@tester.description}")>|).length.should == 1
386
+ end
387
+
388
+ it "should contain the copyright information" do
389
+ @filedata.scan(%Q|<assembly: AssemblyCopyright("#{@tester.copyright}")>|).length.should == 1
390
+ end
391
+
392
+ it "should contain the com visible information" do
393
+ @filedata.scan(%Q|<assembly: ComVisible(#{@tester.com_visible})>|).length.should == 1
394
+ @filedata.scan(%Q|<assembly: Guid("#{@tester.com_guid}")>|).length.should == 1
395
+ end
396
+
397
+ it "should contain the company name information" do
398
+ @filedata.scan(%Q|<assembly: AssemblyCompany("#{@tester.company_name}")>|).length.should == 1
399
+ end
400
+
401
+ it "should contain the product information" do
402
+ @filedata.scan(%Q|<assembly: AssemblyProduct("#{@tester.product_name}")>|).length.should == 1
403
+ end
404
+
405
+ it "should contain the file version information" do
406
+ @filedata.scan(%Q|<assembly: AssemblyFileVersion("#{@tester.file_version}")>|).length.should == 1
407
+ end
408
+
409
+ it "should contain the trademark information" do
410
+ @filedata.scan(%Q|<assembly: AssemblyTrademark("#{@tester.trademark}")>|).length.should == 1
411
+ end
412
+ end
413
+
414
+ describe AssemblyInfo, "when generating an assembly info file with no attributes provided" do
415
+ before :all do
416
+ @tester = AssemblyInfoTester.new
417
+ asm = AssemblyInfo.new
418
+
419
+ # Generate the same file twice.
420
+ @tester.build_and_read_assemblyinfo_file asm
421
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
422
+ end
423
+
424
+ it "should not contain the specified version information" do
425
+ @filedata.scan(%Q|[assembly: AssemblyVersion("#{@tester.version}")]|).should be_empty
426
+ end
427
+
428
+ it "should not contain the assembly title" do
429
+ @filedata.scan(%Q|[assembly: AssemblyTitle("#{@tester.title}")]|).should be_empty
430
+ end
431
+
432
+ it "should not contain the assembly description" do
433
+ @filedata.scan(%Q|[assembly: AssemblyDescription("#{@tester.description}")]|).should be_empty
434
+ end
435
+
436
+ it "should not contain the copyright information" do
437
+ @filedata.scan(%Q|[assembly: AssemblyCopyright("#{@tester.copyright}")]|).should be_empty
438
+ end
439
+
440
+ it "should not contain the com visible information" do
441
+ @filedata.scan(%Q|[assembly: ComVisible(#{@tester.com_visible})]|).should be_empty
442
+ @filedata.scan(%Q|[assembly: Guid("#{@tester.com_guid}")]|).should be_empty
443
+ end
444
+
445
+ it "should not contain the company name information" do
446
+ @filedata.scan(%Q|[assembly: AssemblyCompany("#{@tester.company_name}")]|).should be_empty
447
+ end
448
+
449
+ it "should not contain the product information" do
450
+ @filedata.scan(%Q|[assembly: AssemblyProduct("#{@tester.product_name}")]|).should be_empty
451
+ end
452
+
453
+ it "should not contain the file version information" do
454
+ @filedata.scan(%Q|[assembly: AssemblyFileVersion("#{@tester.file_version}")]|).should be_empty
455
+ end
456
+
457
+ it "should not contain the trademark information" do
458
+ @filedata.scan(%Q|[assembly: AssemblyTrademark("#{@tester.trademark}")]|).should be_empty
459
+ end
460
+ end
461
+
462
+ describe AssemblyInfo, "when configuring the assembly info generator with a yaml file" do
463
+ before :all do
464
+ tester = AssemblyInfoTester.new
465
+ @asm = AssemblyInfo.new
466
+ @asm.configure(tester.yaml_file)
467
+ end
468
+
469
+ it "should set the values for the provided attributes" do
470
+ @asm.version.should == "0.0.1"
471
+ @asm.company_name.should == "some company name"
472
+ end
473
+ end
474
+
475
+ describe AssemblyInfo, "when assembly info configuration is provided" do
476
+ let :asm do
477
+ Albacore.configure do |config|
478
+ config.assemblyinfo do |asm|
479
+ asm.company_name = "foo"
480
+ asm.version = "bar"
481
+ end
482
+ end
483
+ AssemblyInfo.new
484
+ end
485
+ it "should use the supplied info" do
486
+ asm.company_name.should == "foo"
487
+ asm.version.should == "bar"
488
+ end
489
+ end
490
+
491
+ describe AssemblyInfo, "when specifying custom data" do
492
+ before :all do
493
+ @tester = AssemblyInfoTester.new
494
+ asm = AssemblyInfo.new
495
+
496
+ asm.custom_data "// foo", "// bar"
497
+
498
+ # Generate the same file twice.
499
+ @tester.build_and_read_assemblyinfo_file asm
500
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
501
+ end
502
+
503
+ it "should write data unmodified to the output" do
504
+ @filedata.scan('// foo').length.should == 1
505
+ @filedata.scan('// bar').length.should == 1
506
+ end
507
+ end
508
+
509
+ describe AssemblyInfo, "when an input file is provided" do
510
+ before :all do
511
+ @tester = AssemblyInfoTester.new
512
+ asm = AssemblyInfo.new
513
+
514
+ asm.version = @tester.version
515
+ asm.file_version = @tester.file_version
516
+
517
+ asm.custom_data "// foo", "// baz"
518
+
519
+ # make it use existing file
520
+ @tester.use_input_file
521
+
522
+ # Generate the same file twice.
523
+ @tester.build_and_read_assemblyinfo_file asm
524
+ @filedata = @tester.build_and_read_assemblyinfo_file asm
525
+ end
526
+ it "should contain correct version attribute" do
527
+ @filedata.scan(%Q|[assembly: AssemblyVersion("#{@tester.version}")]|).length.should == 1
528
+ end
529
+ it "shoud leave comment untouched" do
530
+ @filedata.scan(%Q|// A comment we want to see maintained|).length.should == 1
531
+ end
532
+ it "should introduce a new fileversion attribute" do
533
+ @filedata.scan(%Q|[assembly: AssemblyFileVersion("#{@tester.file_version}")]|).length.should == 1
534
+ end
535
+ it "should still leave custom data that's already in there intact" do
536
+ @filedata.scan(%Q|// foo|).length.should == 1
537
+ end
538
+ it "should add custom data that's still missing" do
539
+ @filedata.scan(%Q|// baz|).length.should == 1
540
+ end
541
+ end