albacore 0.2.0.preview1 → 0.2.0.preview2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. data/README.markdown +7 -2
  2. data/VERSION +1 -1
  3. data/install_dependencies.rb +1 -1
  4. data/lib/albacore.rb +6 -17
  5. data/lib/albacore/albacoretask.rb +43 -0
  6. data/lib/albacore/assemblyinfo.rb +10 -7
  7. data/lib/albacore/config/assemblyinfoconfig.rb +4 -12
  8. data/lib/albacore/config/config.rb +16 -8
  9. data/lib/albacore/config/cscconfig.rb +2 -7
  10. data/lib/albacore/config/docuconfig.rb +3 -5
  11. data/lib/albacore/config/execconfig.rb +4 -11
  12. data/lib/albacore/config/msbuildconfig.rb +2 -5
  13. data/lib/albacore/config/mspectestrunnerconfig.rb +15 -0
  14. data/lib/albacore/config/nantconfig.rb +4 -11
  15. data/lib/albacore/config/ncoverconsoleconfig.rb +4 -11
  16. data/lib/albacore/config/ncoverreportconfig.rb +4 -11
  17. data/lib/albacore/config/ndependconfig.rb +4 -11
  18. data/lib/albacore/config/netversion.rb +0 -2
  19. data/lib/albacore/config/nunittestrunnerconfig.rb +14 -0
  20. data/lib/albacore/config/specflowreportconfig.rb +2 -5
  21. data/lib/albacore/config/sqlcmdconfig.rb +4 -11
  22. data/lib/albacore/config/unzipconfig.rb +4 -11
  23. data/lib/albacore/config/xbuildconfig.rb +4 -11
  24. data/lib/albacore/config/xunittestrunnerconfig.rb +15 -0
  25. data/lib/albacore/config/zipdirectoryconfig.rb +15 -0
  26. data/lib/albacore/csc.rb +31 -5
  27. data/lib/albacore/docu.rb +2 -3
  28. data/lib/albacore/exec.rb +3 -5
  29. data/lib/albacore/msbuild.rb +3 -3
  30. data/lib/albacore/mspectestrunner.rb +5 -6
  31. data/lib/albacore/nant.rb +4 -6
  32. data/lib/albacore/ncoverconsole.rb +4 -6
  33. data/lib/albacore/ncoverreport.rb +4 -6
  34. data/lib/albacore/ncoverreports/codecoveragebase.rb +2 -2
  35. data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +2 -2
  36. data/lib/albacore/ncoverreports/fullcoveragereport.rb +0 -8
  37. data/lib/albacore/ncoverreports/reportfilterbase.rb +2 -2
  38. data/lib/albacore/ncoverreports/summaryreport.rb +0 -4
  39. data/lib/albacore/ndepend.rb +4 -6
  40. data/lib/albacore/nunittestrunner.rb +4 -5
  41. data/lib/albacore/specflowreport.rb +2 -2
  42. data/lib/albacore/sqlcmd.rb +33 -11
  43. data/lib/albacore/support/createtask.rb +30 -0
  44. data/lib/albacore/support/runcommand.rb +21 -30
  45. data/lib/albacore/support/updateattributes.rb +13 -0
  46. data/lib/albacore/unzip.rb +3 -5
  47. data/lib/albacore/xbuild.rb +5 -6
  48. data/lib/albacore/xunittestrunner.rb +4 -5
  49. data/lib/albacore/zipdirectory.rb +5 -6
  50. data/rakefile.rb +7 -8
  51. data/spec/albacoremodel_spec.rb +20 -2
  52. data/spec/assemblyinfo_spec.rb +27 -14
  53. data/spec/config_spec.rb +17 -2
  54. data/spec/createtask_spec.rb +51 -28
  55. data/spec/csc_spec.rb +135 -3
  56. data/spec/docu_spec.rb +11 -14
  57. data/spec/exec_spec.rb +1 -1
  58. data/spec/msbuild_spec.rb +9 -9
  59. data/spec/nant_spec.rb +4 -4
  60. data/spec/ncoverconsole_spec.rb +13 -13
  61. data/spec/ncoverreport_spec.rb +17 -17
  62. data/spec/ndepend_spec.rb +6 -6
  63. data/spec/runcommand_spec.rb +22 -3
  64. data/spec/sqlcmd_spec.rb +154 -12
  65. data/spec/support/assemblyinfotester.rb +1 -1
  66. data/spec/support/spec_helper.rb +2 -2
  67. data/spec/yamlconfig_spec.rb +3 -3
  68. data/spec/zip_spec.rb +4 -4
  69. metadata +32 -119
  70. data/lib/albacore/albacoremodel.rb +0 -28
  71. data/lib/albacore/config/mspecconfig.rb +0 -21
  72. data/lib/albacore/config/nunitconfig.rb +0 -20
  73. data/lib/albacore/config/xunitconfig.rb +0 -22
  74. data/lib/albacore/config/zipconfig.rb +0 -22
  75. data/lib/rake/assemblyinfotask.rb +0 -3
  76. data/lib/rake/csctask.rb +0 -3
  77. data/lib/rake/docutask.rb +0 -3
  78. data/lib/rake/exectask.rb +0 -3
  79. data/lib/rake/msbuildtask.rb +0 -3
  80. data/lib/rake/mspectask.rb +0 -3
  81. data/lib/rake/nanttask.rb +0 -3
  82. data/lib/rake/ncoverconsoletask.rb +0 -3
  83. data/lib/rake/ncoverreporttask.rb +0 -3
  84. data/lib/rake/ndependtask.rb +0 -3
  85. data/lib/rake/nunittask.rb +0 -3
  86. data/lib/rake/specflowreporttask.rb +0 -3
  87. data/lib/rake/sqlcmdtask.rb +0 -3
  88. data/lib/rake/support/albacoretask.rb +0 -30
  89. data/lib/rake/support/createtask.rb +0 -21
  90. data/lib/rake/unziptask.rb +0 -3
  91. data/lib/rake/xbuildtask.rb +0 -7
  92. data/lib/rake/xunittask.rb +0 -3
  93. data/lib/rake/ziptask.rb +0 -3
  94. data/spec/assemblyinfotask_spec.rb +0 -32
  95. data/spec/csctask_spec.rb +0 -1
  96. data/spec/docutask_spec.rb +0 -52
  97. data/spec/exectask_spec.rb +0 -46
  98. data/spec/msbuildtask_spec.rb +0 -46
  99. data/spec/mspectask_spec.rb +0 -46
  100. data/spec/nanttask_spec.rb +0 -46
  101. data/spec/ncoverconsoletask_spec.rb +0 -46
  102. data/spec/ncoverreporttask_spec.rb +0 -46
  103. data/spec/ndependtask_spec.rb +0 -46
  104. data/spec/nunittask_spec.rb +0 -46
  105. data/spec/spec.opts +0 -1
  106. data/spec/specflowreporttask_spec.rb +0 -48
  107. data/spec/sqlcmdtask_spec.rb +0 -32
  108. data/spec/support/AssemblyInfo/assemblyinfo.yml +0 -2
  109. data/spec/support/CodeCoverage/mspec/assemblies/Machine.Specifications.NUnit.dll +0 -0
  110. data/spec/support/CodeCoverage/mspec/assemblies/Machine.Specifications.dll +0 -0
  111. data/spec/support/CodeCoverage/mspec/assemblies/TestSolution.MSpecTests.dll +0 -0
  112. data/spec/support/CodeCoverage/mspec/assemblies/TestSolution.dll +0 -0
  113. data/spec/support/CodeCoverage/mspec/assemblies/nunit.framework.dll +0 -0
  114. data/spec/support/CodeCoverage/nunit/assemblies/TestSolution.Tests.dll +0 -0
  115. data/spec/support/CodeCoverage/nunit/assemblies/TestSolution.dll +0 -0
  116. data/spec/support/CodeCoverage/nunit/assemblies/nunit.framework.dll +0 -0
  117. data/spec/support/CodeCoverage/nunit/assemblies/with spaces/TestSolution.Tests.dll +0 -0
  118. data/spec/support/CodeCoverage/nunit/assemblies/with spaces/TestSolution.dll +0 -0
  119. data/spec/support/CodeCoverage/nunit/assemblies/with spaces/nunit.framework.dll +0 -0
  120. data/spec/support/CodeCoverage/nunit/failing_assemblies/TestSolution.FailingTests.dll +0 -0
  121. data/spec/support/CodeCoverage/nunit/failing_assemblies/nunit.framework.dll +0 -0
  122. data/spec/support/CodeCoverage/report/coverage.xml +0 -4578
  123. data/spec/support/CodeCoverage/xunit/assemblies/TestSolution.XUnitTests.dll +0 -0
  124. data/spec/support/CodeCoverage/xunit/assemblies/TestSolution.dll +0 -0
  125. data/spec/support/CodeCoverage/xunit/assemblies/xunit.dll +0 -0
  126. data/spec/support/CodeCoverage/xunit/assemblies/xunit.xml +0 -2306
  127. data/spec/support/SpecFlow/TechTalk.SpecFlow.dll +0 -0
  128. data/spec/support/SpecFlow/TestSolution.SpecFlow.dll +0 -0
  129. data/spec/support/SpecFlow/TestSolution.SpecFlow.pdb +0 -0
  130. data/spec/support/SpecFlow/TestSolution.dll +0 -0
  131. data/spec/support/SpecFlow/TestSolution.pdb +0 -0
  132. data/spec/support/SpecFlow/nunit.framework.dll +0 -0
  133. data/spec/support/TestSolution/NDependProject.xml +0 -315
  134. data/spec/support/TestSolution/TestSolution.5.0.ReSharper.user +0 -27
  135. data/spec/support/TestSolution/TestSolution.FailingTests/FailingTestFixture.cs +0 -19
  136. data/spec/support/TestSolution/TestSolution.FailingTests/Properties/AssemblyInfo.cs +0 -36
  137. data/spec/support/TestSolution/TestSolution.FailingTests/TestSolution.FailingTests.csproj +0 -63
  138. data/spec/support/TestSolution/TestSolution.MSpecTests/Properties/AssemblyInfo.cs +0 -36
  139. data/spec/support/TestSolution/TestSolution.MSpecTests/SomeSpecTest.cs +0 -18
  140. data/spec/support/TestSolution/TestSolution.MSpecTests/TestSolution.MSpecTests.csproj +0 -77
  141. data/spec/support/TestSolution/TestSolution.SpecFlow/OneFeature.feature +0 -8
  142. data/spec/support/TestSolution/TestSolution.SpecFlow/OneFeature.feature.cs +0 -73
  143. data/spec/support/TestSolution/TestSolution.SpecFlow/Properties/AssemblyInfo.cs +0 -36
  144. data/spec/support/TestSolution/TestSolution.SpecFlow/StepDefinition.cs +0 -30
  145. data/spec/support/TestSolution/TestSolution.SpecFlow/TestSolution.SpecFlow.csproj +0 -84
  146. data/spec/support/TestSolution/TestSolution.Tests/Properties/AssemblyInfo.cs +0 -36
  147. data/spec/support/TestSolution/TestSolution.Tests/SomeTestFixture.cs +0 -23
  148. data/spec/support/TestSolution/TestSolution.Tests/TestSolution.Tests.csproj +0 -69
  149. data/spec/support/TestSolution/TestSolution.XUnitTests/Class1.cs +0 -19
  150. data/spec/support/TestSolution/TestSolution.XUnitTests/FailingTestFixture.cs +0 -14
  151. data/spec/support/TestSolution/TestSolution.XUnitTests/Properties/AssemblyInfo.cs +0 -36
  152. data/spec/support/TestSolution/TestSolution.XUnitTests/TestSolution.XUnitTests.csproj +0 -70
  153. data/spec/support/TestSolution/TestSolution.build +0 -25
  154. data/spec/support/TestSolution/TestSolution.sln +0 -50
  155. data/spec/support/TestSolution/TestSolution/Class1.cs +0 -17
  156. data/spec/support/TestSolution/TestSolution/Properties/AssemblyInfo.cs +0 -36
  157. data/spec/support/TestSolution/TestSolution/TestSolution.csproj +0 -59
  158. data/spec/support/csc/File1.cs +0 -9
  159. data/spec/support/csc/File2.cs +0 -9
  160. data/spec/support/csc/output/ignorethis.txt +0 -1
  161. data/spec/support/test.yml +0 -4
  162. data/spec/support/yamlconfig/msbuild.yml +0 -5
  163. data/spec/support/yamlconfig/yaml_autoconfig_test.yml +0 -1
  164. data/spec/support/zip/files/subfolder/sub file.txt +0 -1
  165. data/spec/support/zip/files/testfile.txt +0 -1
  166. data/spec/xunittask_spec.rb +0 -32
  167. data/spec/ziptask_spec.rb +0 -33
