albacore 1.0.0 → 2.0.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (258) hide show
  1. data/.gitignore +6 -21
  2. data/.travis.yml +31 -12
  3. data/Gemfile +14 -6
  4. data/Guardfile +1 -3
  5. data/README.md +200 -47
  6. data/Rakefile +9 -19
  7. data/albacore.gemspec +33 -23
  8. data/lib/albacore.rb +3 -47
  9. data/lib/albacore/albacore_module.rb +57 -0
  10. data/lib/albacore/application.rb +43 -0
  11. data/lib/albacore/cmd_config.rb +66 -0
  12. data/lib/albacore/config_dsl.rb +55 -0
  13. data/lib/albacore/cross_platform_cmd.rb +291 -0
  14. data/lib/albacore/dsl.rb +90 -0
  15. data/lib/albacore/errors/command_failed_error.rb +11 -0
  16. data/lib/albacore/errors/command_not_found_error.rb +13 -0
  17. data/lib/albacore/errors/unfilled_property_error.rb +14 -0
  18. data/lib/albacore/ext/README.md +12 -0
  19. data/lib/albacore/ext/teamcity.rb +64 -0
  20. data/lib/albacore/facts.rb +25 -0
  21. data/lib/albacore/logging.rb +32 -0
  22. data/lib/albacore/nuget_model.rb +387 -0
  23. data/lib/albacore/paths.rb +34 -0
  24. data/lib/albacore/project.rb +141 -0
  25. data/lib/albacore/semver.rb +5 -0
  26. data/lib/albacore/task_types/asmver.rb +72 -0
  27. data/lib/albacore/task_types/asmver/cpp.rb +20 -0
  28. data/lib/albacore/task_types/asmver/cs.rb +17 -0
  29. data/lib/albacore/task_types/asmver/engine.rb +126 -0
  30. data/lib/albacore/task_types/asmver/file_generator.rb +45 -0
  31. data/lib/albacore/task_types/asmver/fs.rb +37 -0
  32. data/lib/albacore/task_types/asmver/vb.rb +27 -0
  33. data/lib/albacore/task_types/build.rb +192 -0
  34. data/lib/albacore/task_types/nugets_authentication.rb +9 -0
  35. data/lib/albacore/task_types/nugets_pack.rb +378 -0
  36. data/lib/albacore/task_types/nugets_restore.rb +138 -0
  37. data/lib/albacore/task_types/test_runner.rb +39 -0
  38. data/lib/albacore/tasks/README.md +16 -0
  39. data/lib/albacore/tasks/albasemver.rb +49 -0
  40. data/lib/albacore/tasks/projectlint.rb +81 -0
  41. data/lib/albacore/tasks/versionizer.rb +65 -0
  42. data/lib/albacore/tools/fluent_migrator.rb +177 -0
  43. data/lib/albacore/tools/restore_hint_paths.rb +112 -0
  44. data/lib/albacore/version.rb +3 -3
  45. data/spec/Rakefile +5 -0
  46. data/spec/albacore_spec.rb +12 -0
  47. data/spec/asmver_spec.rb +151 -0
  48. data/spec/asmver_task_spec.rb +32 -0
  49. data/spec/build_spec.rb +60 -0
  50. data/spec/config_dsl_spec.rb +83 -0
  51. data/spec/cross_platform_cmd_spec.rb +65 -0
  52. data/spec/dsl_spec.rb +39 -0
  53. data/spec/ext_teamcity_spec.rb +71 -0
  54. data/spec/facts_spec.rb +7 -0
  55. data/spec/nuget_model_spec.rb +401 -0
  56. data/spec/nugets_pack_spec.rb +231 -0
  57. data/spec/nugets_restore_spec.rb +55 -0
  58. data/spec/project_spec.rb +26 -0
  59. data/spec/projectlint/added_but_not_on_filesystem/aproject.csproj +29 -0
  60. data/spec/projectlint/correct/File.cs +1 -0
  61. data/spec/projectlint/correct/Image.txt +1 -0
  62. data/spec/projectlint/correct/MyHeavy.heavy +1 -0
  63. data/spec/projectlint/correct/Schema.xsd +1 -0
  64. data/spec/projectlint/correct/SubFolder/AnotherFile.cs +1 -0
  65. data/spec/projectlint/correct/aproject.csproj +29 -0
  66. data/spec/projectlint/on_filesystem_but_not_added/File.cs +1 -0
  67. data/spec/projectlint/on_filesystem_but_not_added/Image.txt +1 -0
  68. data/spec/projectlint/on_filesystem_but_not_added/aproject.csproj +11 -0
  69. data/spec/projectlint_spec.rb +77 -0
  70. data/spec/smoke_spec.rb +55 -0
  71. data/spec/spec_helper.rb +19 -20
  72. data/spec/support/Nuget/NuGet.exe +0 -0
  73. data/spec/support/echo/FSharp.Core.dll +0 -0
  74. data/spec/support/echo/FSharp.Core.xml +10517 -0
  75. data/spec/support/echo/echo.XML +12 -0
  76. data/spec/support/echo/echo.exe +0 -0
  77. data/spec/support/echo/echo.exe.config +17 -0
  78. data/spec/support/echo/echo.pdb +0 -0
  79. data/spec/support/returnstatus/FSharp.Core.dll +0 -0
  80. data/spec/support/returnstatus/FSharp.Core.xml +10517 -0
  81. data/spec/support/returnstatus/returnstatus.XML +12 -0
  82. data/spec/support/returnstatus/returnstatus.exe +0 -0
  83. data/spec/support/returnstatus/returnstatus.exe.config +17 -0
  84. data/spec/support/returnstatus/returnstatus.pdb +0 -0
  85. data/spec/support/sh_interceptor.rb +83 -0
  86. data/spec/testdata/.gitignore +5 -0
  87. data/spec/testdata/DebugProject/.gitignore +1 -0
  88. data/spec/testdata/DebugProject/Degbu.fsproj +57 -0
  89. data/spec/testdata/DebugProject/Degbu.sln +20 -0
  90. data/spec/testdata/DebugProject/Gemfile +1 -0
  91. data/spec/testdata/DebugProject/Library1.fs +4 -0
  92. data/spec/testdata/DebugProject/Rakefile +22 -0
  93. data/spec/testdata/EmptyProject/EmptyProject.csproj +39 -0
  94. data/spec/{assemblyinfo → testdata/EmptyProject/Properties}/AssemblyInfo.cs +5 -5
  95. data/spec/testdata/Gemfile +1 -0
  96. data/spec/testdata/NuGet.exe +0 -0
  97. data/spec/testdata/Project/Library1.fs +4 -0
  98. data/spec/testdata/Project/Project.fsproj +52 -0
  99. data/spec/testdata/Project/Project.sln +20 -0
  100. data/spec/testdata/Project/packages.config +6 -0
  101. data/spec/testdata/Rakefile +22 -0
  102. data/spec/testdata/TestingDependencies/Sample.Commands/Library.fs +6 -0
  103. data/spec/testdata/TestingDependencies/Sample.Commands/Sample.Commands.fsproj +78 -0
  104. data/spec/testdata/TestingDependencies/Sample.Commands/Script.fsx +8 -0
  105. data/spec/testdata/TestingDependencies/Sample.Commands/packages.config +6 -0
  106. data/spec/testdata/TestingDependencies/Sample.Core/Library.fs +3 -0
  107. data/spec/testdata/TestingDependencies/Sample.Core/Sample.Core.fsproj +59 -0
  108. data/spec/testdata/TestingDependencies/Sample.Core/Script.fsx +8 -0
  109. data/spec/testdata/TestingDependencies/Sample.Core/packages.config +4 -0
  110. data/spec/testdata/TestingDependencies/Sample.sln +26 -0
  111. data/spec/testdata/TestingDependencies/vendor/FSharp.Core.dll +0 -0
  112. data/spec/testdata/TestingDependencies/vendor/FSharp.Core.optdata +0 -0
  113. data/spec/testdata/TestingDependencies/vendor/FSharp.Core.sigdata +0 -0
  114. data/spec/testdata/TestingDependencies/vendor/FSharp.Core.xml +8748 -0
  115. data/spec/testdata/example.nuspec +14 -0
  116. data/spec/testdata/example.symbols.nuspec +21 -0
  117. data/spec/tools/fluent_migrator_spec.rb +80 -0
  118. metadata +303 -212
  119. data/.bundle/config +0 -2
  120. data/.rspec +0 -2
  121. data/CONTRIBUTING.md +0 -87
  122. data/LICENSE +0 -21
  123. data/lib/albacore/albacoretask.rb +0 -50
  124. data/lib/albacore/aspnetcompiler.rb +0 -80
  125. data/lib/albacore/assemblyinfo.rb +0 -163
  126. data/lib/albacore/assemblyinfolanguages/assemblyinfoengine.rb +0 -54
  127. data/lib/albacore/assemblyinfolanguages/cppcliengine.rb +0 -18
  128. data/lib/albacore/assemblyinfolanguages/csharpengine.rb +0 -15
  129. data/lib/albacore/assemblyinfolanguages/fsharpengine.rb +0 -23
  130. data/lib/albacore/assemblyinfolanguages/vbnetengine.rb +0 -15
  131. data/lib/albacore/config/aspnetcompilerconfig.rb +0 -30
  132. data/lib/albacore/config/assemblyinfoconfig.rb +0 -18
  133. data/lib/albacore/config/config.rb +0 -22
  134. data/lib/albacore/config/cscconfig.rb +0 -28
  135. data/lib/albacore/config/docuconfig.rb +0 -19
  136. data/lib/albacore/config/execconfig.rb +0 -19
  137. data/lib/albacore/config/fluentmigratorconfig.rb +0 -19
  138. data/lib/albacore/config/ilmergeconfig.rb +0 -19
  139. data/lib/albacore/config/msbuildconfig.rb +0 -29
  140. data/lib/albacore/config/mspecconfig.rb +0 -19
  141. data/lib/albacore/config/mstestconfig.rb +0 -19
  142. data/lib/albacore/config/nantconfig.rb +0 -18
  143. data/lib/albacore/config/nchurnconfig.rb +0 -19
  144. data/lib/albacore/config/ncoverconsoleconfig.rb +0 -19
  145. data/lib/albacore/config/ncoverreportconfig.rb +0 -18
  146. data/lib/albacore/config/ndependconfig.rb +0 -19
  147. data/lib/albacore/config/netversion.rb +0 -28
  148. data/lib/albacore/config/nugetinstallconfig.rb +0 -18
  149. data/lib/albacore/config/nugetpackconfig.rb +0 -18
  150. data/lib/albacore/config/nugetpushconfig.rb +0 -18
  151. data/lib/albacore/config/nugetupdateconfig.rb +0 -18
  152. data/lib/albacore/config/nunitconfig.rb +0 -19
  153. data/lib/albacore/config/nuspecconfig.rb +0 -18
  154. data/lib/albacore/config/plinkconfig.rb +0 -18
  155. data/lib/albacore/config/specflowconfig.rb +0 -18
  156. data/lib/albacore/config/sqlcmdconfig.rb +0 -18
  157. data/lib/albacore/config/unzipconfig.rb +0 -19
  158. data/lib/albacore/config/xbuildconfig.rb +0 -18
  159. data/lib/albacore/config/xunitconfig.rb +0 -18
  160. data/lib/albacore/config/zipdirectoryconfig.rb +0 -18
  161. data/lib/albacore/csc.rb +0 -77
  162. data/lib/albacore/docu.rb +0 -38
  163. data/lib/albacore/exec.rb +0 -20
  164. data/lib/albacore/fluentmigrator.rb +0 -69
  165. data/lib/albacore/ilmerge.rb +0 -38
  166. data/lib/albacore/msbuild.rb +0 -55
  167. data/lib/albacore/mspec.rb +0 -39
  168. data/lib/albacore/mstest.rb +0 -47
  169. data/lib/albacore/nant.rb +0 -41
  170. data/lib/albacore/nchurn.rb +0 -49
  171. data/lib/albacore/ncoverconsole.rb +0 -56
  172. data/lib/albacore/ncoverreport.rb +0 -40
  173. data/lib/albacore/ncoverreports.rb +0 -16
  174. data/lib/albacore/ncoverreports/assemblyfilter.rb +0 -10
  175. data/lib/albacore/ncoverreports/branchcoverage.rb +0 -10
  176. data/lib/albacore/ncoverreports/classfilter.rb +0 -9
  177. data/lib/albacore/ncoverreports/codecoveragebase.rb +0 -27
  178. data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +0 -23
  179. data/lib/albacore/ncoverreports/documentfilter.rb +0 -9
  180. data/lib/albacore/ncoverreports/fullcoveragereport.rb +0 -9
  181. data/lib/albacore/ncoverreports/methodcoverage.rb +0 -10
  182. data/lib/albacore/ncoverreports/methodfilter.rb +0 -9
  183. data/lib/albacore/ncoverreports/namespacefilter.rb +0 -9
  184. data/lib/albacore/ncoverreports/reportbase.rb +0 -23
  185. data/lib/albacore/ncoverreports/reportfilterbase.rb +0 -29
  186. data/lib/albacore/ncoverreports/summaryreport.rb +0 -9
  187. data/lib/albacore/ncoverreports/symbolcoverage.rb +0 -9
  188. data/lib/albacore/ndepend.rb +0 -33
  189. data/lib/albacore/nugetinstall.rb +0 -62
  190. data/lib/albacore/nugetpack.rb +0 -50
  191. data/lib/albacore/nugetpush.rb +0 -40
  192. data/lib/albacore/nugetupdate.rb +0 -50
  193. data/lib/albacore/nunit.rb +0 -46
  194. data/lib/albacore/nuspec.rb +0 -180
  195. data/lib/albacore/output.rb +0 -105
  196. data/lib/albacore/plink.rb +0 -50
  197. data/lib/albacore/specflow.rb +0 -30
  198. data/lib/albacore/sqlcmd.rb +0 -67
  199. data/lib/albacore/support/attrmethods.rb +0 -33
  200. data/lib/albacore/support/createtask.rb +0 -50
  201. data/lib/albacore/support/failure.rb +0 -15
  202. data/lib/albacore/support/logging.rb +0 -38
  203. data/lib/albacore/support/openstruct.rb +0 -13
  204. data/lib/albacore/support/platform.rb +0 -25
  205. data/lib/albacore/support/runcommand.rb +0 -45
  206. data/lib/albacore/support/updateattributes.rb +0 -13
  207. data/lib/albacore/support/yamlconfig.rb +0 -18
  208. data/lib/albacore/unzip.rb +0 -42
  209. data/lib/albacore/xbuild.rb +0 -41
  210. data/lib/albacore/xunit.rb +0 -44
  211. data/lib/albacore/zipdirectory.rb +0 -106
  212. data/spec/albacoremodel_spec.rb +0 -52
  213. data/spec/aspnetcompiler_spec.rb +0 -84
  214. data/spec/assemblyinfo_spec.rb +0 -209
  215. data/spec/attrmethods_spec.rb +0 -135
  216. data/spec/config_spec.rb +0 -32
  217. data/spec/createtask_spec.rb +0 -234
  218. data/spec/csc_spec.rb +0 -86
  219. data/spec/docu_spec.rb +0 -31
  220. data/spec/exec_spec.rb +0 -25
  221. data/spec/fluentmigrator_spec.rb +0 -88
  222. data/spec/ilmerge_spec.rb +0 -35
  223. data/spec/msbuild_spec.rb +0 -55
  224. data/spec/mspec_spec.rb +0 -30
  225. data/spec/mstest_spec.rb +0 -35
  226. data/spec/nant_spec.rb +0 -40
  227. data/spec/nchurn_spec.rb +0 -80
  228. data/spec/ncoverconsole_spec.rb +0 -80
  229. data/spec/ncoverreport_spec.rb +0 -139
  230. data/spec/ndepend_spec.rb +0 -26
  231. data/spec/netversion_spec.rb +0 -51
  232. data/spec/nugetinstall_spec.rb +0 -59
  233. data/spec/nugetpack_spec.rb +0 -49
  234. data/spec/nugetpush_spec.rb +0 -39
  235. data/spec/nugetupdate_spec.rb +0 -49
  236. data/spec/nunit_spec.rb +0 -35
  237. data/spec/nuspec/nuspec.xsd +0 -84
  238. data/spec/nuspec_spec.rb +0 -74
  239. data/spec/output/bar/bar.txt +0 -0
  240. data/spec/output/baz.txt +0 -0
  241. data/spec/output/erb.txt +0 -1
  242. data/spec/output/foo/foo/foo.txt +0 -0
  243. data/spec/output_spec.rb +0 -85
  244. data/spec/patch/system_patch.rb +0 -12
  245. data/spec/platform_spec.rb +0 -15
  246. data/spec/plink_spec.rb +0 -56
  247. data/spec/runcommand_spec.rb +0 -92
  248. data/spec/specflow_spec.rb +0 -30
  249. data/spec/sqlcmd_spec.rb +0 -66
  250. data/spec/unzip_spec.rb +0 -56
  251. data/spec/xbuild_spec.rb +0 -40
  252. data/spec/xunit_spec.rb +0 -30
  253. data/spec/yaml/test.yml +0 -3
  254. data/spec/yamlconfig_spec.rb +0 -53
  255. data/spec/zip/baz.txt +0 -0
  256. data/spec/zip/foo/bar/bar.txt +0 -0
  257. data/spec/zip/foo/foo.txt +0 -0
  258. data/spec/zip_spec.rb +0 -97
