albacore 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. data/README.markdown +84 -81
  2. data/VERSION +1 -1
  3. data/install_dependencies.rb +10 -10
  4. data/lib/albacore.rb +10 -2
  5. data/lib/albacore/assemblyinfo.rb +100 -100
  6. data/lib/albacore/assemblyinfolanguages/csharpengine.rb +14 -0
  7. data/lib/albacore/assemblyinfolanguages/vbnetengine.rb +14 -0
  8. data/lib/albacore/docu.rb +39 -0
  9. data/lib/albacore/exec.rb +23 -0
  10. data/lib/albacore/expandtemplates.rb +73 -71
  11. data/lib/albacore/msbuild.rb +56 -61
  12. data/lib/albacore/mspectestrunner.rb +44 -42
  13. data/lib/albacore/nant.rb +39 -0
  14. data/lib/albacore/ncoverconsole.rb +68 -61
  15. data/lib/albacore/ncoverreport.rb +56 -55
  16. data/lib/albacore/ncoverreports/assemblyfilter.rb +7 -7
  17. data/lib/albacore/ncoverreports/branchcoverage.rb +7 -7
  18. data/lib/albacore/ncoverreports/classfilter.rb +5 -5
  19. data/lib/albacore/ncoverreports/codecoveragebase.rb +22 -22
  20. data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +19 -19
  21. data/lib/albacore/ncoverreports/documentfilter.rb +5 -5
  22. data/lib/albacore/ncoverreports/fullcoveragereport.rb +17 -17
  23. data/lib/albacore/ncoverreports/methodcoverage.rb +7 -7
  24. data/lib/albacore/ncoverreports/methodfilter.rb +5 -5
  25. data/lib/albacore/ncoverreports/namespacefilter.rb +5 -5
  26. data/lib/albacore/ncoverreports/reportfilterbase.rb +23 -23
  27. data/lib/albacore/ncoverreports/summaryreport.rb +18 -18
  28. data/lib/albacore/ncoverreports/symbolcoverage.rb +6 -7
  29. data/lib/albacore/ndepend.rb +35 -0
  30. data/lib/albacore/nunittestrunner.rb +36 -35
  31. data/lib/albacore/plink.rb +48 -0
  32. data/lib/albacore/sftp.rb +33 -31
  33. data/lib/albacore/sqlcmd.rb +54 -51
  34. data/lib/albacore/ssh.rb +35 -33
  35. data/lib/albacore/support/albacore_helper.rb +1 -4
  36. data/lib/albacore/support/attrmethods.rb +25 -0
  37. data/lib/albacore/support/failure.rb +17 -17
  38. data/lib/albacore/support/globalconfig.rb +6 -0
  39. data/lib/albacore/support/logging.rb +30 -28
  40. data/lib/albacore/support/runcommand.rb +41 -41
  41. data/lib/albacore/support/yamlconfig.rb +23 -27
  42. data/lib/albacore/unzip.rb +28 -0
  43. data/lib/albacore/xbuild.rb +54 -0
  44. data/lib/albacore/xunittestrunner.rb +40 -43
  45. data/lib/albacore/zipdirectory.rb +72 -63
  46. data/lib/rake/assemblyinfotask.rb +12 -11
  47. data/lib/rake/docutask.rb +17 -0
  48. data/lib/rake/exectask.rb +18 -0
  49. data/lib/rake/expandtemplatestask.rb +12 -11
  50. data/lib/rake/msbuildtask.rb +13 -12
  51. data/lib/rake/mspectask.rb +12 -11
  52. data/lib/rake/nanttask.rb +17 -0
  53. data/lib/rake/ncoverconsoletask.rb +12 -11
  54. data/lib/rake/ncoverreporttask.rb +12 -11
  55. data/lib/rake/ndependtask.rb +23 -0
  56. data/lib/rake/nunittask.rb +12 -11
  57. data/lib/rake/plinktask.rb +23 -0
  58. data/lib/rake/renametask.rb +15 -15
  59. data/lib/rake/sftptask.rb +11 -10
  60. data/lib/rake/sqlcmdtask.rb +13 -12
  61. data/lib/rake/sshtask.rb +11 -10
  62. data/lib/rake/support/albacoretask.rb +16 -15
  63. data/lib/rake/unziptask.rb +17 -0
  64. data/lib/rake/xbuildtask.rb +22 -0
  65. data/lib/rake/xunittask.rb +12 -11
  66. data/lib/rake/ziptask.rb +12 -11
  67. data/rakefile.rb +255 -204
  68. data/spec/assemblyinfo_spec.rb +426 -221
  69. data/spec/assemblyinfotask_spec.rb +21 -21
  70. data/spec/docu_spec.rb +70 -0
  71. data/spec/docutask_spec.rb +39 -0
  72. data/spec/exec_spec.rb +23 -0
  73. data/spec/exectask_spec.rb +31 -0
  74. data/spec/expandtemplates_spec.rb +149 -148
  75. data/spec/expandtemplatestask_spec.rb +21 -21
  76. data/spec/msbuild_spec.rb +150 -139
  77. data/spec/msbuildtask_spec.rb +21 -21
  78. data/spec/mspectask_spec.rb +21 -21
  79. data/spec/nant_spec.rb +101 -0
  80. data/spec/nanttask_spec.rb +31 -0
  81. data/spec/ncoverconsole_spec.rb +253 -221
  82. data/spec/ncoverconsoletask_spec.rb +21 -21
  83. data/spec/ncoverreport_spec.rb +538 -523
  84. data/spec/ncoverreporttask_spec.rb +21 -21
  85. data/spec/ndepend_spec.rb +49 -0
  86. data/spec/{commandtask_spec.rb → ndependtask_spec.rb} +10 -10
  87. data/spec/nunittask_spec.rb +21 -21
  88. data/spec/nunittestrunner_spec.rb +6 -6
  89. data/spec/patches/docu_patch.rb +13 -0
  90. data/spec/patches/system_patch.rb +18 -18
  91. data/spec/patches/tasklib_patch.rb +10 -10
  92. data/spec/plink_spec.rb +61 -0
  93. data/spec/plinktask_spec.rb +31 -0
  94. data/spec/renametask_spec.rb +21 -21
  95. data/spec/sftp_spec.rb +24 -24
  96. data/spec/sftptask_spec.rb +31 -31
  97. data/spec/sqlcmd_spec.rb +118 -120
  98. data/spec/sqlcmdtask_spec.rb +21 -21
  99. data/spec/ssh_spec.rb +36 -37
  100. data/spec/sshtask_spec.rb +29 -29
  101. data/spec/support/TestSolution/NDependProject.xml +315 -0
  102. data/spec/support/TestSolution/TestSolution.XUnitTests/Class1.cs +12 -12
  103. data/spec/support/TestSolution/TestSolution.XUnitTests/FailingTestFixture.cs +14 -0
  104. data/spec/support/TestSolution/TestSolution.XUnitTests/TestSolution.XUnitTests.csproj +1 -0
  105. data/spec/support/TestSolution/TestSolution.build +25 -0
  106. data/spec/support/assemblyinfotester.rb +40 -38
  107. data/spec/support/expandtemplatestestdata.rb +73 -73
  108. data/spec/support/msbuildtestdata.rb +28 -28
  109. data/spec/support/nanttestdata.rb +33 -0
  110. data/spec/support/ncoverconsoletestdata.rb +18 -0
  111. data/spec/support/ncoverreporttestdata.rb +24 -24
  112. data/spec/support/spec_helper.rb +2 -1
  113. data/spec/support/yamlconfig/msbuild.yml +3 -0
  114. data/spec/support/yamlconfig/yaml_autoconfig_test.yml +1 -0
  115. data/spec/support/ziptestdata.rb +11 -6
  116. data/spec/xunit_spec.rb +63 -0
  117. data/spec/xunittask_spec.rb +19 -19
  118. data/spec/yamlconfig_spec.rb +38 -52
  119. data/spec/zip_spec.rb +56 -11
  120. data/spec/ziptask_spec.rb +22 -22
  121. metadata +53 -8
  122. data/lib/albacore/command.rb +0 -23
  123. data/lib/rake/commandtask.rb +0 -16
  124. data/spec/command_spec.rb +0 -23