@@ -1,10 +1,9 @@
1
- require 'albacore/albacoremodel'
2
- require 'albacore/config/nunitconfig'
1
+ require 'albacore/albacoretask'
3
2
 
4
3
  class NUnitTestRunner
5
- include AlbacoreModel
4
+ TaskName = :nunit
5
+ include AlbacoreTask
6
6
  include RunCommand
7
- include Configuration::NUnit
8
7
 
9
8
  attr_array :assemblies, :options
10
9
 
@@ -12,7 +11,7 @@ class NUnitTestRunner
12
11
  @options=[]
13
12
  @assemblies=[]
14
13
  super()
15
- update_attributes nunit.to_hash
14
+ update_attributes Albacore.configuration.nunit.to_hash
16
15
  @command = command unless command.nil?
17
16
  end
18
17
 
@@ -1,8 +1,8 @@
1
- require 'albacore/albacoremodel'
1
+ require 'albacore/albacoretask'
2
2
  require 'albacore/config/specflowreportconfig'
3
3
 
4
4
  class SpecFlowReport
5
- include AlbacoreModel
5
+ include AlbacoreTask
6
6
  include RunCommand
7
7
  include Configuration::SpecFlowReport
8
8
 
@@ -1,12 +1,10 @@
1
- require 'albacore/albacoremodel'
2
- require 'albacore/config/sqlcmdconfig'
1
+ require 'albacore/albacoretask'
3
2
 