@@ -1,13 +0,0 @@
1
- module UpdateAttributes
2
- def update_attributes(attrs)
3
- attrs.each do |key, value|
4
- setter = "#{key}="
5
- send(setter, value) if respond_to?(setter)
6
- @logger.warn "#{key} is not a settable attribute on #{self.class}" unless respond_to?(setter)
7
- end
8
- end
9
-
10
- def <<(attrs)
11
- update_attributes attrs
12
- end
13
- end
@@ -1,18 +0,0 @@
1
- require 'yaml'
2
-
3
- module YAMLConfig
4
- def initialize
5
- super()
6
- end
7
-
8
- def load_config_by_task_name(task_name)
9
- task_config = "#{task_name}.yml"
10
- task_config = File.join(Albacore.configure.yaml_config_folder, task_config) unless Albacore.configure.yaml_config_folder.nil?
11
- configure(task_config) if File.exists?(task_config)
12
- end
13
-
14
- def configure(yml_file)
15
- config = YAML::load(File.open(yml_file))
16
- update_attributes config
17
- end
18
- end
@@ -1,42 +0,0 @@
1
- require "albacore/albacoretask"
2
- require "albacore/config/unzipconfig"
3
- require "zip"
4
- require "zip/filesystem"
5
-
6
- class Unzip
7
- include Albacore::Task
8
- include Configuration::Unzip
9
-
10
- attr_reader :force
11
-
12
- attr_accessor :destination,
13
- :file
14
-
15
- def initialize
16
- super()
17
- update_attributes(unzip.to_hash)
18
- end
19
-
20
- def execute()
21
- unless @file
22
- fail_with_message("unzip requires #file")
23
- return
24
- end
25
-
26
- Zip::File.open(@file) do |zip|
27
- zip.each do |file|
28
- path = File.join(@destination, file.name)
29
- dir = File.dirname(path)
30
-
31
- FileUtils.mkdir_p(dir)
32
- File.delete(path) if (@force && File.file?(path))
33
-
34
- zip.extract(file, path) unless File.exist?(path)
35
- end
36
- end
37
- end
38
-
39
- def force
40
- @force = true
41
- end
42
- end
@@ -1,41 +0,0 @@
1
- require "albacore/albacoretask"
2
- require "albacore/config/xbuildconfig"
3
-
4
- class XBuild
5
- TaskName = :xbuild
6
-
7
- include Albacore::Task
8
- include Albacore::RunCommand
9
- include Configuration::XBuild
10
-
11
- attr_accessor :solution,
12
- :verbosity
13
-
14
- attr_array :targets
15
-
16
- attr_hash :properties
17
-
18
- def initialize
19
- super()
20
- update_attributes(xbuild.to_hash)
21
- end
22
-
23
- def execute
24
- unless @solution
25
- fail_with_message("xbuild requires #solution")
26
- return
27
- end
28
-
29
- result = run_command("xbuild", build_parameters)
30
- fail_with_message("XBuild failed, see the build log for more details.") unless result
31
- end
32
-
33
- def build_parameters
34
- p = []
35
- p << "\"#{solution}\""
36
- p << "/verbosity:#{@verbosity}" if @verbosity
37
- p << @properties.map { |key, value| "/p:#{key}\=\"#{value}\"" } if @properties
38
- p << "/target:#{@targets.join(";")}" if @targets
39
- p
40
- end
41
- end
@@ -1,44 +0,0 @@
1
- require "albacore/albacoretask"
2
- require "albacore/config/xunitconfig"
3
-
4
- class XUnit
5
- TaskName = :xunit
6
-
7
- include Albacore::Task
8
- include Albacore::RunCommand
9
- include Configuration::XUnit
10
-
11
- attr_accessor :assembly
12
-
13
- attr_hash :results_path
14
-
15
- def initialize()
16
- super()
17
- update_attributes(xunit.to_hash)
18
- end
19
-
20
- def execute()
21
- unless @assembly
22
- fail_with_message("xunit requires #assembly")
23
- return
24
- end
25
-
26
- result = run_command("xunit", build_parameters)
27
- fail_with_message("XUnit failed, see build log for details.") unless result
28
- end
29
-
30
- def build_parameters
31
- p = []
32
- p << "\"#{@assembly}\""
33
- p << "/#{@results_path.first.first} \"#{@results_path.first.last}\"" if @results_path
34
- p
35
- end
36
-
37
- def build_command_line
38
- c = []
39
- c << @command
40
- c << build_parameters
41
- c << @parameters
42
- c
43
- end
44
- end
@@ -1,106 +0,0 @@
1
- require "albacore/albacoretask"
2
- require "albacore/config/zipdirectoryconfig"
3
- require "zip"
4
-
5
- class ZipDirectory
6
- TaskName = :zip
7
-
8
- include Albacore::Task
9
- include Configuration::Zip
10
-
11
- attr_reader :flatten
12
-
13
- attr_accessor :output_path
14
-
15
- attr_array :dirs,
16
- :files,
17
- :exclusions
18
-
19
- def initialize
20
- @dirs = []
21
- @files = []
22
- @exclusions = []
23
-
24
- super()
25
- update_attributes(zip.to_hash)
26
- end
27
-
28
- def execute()
29
- unless @output_path
30
- fail_with_message("zip requires #output_path")
31
- return
32
- end
33
-
34
- FileUtils.rm_rf(@output_path)
35
-
36
- exclusions = Exclusions.new(@dirs)
37
- @exclusions.each { |ex| exclusions.expand!(ex) }
38
-
39
- archive = Archive.new(output_path, exclusions, flatten)
40
- @dirs.each { |path| archive.dir(path) }
41
- @files.each { |path| archive.file(path) }
42
- archive.close()
43
- end
44
-
45
- def flatten
46
- @flatten = true
47
- end
48
- end
49
-
50
- class Archive
51
- def initialize(archive_path, exclusions, flatten)
52
- @archive = Zip::File.open(archive_path, Zip::File::CREATE)
53
- @exclusions = exclusions
54
- @flatten = flatten
55
- end
56
-
57
- def dir(dir)
58
- pattern = File.join(dir, "**/*")
59
- Dir[pattern].each do |file|
60
- next if @exclusions.exclude?(file)
61
-
62
- name = @flatten ? file.sub(File.join(dir, "/"), "") : file
63
- @archive.add(name, file)
64
- end
65
- end
66
-
67
- def file(file)
68
- return if @exclusions.exclude?(file)
69
-
70
- name = @flatten ? file.split("/").last : file
71
- @archive.add(name, file)
72
- end
73
-
74
- def close()
75
- @archive.close()
76
- end
77
- end
78
-
79
- class Exclusions
80
- def initialize(dirs)
81
- @dirs = dirs
82
- @exclusions = []
83
- end
84
-
85
- def expand!(ex)
86
- if ex.is_a?(Regexp)
87
- @exclusions << ex
88
- return
89
- end
90
-
91
- @dirs.each do |dir|
92
- Dir.chdir(dir) do
93
- matches = Dir.glob(ex)
94
- matches = matches.map { |path| File.join(dir, path) } unless matches[0] == ex
95
- @exclusions += (matches.empty? ? [ex] : matches)
96
- end
97
- end
98
- end
99
-
100
- def exclude?(path)
101
- @exclusions.any? do |ex|
102
- return path =~ ex if ex.is_a?(Regexp)
103
- return path == ex
104
- end
105
- end
106
- end
@@ -1,52 +0,0 @@
1
- require "spec_helper"
2
-
3
- class ModelTest
4
- include Albacore::Task
5
- attr_accessor :foo, :bar
6
- attr_hash :a_hash
7
- attr_array :a_array
8
- end
9
-
10
- class NamedTaskExample
11
- TaskName = [:namedtask, :anothername]
12
- include Albacore::Task
13
- end
14
-
15
- describe "when updating object attributes with a valid set of hash keys" do
16
- before :each do
17
- @model = ModelTest.new
18
- @model << {:foo => "test", :bar => "whatever"}
19
- end
20
-
21
- it "should set the attributes correctly" do
22
- @model.foo.should == "test"
23
- @model.bar.should == "whatever"
24
- end
25
- end
26
-
27
- describe "when updating an object attributes with an invalid hash key" do
28
- before :each do
29
- @model = ModelTest.new
30
- str = StringIO.new
31
- @model.log_device = str
32
- @model << {:something => "broken"}
33
- @log = str.string
34
- end
35
-
36
- it "should warn about the attribute not being found" do
37
- @log.should include("something is not a settable attribute on ModelTest")
38
- end
39
- end
40
-
41
- describe "when an class includes albacoretask" do
42
- it "should create a rake task for that class" do
43
- respond_to?(:modeltest).should be_true
44
- end
45
- end
46
-
47
- describe "when an albacoretask class specifies task names" do
48
- it "should create a task with the specified names" do
49
- respond_to?(:namedtask).should be_true
50
- respond_to?(:anothername).should be_true
51
- end
52
- end
@@ -1,84 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe AspNetCompiler do
4
- subject(:task) do
5
- task = AspNetCompiler.new()
6
- task.extend(SystemPatch)
7
- task.command = "aspnetcompiler"
8
- task.physical_path = "physical/path"
9
- task.target_path = "target/path"
10
- task.clean
11
- task.debug
12
- task.force
13
- task.fixed_names
14
- task.delay_sign
15
- task.updateable
16
- task.no_logo
17
- task
18
- end
19
-
20
- let(:cmd) { task.system_command }
21
-
22
- context "when overriding all values" do
23
- before :each do
24
- task.virtual_path = "virtual/path"
25
- task.execute
26
- end
27
-
28
- it "should use the command" do
29
- cmd.should include("aspnetcompiler")
30
- end
31
-
32
- it "should use the physical path" do
33
- cmd.should include("-p \"physical/path\"") if Albacore::Support::Platform.linux?
34
- cmd.should include("-p \"physical\\path\"") if !Albacore::Support::Platform.linux?
35
- end
36
-
37
- it "should use the target path" do
38
- cmd.should include("\"target/path\"") if Albacore::Support::Platform.linux?
39
- cmd.should include("\"target\\path\"") if !Albacore::Support::Platform.linux?
40
- end
41
-
42
- it "should use default virtual path" do
43
- cmd.should include("-v virtual/path")
44
- end
45
-
46
- it "should be clean" do
47
- cmd.should include("-c")
48
- end
49
-
50
- it "should show no logo" do
51
- cmd.should include("-nologo")
52
- end
53
-
54
- it "should delay sign" do
55
- cmd.should include("-delaysign")
56
- end
57
-
58
- it "should use fixed names" do
59
- cmd.should include("-fixednames")
60
- end
61
-
62
- it "should be updateable" do
63
- cmd.should include("-u")
64
- end
65
-
66
- it "should force" do
67
- cmd.should include("-f")
68
- end
69
-
70
- it "should debug" do
71
- cmd.should include("-d")
72
- end
73
- end
74
-
75
- context "when relying on defaults" do
76
- before :each do
77
- task.execute
78
- end
79
-
80
- it "should use the default virtual path" do
81
- cmd.should include("-v /")
82
- end
83
- end
84
- end
@@ -1,209 +0,0 @@
1
- require "fileutils"
2
- require "spec_helper"
3
- require "tempfile"
4
-
5
- describe AssemblyInfo do
6
- let(:input_path) { File.expand_path("spec/assemblyinfo/AssemblyInfo.cs") }
7
- let(:output_path) { Tempfile.new("AssemblyInfo") }
8
- let(:content) { File.read(output_path) }
9
-
10
- subject(:task) do
11
- task = AssemblyInfo.new()
12
- task.output_file = output_path
13
- task.version = "1.0.0"
14
- task.file_version = "1.0.0"
15
- task.informational_version = "1.0.0"
16
- task.title = "title"
17
- task.description = "description"
18
- task.copyright = "copyright"
19
- task.company_name = "company"
20
- task.product_name = "product"
21
- task.trademark = "trademark"
22
- task.com_visible
23
- task.com_guid = "00000000-0000-0000-0000-000000000000"
24
- task.initial_comments = ["//comment"]
25
- task.namespaces = ["Foo.Bar"]
26
- task.custom_data = ["whatever"]
27
- task.custom_attributes = {
28
- :String => "string",
29
- :Null => nil,
30
- :Literal => false,
31
- :Multiple => ["string", true, 0],
32
- :Named => {:one => "string", :two => true, :three => 0},
33
- :Mixed => ["string", {:two => true}]
34
- }
35
- task
36
- end
37
-
38
- after :each do
39
- FileUtils.rm_rf(output_path)
40
- end
41
-
42
- context "when using the default engine (csharp)" do
43
- before :each do
44
- task.execute
45
- end
46
-
47
- it "should write the comments first" do
48
- content.should include("//comment")
49
- end
50
-
51
- it "should write the custom namespaces" do
52
- content.should include("using Foo.Bar;")
53
- end
54
-
55
- it "should write the required namespaces" do
56
- content.should include("using System.Reflection;")
57
- content.should include("using System.Runtime.InteropServices;")
58
- end
59
-
60
- it "should write the title" do
61
- content.should include("[assembly: AssemblyTitle(\"title\")]")
62
- end
63
-
64
- it "should write the description" do
65
- content.should include("[assembly: AssemblyDescription(\"description\")]")
66
- end
67
-
68
- it "should write the company" do
69
- content.should include("[assembly: AssemblyCompany(\"company\")]")
70
- end
71
-
72
- it "should write the product" do
73
- content.should include("[assembly: AssemblyProduct(\"product\")]")
74
- end
75
-
76
- it "should write the copyright" do
77
- content.should include("[assembly: AssemblyCopyright(\"copyright\")]")
78
- end
79
-
80
- it "should write the trademark" do
81
- content.should include("[assembly: AssemblyTrademark(\"trademark\")]")
82
- end
83
-
84
- it "should be COM visible" do
85
- content.should include("[assembly: ComVisible(true)]")
86
- end
87
-
88
- it "should write the COM guid" do
89
- content.should include("[assembly: Guid(\"00000000-0000-0000-0000-000000000000\")]")
90
- end
91
-
92
- it "should write the version" do
93
- content.should include("[assembly: AssemblyVersion(\"1.0.0\")]")
94
- end
95
-
96
- it "should write the file version" do
97
- content.should include("[assembly: AssemblyFileVersion(\"1.0.0\")]")
98
- end
99
-
100
- it "should write the informational version" do
101
- content.should include("[assembly: AssemblyInformationalVersion(\"1.0.0\")]")
102
- end
103
-
104
- it "should write the custom string attribute" do
105
- content.should include("[assembly: String(\"string\")]")
106
- end
107
-
108
- it "should write the custom null attribute" do
109
- content.should include("[assembly: Null()]")
110
- end
111
-
112
- it "should write the custom literal attribute" do
113
- content.should include("[assembly: Literal(false)]")
114
- end
115
-
116
- it "should write the custom multi-value attribute" do
117
- content.should include("[assembly: Multiple(\"string\", true, 0)]")
118
- end
119
-
120
- it "should write the custom multi-value-named attribute" do
121
- content.should include("[assembly: Named(one = \"string\", two = true, three = 0)]")
122
- end
123
-
124
- it "should write the custom mixed-multi-value attribute" do
125
- content.should include("[assembly: Mixed(\"string\", two = true)]")
126
- end
127
-
128
- it "should write the custom data" do
129
- content.should include("whatever")
130
- end
131
- end
132
-
133
- context "when starting from an input file" do
134
- before :each do
135
- task.input_file = input_path
136
- task.title = nil #=> so it isn't overwritten
137
- task.execute
138
- end
139
-
140
- it "should not lose existing comments" do
141
- content.should include("// General Information about an assembly is controlled through the following")
142
- end
143
-
144
- it "should not lose existing namespaces" do
145
- content.should include("using System.Runtime.InteropServices;")
146
- end
147
-
148
- it "should not lose existing attributes" do
149
- content.should include("[assembly: AssemblyTitle(\"TestSolution\")]")
150
- end
151
-
152
- it "should overwrite customized properties" do
153
- content.should include("[assembly: AssemblyVersion(\"1.0.0\")]")
154
- end
155
- end
156
-
157
- context "when using the fsharp engine" do
158
- before :each do
159
- task.lang_engine = FSharpEngine.new()
160
- task.execute
161
- end
162
-
163
- it "should contain a module definition" do
164
- content.should include("module AssemblyInfo")
165
- end
166
-
167
- it "should contain the module definition ending" do
168
- content.should include("()")
169
- end
170
-
171
- it "should use open for namespaces" do
172
- content.should include("open System.Reflection")
173
- end
174
-
175
- it "should use angle brackets for attributes" do
176
- content.should include("[<assembly: AssemblyTitle(\"title\")>]")
177
- end
178
- end
179
-
180
- context "when using the vbnet engine" do
181
- before :each do
182
- task.lang_engine = VbNetEngine.new()
183
- task.execute
184
- end
185
-
186
- it "should use imports for namespaces" do
187
- content.should include("Imports System.Reflection")
188
- end
189
-
190
- it "should use angle brackets for attributes" do
191
- content.should include("<assembly: AssemblyTitle(\"title\")>")
192
- end
193
- end
194
-
195
- context "when using the cpp cli engine" do
196
- before :each do
197
- task.lang_engine = CppCliEngine.new()
198
- task.execute
199
- end
200
-
201
- it "should use using for namespaces" do
202
- content.should include("using namespace System::Reflection;")
203
- end
204
-
205
- it "should use square brackets for attributes" do
206
- content.should include("[assembly: AssemblyTitle(\"title\")]")
207
- end
208
- end
209
- end