@@ -0,0 +1,39 @@
1
+ require 'albacore/support/albacore_helper'
2
+
3
+ class Docu
4
+ extend AttrMethods
5
+ include RunCommand
6
+ include YAMLConfig
7
+
8
+ attr_accessor :output_location
9
+ attr_array :assemblies, :xml_files
10
+
11
+ def initialize(path_to_command='docu.exe')
12
+ @path_to_command = path_to_command
13
+ @assemblies = []
14
+ @xml_files = []
15
+ @output_location = ""
16
+ super()
17
+ end
18
+
19
+ def execute
20
+ if @assemblies.empty?
21
+ fail_with_message 'Docu Failed. No assemblies specified'
22
+ return
23
+ end
24
+
25
+ command_params = get_command_parameters
26
+ success = run_command 'Docu', command_params.join(' ')
27
+
28
+ fail_with_message 'Docu Failed. See Build Log For Detail' unless success
29
+ end
30
+
31
+ private
32
+ def get_command_parameters
33
+ command_params = []
34
+ command_params << @assemblies.join(' ') unless @assemblies.nil?
35
+ command_params << @xml_files.join(' ') unless @xml_files.nil?
36
+ command_params << " --output=\"#{@output_location}\" " unless @output_location.empty?
37
+ command_params
38
+ end
39
+ end
@@ -0,0 +1,23 @@
1
+ require 'albacore/support/albacore_helper'
2
+
3
+ class Exec
4
+ extend AttrMethods
5
+ include RunCommand
6
+ include YAMLConfig
7
+ include Logging
8
+
9
+ attr_array :parameters
10
+
11
+ def initialize
12
+ @path_to_command=''
13
+ @parameters = []
14
+ super()
15
+ end
16
+
17
+ def execute
18
+ result = run_command "Exec", @parameters.join(" ")
19
+
20
+ failure_message = 'Exec Failed. See Build Log For Detail'
21
+ fail_with_message failure_message if !result
22
+ end
23
+ end
@@ -2,78 +2,80 @@ require 'albacore/support/albacore_helper'
2
2
  require 'yaml'