4
3
  class SQLCmd
5
- include AlbacoreModel
4
+ include AlbacoreTask
6
5
  include RunCommand
7
- include Configuration::SQLCmd
8
6
 
9
- attr_accessor :server, :database, :username, :password
7
+ attr_accessor :server, :database, :username, :password, :trusted_connection, :batch_abort
10
8
  attr_array :scripts
11
9
  attr_hash :variables
12
10
 
@@ -14,19 +12,22 @@ class SQLCmd
14
12
  @require_valid_command = false
15
13
  @scripts=[]
16
14
  @variables={}
15
+ @trusted_connection = true
16
+ @batch_abort = true
17
17
  super()
18
- update_attributes sqlcmd.to_hash
18
+ update_attributes Albacore.configuration.sqlcmd.to_hash
19
19
  end
20
20
 
21
- def run
21
+ def execute
22
22
  return unless check_command
23
23
 
24
24
  cmd_params=[]
25
- cmd_params << build_parameter("S", @server) unless @server.nil?
25
+ serverParam = @server.nil? ? build_parameter("S", ".") : build_parameter("S", @server)
26
+ cmd_params << serverParam
26
27
  cmd_params << build_parameter("d", @database) unless @database.nil?
27
- cmd_params << build_parameter("U", @username) unless @username.nil?
28
- cmd_params << build_parameter("P", @password) unless @password.nil?
28
+ cmd_params << get_authentication_params
29
29
  cmd_params << build_variable_list if @variables.length > 0
30
+ cmd_params << get_batch_abort_param
30
31
  cmd_params << build_script_list if @scripts.length > 0
31
32
 
32
33
  result = run_command "SQLCmd", cmd_params.join(" ")
@@ -34,15 +35,36 @@ class SQLCmd
34
35
  failure_msg = 'SQLCmd Failed. See Build Log For Detail.'
35
36
  fail_with_message failure_msg if !result
36
37
  end
38
+
39
+ def get_batch_abort_param
40
+ "-b" if (@scripts.length > 1 && @batch_abort)
41
+ end
42
+
43
+ def get_authentication_params
44
+ integratedParam = "-E" if @trusted_connection
45
+ if ((!(@username.nil?)) and (!(@password.nil?)))
46
+ integratedParam = build_parameter("U", @username) + " " + build_parameter("P", @password)
47
+ end
48
+ integratedParam
49
+ end
37
50
 
38
51
  def check_command
52
+ sql2008cmdPath = File.join(ENV['SystemDrive'],'program files','microsoft sql server','100','tools','binn', 'sqlcmd.exe')
53
+ @command = sql2008cmdPath if File.exists?(sql2008cmdPath)
54
+ return true
55
+
56
+ sql2005cmdPath = File.join(ENV['SystemDrive'],'program files','microsoft sql server','90','tools','binn', 'sqlcmd.exe')
57
+ @command = sql2005cmdPath if File.exists?(sql2005cmdPath)
58
+ return true
59
+
39
60
  return true if (!@command.nil?)