3
3
 
4
4
  class ExpandTemplates
5
- include YAMLConfig
6
- include Logging
7
-
8
- attr_accessor :expand_files, :data_file
9
-
10
- def initialize
11
- @expand_files = []
12
- super()
13
- end
14
-
15
- def expand
16
- return if @data_file.nil?
17
- return if @expand_files.empty?
18
-
19
- config = read_config(@data_file)
20
- @expand_files.each { |template_file, output_file|
21
- file_config = get_config_for_file config, template_file
22
- expand_template template_file, output_file, file_config
23
- }
24
- end
25
-
5
+ extend AttrMethods
6
+ include YAMLConfig
7
+ include Logging
8
+
9
+ attr_accessor :data_file
10
+ attr_hash :expand_files
11
+
12
+ def initialize
13
+ @expand_files = {}
14
+ super()
15
+ end
16
+
17
+ def expand
18
+ return if @data_file.nil?
19
+ return if @expand_files.empty?
20
+
21
+ config = read_config(@data_file)
22
+ @expand_files.each { |template_file, output_file|
23
+ file_config = get_config_for_file config, template_file
24
+ expand_template template_file, output_file, file_config
25
+ }
26
+ end
27
+
26
28
  private
27
29
 
28
- def expand_template(template_file, output_file, config)
29
- @logger.info "Parsing #{template_file} into #{output_file}"
30
-
31
- template_data = ''
32
- File.open(template_file, "r") {|f|
33
- template_data = f.read
34
- }
35
- template_data
30
+ def expand_template(template_file, output_file, config)
31
+ @logger.info "Parsing #{template_file} into #{output_file}"
32
+
33
+ template_data = ''
34
+ File.open(template_file, "r") {|f|
35
+ template_data = f.read
36
+ }
37
+ template_data
36
38
 