61
+
40
62
  fail_with_message 'SQLCmd.command cannot be nil.'
41
63
  return false
42
64
  end
43
65
 
44
66
  def build_script_list
45
- @scripts.map{|s| "-i \"#{s}\""}.join(" ")
67
+ @scripts.map{|s| "-i \"#{s.strip}\""}.join(" ")
46
68
  end
47
69
 
48
70
  def build_parameter(param_name, param_value)
@@ -0,0 +1,30 @@
1
+ module Albacore
2
+ def self.create_task(taskname, taskclass)
3
+ # this style of creating tasks is not really what i
4
+ # want to do. but it's necessary for ruby 1.8.6
5
+ # because that version doesn't support the foo do |*args, &block|
6
+ # block signature. it supports *args, but not &block.
7
+ # so that limitation is worked around with string eval
8
+ Object.class_eval(<<-EOF, __FILE__, __LINE__)
9
+ def #{taskname}(name=:#{taskname}, *args, &configblock)
10
+ task name, *args do |t, task_args|
11
+ obj = #{taskclass}.new
12
+ obj.load_config_by_task_name(name) if obj.respond_to?(:load_config_by_task_name)
13
+
14
+ if !configblock.nil?
15
+ case configblock.arity
16
+ when 0
17
+ configblock.call
18
+ when 1
19
+ configblock.call(obj)
20
+ when 2
21
+ configblock.call(obj, task_args)
22
+ end
23
+ end
24
+
25
+ obj.execute if obj.respond_to?(:execute)
26
+ end
27
+ end
28
+ EOF
29
+ end
30
+ end
@@ -13,40 +13,31 @@ module RunCommand
13
13
  end
14
14
 
15
15
  def run_command(name="Command Line", parameters=nil)
16
- params = Array.new
17
- params << parameters unless parameters.nil?
18
- params << @parameters unless (@parameters.nil? || @parameters.length==0)
19
-
20
- cmd = get_command(params)
21
- @logger.debug "Executing #{name}: #{cmd}"
22
-
23
- set_working_directory
24
- result = system cmd
25
- reset_working_directory
26
-
27
- result
16
+ begin
17
+ params = Array.new
18
+ params << parameters unless parameters.nil?
19
+ params << @parameters unless (@parameters.nil? || @parameters.length==0)
20
+
21
+ cmd = get_command(params)
22
+ @logger.debug "Executing #{name}: #{cmd}"
23
+
24
+ Dir.chdir(@working_directory) do
25
+ return system(cmd)
26
+ end
27
+
28
+ rescue Exception => e
29
+ puts "Error While Running Command Line Tool: #{e}"
30
+ raise
31
+ end
28
32
  end
29
33
 
30
34
  def get_command(params)
31
- cmd = "\"#{@command}\""
35
+ executable = @command
36
+ unless command.nil?
37
+ executable = File.expand_path(@command) if File.exists?(@command)
38
+ end
39
+ cmd = "\"#{executable}\""
32
40
  cmd +=" #{params.join(' ')}" if params.length > 0
33
41
  cmd
34
42
  end
35
-
36
- def combine_parameters(params1, params2)
37
- combined = params1.collect
38
- combined = combined.push(params2) unless params2.nil?
39
- combined
40
- end
41
-
42
- def set_working_directory
43
- @original_directory = Dir.pwd
44
- return if @working_directory == @original_directory
45
- Dir.chdir(@working_directory)
46
- end
47
-
48
- def reset_working_directory
49
- return if Dir.pwd == @original_directory
50
- Dir.chdir(@original_directory)
51
- end
52
43
  end
@@ -0,0 +1,13 @@
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 +1,16 @@
1
- require 'albacore/albacoremodel'
1
+ require 'albacore/albacoretask'
2
2
  require 'zip/zip'
3
3
  require 'zip/zipfilesystem'
4
- require 'albacore/config/unzipconfig'
5
4
  include Zip
6
5
 
7
6
  class Unzip
8
- include AlbacoreModel
9
- include Configuration::Unzip
7
+ include AlbacoreTask
10
8
 
11
9
  attr_accessor :destination, :file
12
10
 
13
11
  def initialize
14
12
  super()
15
- update_attributes unzip.to_hash
13
+ update_attributes Albacore.configuration.unzip.to_hash
16
14
  end
17
15
 
18
16
  def execute()
@@ -1,10 +1,9 @@
1
- require 'albacore/albacoremodel'
2
- require 'albacore/config/xbuildconfig'
1
+ require 'albacore/albacoretask'
3
2
 
4
3
  class XBuild
5
- include AlbacoreModel
4
+ TaskName = [:xbuild, :mono]
5
+ include AlbacoreTask
6
6
  include RunCommand
7
- include Configuration::XBuild
8
7
 
9
8
  attr_accessor :solution, :verbosity
10
9
  attr_array :targets
@@ -13,10 +12,10 @@ class XBuild
13
12
  def initialize
14
13
  @command = 'xbuild'
15
14
  super()
16
- update_attributes xbuild.to_hash
15
+ update_attributes Albacore.configuration.xbuild.to_hash
17
16
  end
18
17
 
19
- def build
18
+ def execute
20
19
  build_solution(@solution)
21
20
  end
22
21
 
@@ -1,10 +1,9 @@
1
- require 'albacore/albacoremodel'
2
- require 'albacore/config/xunitconfig'
1
+ require 'albacore/albacoretask'
3
2
 
4
3
  class XUnitTestRunner
5
- include AlbacoreModel
4
+ TaskName = :xunit
5
+ include AlbacoreTask
6
6
  include RunCommand
7
- include Configuration::XUnit
8
7
 
9
8
  attr_accessor :html_output
10
9
  attr_array :options,:assembly,:assemblies
@@ -12,7 +11,7 @@ class XUnitTestRunner
12
11
  def initialize(command=nil)
13
12
  @options=[]
14
13
  super()
15
- update_attributes xunit.to_hash
14
+ update_attributes Albacore.configuration.xunit.to_hash
16
15
  @command = command unless command.nil?
17
16
  end
18
17
 
@@ -1,12 +1,11 @@
1
- require 'albacore/albacoremodel'
2
- require 'albacore/config/zipconfig'
1
+ require 'albacore/albacoretask'
3
2
  require 'zip/zip'
4
3
  require 'zip/zipfilesystem'
5
4
  include Zip
6
5
 
7
6
  class ZipDirectory
8
- include AlbacoreModel
9
- include Configuration::Zip
7
+ TaskName = :zip
8
+ include AlbacoreTask
10
9
 
11
10
  attr_accessor :output_path, :output_file
12
11
  attr_accessor :flatten_zip
@@ -16,10 +15,10 @@ class ZipDirectory
16
15
  @flatten_zip = true