37
- template_data.gsub!(/\#\{(.*?)\}/) {|match|
38
- value = config[$1]
39
- @logger.debug "Found \"\#{#{$1}}\": Replacing with \"#{value}\"."
40
- value
41
- }
42
-
43
- File.open(output_file, "w") {|output|
44
- output.write(template_data)
45
- }
46
- end
47
-
48
- def read_config(file)
49
- config = YAML::load(File.open(file, "r"))
50
- if (config.include?("@include"))
51
- include_file = File.join(File.dirname(file), config["@include"])
52
- @logger.debug("Found @include directive. Loading additional data from #{include_file}")
53
- config.reject!{|k,v| k == "@include"}
54
- include_config = read_config(include_file)
55
- config = deep_merge(include_config, config)
56
- end
57
- return config
58
- end
59
-
60
- def deep_merge(first, second)
61
- # From: http://www.ruby-forum.com/topic/142809
62
- # Author: Stefan Rusterholz
63
- merger = proc { |key,v1,v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
64
- first.merge(second, &merger)
65
- end
66
-
67
- def get_config_for_file(original_config, file)
68
- filename = File.basename(file)
69
- file_config = original_config[filename]
70
- if file_config.nil?
71
- @logger.debug "No config data found for #{filename}. Using local data."
72
- new_config = original_config
73
- else
74
- @logger.debug "Found config data for #{filename}."
75
- new_config = original_config.merge(file_config)
76
- end
77
- new_config
78
- end
39
+ template_data.gsub!(/\#\{(.*?)\}/) {|match|
40
+ value = config[$1]
41
+ @logger.debug "Found \"\#{#{$1}}\": Replacing with \"#{value}\"."
42
+ value
43
+ }
44
+
45
+ File.open(output_file, "w") {|output|
46
+ output.write(template_data)
47
+ }
48
+ end
49
+
50
+ def read_config(file)
51
+ config = YAML::load(File.open(file, "r"))
52
+ if (config.include?("@include"))
53
+ include_file = File.join(File.dirname(file), config["@include"])
54
+ @logger.debug("Found @include directive. Loading additional data from #{include_file}")
55
+ config.reject!{|k,v| k == "@include"}
56
+ include_config = read_config(include_file)
57
+ config = deep_merge(include_config, config)
58
+ end
59
+ return config
60
+ end
61
+
62
+ def deep_merge(first, second)
63
+ # From: http://www.ruby-forum.com/topic/142809
64
+ # Author: Stefan Rusterholz
65
+ merger = proc { |key,v1,v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
66
+ first.merge(second, &merger)
67
+ end
68
+
69
+ def get_config_for_file(original_config, file)
70
+ filename = File.basename(file)
71
+ file_config = original_config[filename]
72
+ if file_config.nil?
73
+ @logger.debug "No config data found for #{filename}. Using local data."
74
+ new_config = original_config
75
+ else
76
+ @logger.debug "Found config data for #{filename}."
77
+ new_config = original_config.merge(file_config)
78
+ end
79
+ new_config
80
+ end
79
81
  end
@@ -1,66 +1,61 @@
1
1
  require 'albacore/support/albacore_helper'
2
2
 
3
3
  class MSBuild
4
- include RunCommand
5
- include YAMLConfig
6
- include Logging
7
-
8
- attr_accessor :solution, :verbosity
9
-
10
- def initialize
11
- @path_to_command = build_path_to_command
12
- super()
13
- end
14
-
15
- def build_path_to_command
16
- win_dir = ENV['windir'] || ENV['WINDIR']
17
- win_dir = 'C:/Windows' if win_dir.nil?
18
-
19
- File.join(win_dir.dup, 'Microsoft.NET', 'Framework', 'v3.5', 'MSBuild.exe')
20
- end
21
-
22
- def targets(targets)
23
- @targets=targets
24
- end
25
-
26
- def properties=(properties)
27
- @properties = properties
28
- end
29
-
30
- def build
31
- build_solution(@solution)
32
- end
33
-
34
- def build_solution(solution)
35
- check_solution solution
36
-
37
- command_parameters = []
38
- command_parameters << "\"#{solution}\""
39
- command_parameters << "\"/verbosity:#{@verbosity}\"" if @verbosity != nil
40
- command_parameters << build_properties if @properties != nil
41
- command_parameters << "\"/target:#{build_targets}\"" if @targets != nil
42
-
43
- result = run_command "MSBuild", command_parameters.join(" ")
44
-
45
- failure_message = 'MSBuild Failed. See Build Log For Detail'
46
- fail_with_message failure_message if !result
47
- end
48
-
49
- def check_solution(file)
50
- return if file
51
- msg = 'solution cannot be nil'
52
- fail_with_message msg
53
- end
54
-
55
- def build_targets
56
- @targets.join ";"
57
- end
4
+ extend AttrMethods
5
+ include RunCommand
6
+ include YAMLConfig
7
+ include Logging
8
+
9
+ attr_accessor :solution, :verbosity
10
+ attr_array :targets
11
+ attr_hash :properties
12
+
13
+ def initialize
14
+ @path_to_command = build_path_to_command
15
+ super()
16
+ end
17
+
18
+ def build_path_to_command
19
+ win_dir = ENV['windir'] || ENV['WINDIR']
20
+ win_dir = 'C:/Windows' if win_dir.nil?
21
+
22
+ File.join(win_dir.dup, 'Microsoft.NET', 'Framework', 'v3.5', 'MSBuild.exe')
23
+ end
24
+
25
+ def build
26
+ build_solution(@solution)
27
+ end
28
+
29
+ def build_solution(solution)
30
+ check_solution solution
31
+
32
+ command_parameters = []
33
+ command_parameters << "\"#{solution}\""
34
+ command_parameters << "\"/verbosity:#{@verbosity}\"" if @verbosity != nil
35
+ command_parameters << build_properties if @properties != nil
36
+ command_parameters << "\"/target:#{build_targets}\"" if @targets != nil
37
+
38
+ result = run_command "MSBuild", command_parameters.join(" ")
39
+
40
+ failure_message = 'MSBuild Failed. See Build Log For Detail'
41
+ fail_with_message failure_message if !result
42
+ end
43
+
44
+ def check_solution(file)
45
+ return if file
46
+ msg = 'solution cannot be nil'
47
+ fail_with_message msg
48
+ end
49
+
50
+ def build_targets
51
+ @targets.join ";"
52
+ end
58
53
 
59
- def build_properties
60
- option_text = []
61
- @properties.each do |key, value|
62
- option_text << "/p:#{key}\=\"#{value}\""
63
- end
64
- option_text.join(" ")
65
- end
54
+ def build_properties
55
+ option_text = []
56
+ @properties.each do |key, value|
57
+ option_text << "/p:#{key}\=\"#{value}\""
58
+ end
59
+ option_text.join(" ")
60
+ end
66
61
  end
@@ -1,47 +1,49 @@
1
1
  require 'albacore/support/albacore_helper'
2
2
 
3
3
  class MSpecTestRunner
4
- include RunCommand
5
- include YAMLConfig
6
-
7
- attr_accessor :assemblies, :path_to_command, :html_output, :options
8
-
9
- def initialize(path_to_command='')
10
- @path_to_command = path_to_command
11
- @assemblies=[]
12
- super()
13
- end
14
-
15
- def get_command_line
16
- command = []
17
- command << @path_to_command
18
- command << get_command_parameters
19
- cmd = command.join(" ")
20
- @logger.debug "Build MSpec Test Runner Command Line: " + cmd
4
+ extend AttrMethods
5
+ include RunCommand
6
+ include YAMLConfig
7
+
8
+ attr_accessor :html_output
9
+ attr_array :assemblies, :options
10
+
11
+ def initialize(path_to_command='')
12
+ @path_to_command = path_to_command
13
+ @assemblies=[]
14
+ super()
15
+ end
16
+
17
+ def get_command_line
18
+ command = []
19
+ command << @path_to_command
20
+ command << get_command_parameters
21
+ cmd = command.join(" ")
22
+ @logger.debug "Build MSpec Test Runner Command Line: " + cmd
21
23
  return cmd
22
- end
23
-
24
- def get_command_parameters
25
- command_params = []
26
- command_params << build_assembly_list unless @assemblies.empty?
27
- command_params << @options.join(" ") unless @options.nil?
28
- command_params << build_html_output unless @html_output.nil?
29
- command_params
30
- end
31
-
32
- def execute()
33
- command_params = get_command_parameters
34
- result = run_command "MSpec", command_params.join(" ")
35
-
36
- failure_message = 'MSpec Failed. See Build Log For Detail'
37
- fail_with_message failure_message if !result
38
- end
39
-
40
- def build_assembly_list
41
- @assemblies.map{|asm| "\"#{asm}\""}.join(" ")
42
- end
43
-
44
- def build_html_output
45
- "--html #{@html_output}"
46
- end
24
+ end
25
+
26
+ def get_command_parameters
27
+ command_params = []
28
+ command_params << build_assembly_list unless @assemblies.empty?
29
+ command_params << @options.join(" ") unless @options.nil?
30
+ command_params << build_html_output unless @html_output.nil?
31
+ command_params
32
+ end
33
+
34
+ def execute()
35
+ command_params = get_command_parameters
36
+ result = run_command "MSpec", command_params.join(" ")
37
+
38
+ failure_message = 'MSpec Failed. See Build Log For Detail'
39
+ fail_with_message failure_message if !result
40
+ end
41
+
42
+ def build_assembly_list
43
+ @assemblies.map{|asm| "\"#{asm}\""}.join(" ")
44
+ end
45
+
46
+ def build_html_output
47
+ "--html #{@html_output}"
48
+ end
47
49
  end
@@ -0,0 +1,39 @@
1
+ require 'albacore/support/albacore_helper'
2
+
3
+ class NAnt
4
+ extend AttrMethods
5
+ include RunCommand
6
+ include YAMLConfig
7
+ include Logging
8
+
9
+ attr_accessor :build_file
10
+ attr_array :targets
11
+ attr_hash :properties
12
+
13
+ def initialize
14
+ super()
15
+ end
16
+
17
+ def run
18
+ command_parameters = []
19
+ command_parameters << "-buildfile:#{@build_file}" unless @build_file.nil?
20
+ command_parameters << "#{build_properties}" unless @properties.nil?
21
+ command_parameters << "#{build_targets}" unless @targets.nil?
22
+
23
+ result = run_command "NAnt", command_parameters.join(" ")
24
+
25
+ failure_msg = 'NAnt task Failed. See Build Log For Detail.'
26
+ fail_with_message failure_msg if !result
27
+ end
28
+
29
+ private
30
+
31
+ def build_targets
32
+ @targets.join " "
33
+ end
34
+
35
+ def build_properties
36
+ @properties.map {|key, value| "-D:#{key}=#{value}" }.join(" ")
37
+ end
38
+
39
+ end