17
16
  @exclusions = []
18
17
  super()
19
- update_attributes zip.to_hash
18
+ update_attributes Albacore.configuration.zip.to_hash
20
19
  end
21
20
 
22
- def package()
21
+ def execute()
23
22
  fail_with_message 'Output File cannot be empty' if @output_file.nil?
24
23
  return if @output_file.nil?
25
24
 
@@ -8,7 +8,7 @@ namespace :specs do
8
8
 
9
9
  @spec_opts = '--colour --format specdoc'
10
10
 
11
- desc "Run functional specs for Albacore"
11
+ desc "Run all specs for albacore"
12
12
  Spec::Rake::SpecTask.new :all do |t|
13
13
  t.spec_files = FileList['spec/**/*_spec.rb'].exclude{ |f|
14
14
  f if runtime_is_ironruby && (f.include?("ssh") || f.include?("sftp"))
@@ -16,12 +16,6 @@ namespace :specs do
16
16
  t.spec_opts << @spec_opts
17
17
  end
18
18
 
19
- desc "Run rake task specs for Albacore"
20
- Spec::Rake::SpecTask.new :tasks do |t|
21
- t.spec_files = FileList['spec/**/*task_spec.rb']
22
- t.spec_opts << @spec_opts
23
- end
24
-
25
19
  desc "CSharp compiler (csc.exe) specs"
26
20
  Spec::Rake::SpecTask.new :csc do |t|
27
21
  t.spec_files = FileList['spec/csc*_spec.rb']
@@ -235,7 +229,12 @@ namespace :jeweler do
235
229
  gs.homepage = "http://albacorebuild.net"
236
230
  gs.authors = ["Derick Bailey", "Ben Hall", "Steve Harman", "etc"]
237
231
  gs.has_rdoc = false
238
- gs.files.exclude("albacore.gemspec", ".gitignore", "spec/support/Tools")
232
+ gs.files.exclude(
233
+ "albacore.gemspec",
234
+ ".gitignore",
235
+ "spec/",
236
+ "pkg/"
237
+ )
239
238
 
240
239
  gs.add_dependency('rake', '>= 0.8.7')
241
240
  gs.add_dependency('rubyzip', '>= 0.9.4')
@@ -1,13 +1,18 @@
1
1
  require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
- require 'albacore/albacoremodel'
2
+ require 'albacore/albacoretask'
3
3
 
4
4
  class ModelTest
5
- include AlbacoreModel
5
+ include AlbacoreTask
6
6
  attr_accessor :foo, :bar
7
7
  attr_hash :a_hash
8
8
  attr_array :a_array
9
9
  end
10
10
 
11
+ class NamedTaskExample
12
+ TaskName = [:namedtask, :anothername]
13
+ include AlbacoreTask
14
+ end
15
+
11
16
  describe "when updating object attributes with a valid set of hash keys" do
12
17
  before :each do
13
18
  @model = ModelTest.new
@@ -33,3 +38,16 @@ describe "when updating an object attributes with an invalid hash key" do
33
38
  @log.should include("something is not a settable attribute on ModelTest")
34
39
  end
35
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
@@ -36,10 +36,6 @@ describe AssemblyInfo, "when generating an assembly info file in verbose mode" d
36
36
  it "should log the name of the output file" do
37
37
  @log_data.should include(@tester.assemblyinfo_file)
38
38
  end
39
-
40
- it "should log the supplied attribute information" do
41
- @log_data.should include("[assembly: AssemblyVersion(\"#{@tester.version}\")]")
42
- end
43
39
  end
44
40
 
45
41
  describe AssemblyInfo, "when generating an assembly info file without an output file specified" do
@@ -51,7 +47,7 @@ describe AssemblyInfo, "when generating an assembly info file without an output
51
47
  strio = StringIO.new
52
48
  asm.log_device = strio
53
49
 
54
- asm.write
50
+ asm.execute
55
51
 
56
52
  @log_data = strio.string
57
53
  end
@@ -92,7 +88,7 @@ describe AssemblyInfo, "when providing custom namespaces and specifying C#" do
92
88
  @filedata = @tester.build_and_read_assemblyinfo_file asm
93
89
  end
94
90
 
95
- it "should write the namespaces into the using statements" do
91
+ it "should.execute the namespaces into the using statements" do
96
92
  @filedata.scan('using My.Name.Space;').length.should == 1
97
93
  @filedata.scan('using Another.Namespace.GoesHere;').length.should == 1
98
94
  end
@@ -112,7 +108,7 @@ describe AssemblyInfo, "when providing custom namespaces and specifying VB.NET"
112
108
  @filedata = @tester.build_and_read_assemblyinfo_file asm
113
109
  end
114
110
 
115
- it "should write the namespaces into the imports statements" do
111
+ it "should.execute the namespaces into the imports statements" do
116
112
  @filedata.scan('Imports My.Name.Space').length.should == 1
117
113
  @filedata.scan('Imports Another.Namespace.GoesHere').length.should == 1
118
114
  end
@@ -130,7 +126,7 @@ describe AssemblyInfo, "when providing custom attributes without specifying a la
130
126
  @filedata = @tester.build_and_read_assemblyinfo_file asm
131
127
  end
132
128
 
133
- it "should write the custom attributes to the assembly info file" do
129
+ it "should.execute the custom attributes to the assembly info file" do
134
130
  @filedata.scan('[assembly: CustomAttribute("custom attribute data")]').length.should == 1
135
131
  @filedata.scan('[assembly: AnotherAttribute("more data here")]').length.should == 1
136
132
  end
@@ -150,7 +146,7 @@ describe AssemblyInfo, "when providing custom attributes and specifying C#" do
150
146
  @filedata = @tester.build_and_read_assemblyinfo_file asm
151
147
  end
152
148
 
153
- it "should write the custom attributes to the assembly info file" do
149
+ it "should.execute the custom attributes to the assembly info file" do
154
150
  @filedata.scan('[assembly: CustomAttribute("custom attribute data")]').length.should == 1
155
151
  @filedata.scan('[assembly: AnotherAttribute("more data here")]').length.should == 1
156
152
  end
@@ -170,7 +166,7 @@ describe AssemblyInfo, "when providing custom attributes and specifying VB.NET"
170
166
  @filedata = @tester.build_and_read_assemblyinfo_file asm
171
167
  end
172
168
 
173
- it "should write the custom attributes to the assembly info file" do
169
+ it "should.execute the custom attributes to the assembly info file" do
174
170
  @filedata.scan('<assembly: CustomAttribute("custom attribute data")>').length.should == 1
175
171
  @filedata.scan('<assembly: AnotherAttribute("more data here")>').length.should == 1
176
172
  end
@@ -188,7 +184,7 @@ describe AssemblyInfo, "when specifying a custom attribute with no data" do
188
184
  @filedata = @tester.build_and_read_assemblyinfo_file asm
189
185
  end
190
186
 
191
- it "should write the attribute with an empty argument list" do
187
+ it "should.execute the attribute with an empty argument list" do
192
188
  @filedata.scan('[assembly: NoArgsAttribute()]').length.should == 1
193
189
  end
194
190
  end
@@ -205,7 +201,7 @@ describe AssemblyInfo, "when specifying an attribute with non-string data" do
205
201
  @filedata = @tester.build_and_read_assemblyinfo_file asm
206
202
  end
207
203
 
208
- it "should write the attribute data without quotes" do
204
+ it "should.execute the attribute data without quotes" do
209
205
  @filedata.scan('[assembly: NonStringAttribute(true)]').length.should == 1
210
206
  end
211
207
  end
@@ -484,11 +480,28 @@ describe AssemblyInfo, "when assembly info configuration is provided" do
484
480
  asm.version = "bar"
485
481
  end
486
482
  end
487
- asm = AssemblyInfo.new
488
- asm
483
+ AssemblyInfo.new
489
484
  end
490
485
  it "should use the supplied info" do
491
486
  asm.company_name.should == "foo"
492
487
  asm.version.should == "bar"
493
488
  end
494
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