albacore 0.1.5 → 0.2.0.preview1

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 (136) hide show
  1. data/.autotest +4 -0
  2. data/README.markdown +1 -1
  3. data/VERSION +1 -1
  4. data/install_dependencies.rb +2 -3
  5. data/lib/albacore.rb +1 -0
  6. data/lib/albacore/albacoremodel.rb +28 -0
  7. data/lib/albacore/assemblyinfo.rb +5 -4
  8. data/lib/albacore/config/assemblyinfoconfig.rb +21 -0
  9. data/lib/albacore/config/config.rb +14 -0
  10. data/lib/albacore/config/cscconfig.rb +33 -0
  11. data/lib/albacore/config/docuconfig.rb +25 -0
  12. data/lib/albacore/config/execconfig.rb +22 -0
  13. data/lib/albacore/config/msbuildconfig.rb +32 -0
  14. data/lib/albacore/config/mspecconfig.rb +21 -0
  15. data/lib/albacore/config/nantconfig.rb +22 -0
  16. data/lib/albacore/config/ncoverconsoleconfig.rb +22 -0
  17. data/lib/albacore/config/ncoverreportconfig.rb +22 -0
  18. data/lib/albacore/config/ndependconfig.rb +22 -0
  19. data/lib/albacore/config/netversion.rb +23 -0
  20. data/lib/albacore/config/nunitconfig.rb +20 -0
  21. data/lib/albacore/config/specflowreportconfig.rb +27 -0
  22. data/lib/albacore/config/sqlcmdconfig.rb +22 -0
  23. data/lib/albacore/config/unzipconfig.rb +22 -0
  24. data/lib/albacore/config/xbuildconfig.rb +22 -0
  25. data/lib/albacore/config/xunitconfig.rb +22 -0
  26. data/lib/albacore/config/zipconfig.rb +22 -0
  27. data/lib/albacore/csc.rb +31 -0
  28. data/lib/albacore/docu.rb +8 -6
  29. data/lib/albacore/exec.rb +9 -3
  30. data/lib/albacore/msbuild.rb +5 -12
  31. data/lib/albacore/mspectestrunner.rb +9 -7
  32. data/lib/albacore/nant.rb +5 -4
  33. data/lib/albacore/ncoverconsole.rb +6 -9
  34. data/lib/albacore/ncoverreport.rb +8 -6
  35. data/lib/albacore/ncoverreports/codecoveragebase.rb +4 -4
  36. data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +4 -4
  37. data/lib/albacore/ncoverreports/fullcoveragereport.rb +3 -3
  38. data/lib/albacore/ncoverreports/reportfilterbase.rb +4 -4
  39. data/lib/albacore/ncoverreports/summaryreport.rb +3 -3
  40. data/lib/albacore/ndepend.rb +12 -9
  41. data/lib/albacore/nunittestrunner.rb +9 -7
  42. data/lib/albacore/specflowreport.rb +62 -0
  43. data/lib/albacore/sqlcmd.rb +8 -6
  44. data/lib/albacore/support/attrmethods.rb +7 -8
  45. data/lib/albacore/support/logging.rb +8 -4
  46. data/lib/albacore/support/openstruct.rb +13 -0
  47. data/lib/albacore/support/runcommand.rb +24 -24
  48. data/lib/albacore/support/supportlinux.rb +23 -0
  49. data/lib/albacore/support/yamlconfig.rb +2 -10
  50. data/lib/albacore/unzip.rb +14 -12
  51. data/lib/albacore/xbuild.rb +6 -5
  52. data/lib/albacore/xunittestrunner.rb +8 -6
  53. data/lib/albacore/zipdirectory.rb +27 -6
  54. data/lib/rake/csctask.rb +3 -0
  55. data/lib/rake/specflowreporttask.rb +3 -0
  56. data/lib/rake/unziptask.rb +1 -1
  57. data/rakefile.rb +21 -54
  58. data/spec/albacoremodel_spec.rb +35 -0
  59. data/spec/assemblyinfo_spec.rb +17 -0
  60. data/spec/attrmethods_spec.rb +17 -1
  61. data/spec/config_spec.rb +19 -0
  62. data/spec/createtask_spec.rb +45 -4
  63. data/spec/csc_spec.rb +87 -0
  64. data/spec/csctask_spec.rb +1 -0
  65. data/spec/docu_spec.rb +43 -1
  66. data/spec/exec_spec.rb +16 -1
  67. data/spec/msbuild_spec.rb +30 -18
  68. data/spec/mspec_spec.rb +28 -0
  69. data/spec/nant_spec.rb +20 -12
  70. data/spec/ncoverconsole_spec.rb +25 -13
  71. data/spec/ncoverreport_spec.rb +31 -18
  72. data/spec/ndepend_spec.rb +23 -2
  73. data/spec/nunittestrunner_spec.rb +48 -0
  74. data/spec/runcommand_spec.rb +59 -32
  75. data/spec/specflowreport_spec.rb +146 -0
  76. data/spec/specflowreporttask_spec.rb +48 -0
  77. data/spec/sqlcmd_spec.rb +18 -5
  78. data/spec/support/SpecFlow/TechTalk.SpecFlow.dll +0 -0
  79. data/spec/support/SpecFlow/TestSolution.SpecFlow.dll +0 -0
  80. data/spec/support/SpecFlow/TestSolution.SpecFlow.pdb +0 -0
  81. data/spec/support/SpecFlow/TestSolution.dll +0 -0
  82. data/spec/support/SpecFlow/TestSolution.pdb +0 -0
  83. data/spec/support/SpecFlow/nunit.framework.dll +0 -0
  84. data/spec/support/TestSolution/TestSolution.5.0.ReSharper.user +27 -0
  85. data/spec/support/TestSolution/TestSolution.SpecFlow/OneFeature.feature +8 -0
  86. data/spec/support/TestSolution/TestSolution.SpecFlow/OneFeature.feature.cs +73 -0
  87. data/spec/support/TestSolution/TestSolution.SpecFlow/Properties/AssemblyInfo.cs +36 -0
  88. data/spec/support/TestSolution/TestSolution.SpecFlow/StepDefinition.cs +30 -0
  89. data/spec/support/TestSolution/TestSolution.SpecFlow/TestSolution.SpecFlow.csproj +84 -0
  90. data/spec/support/TestSolution/TestSolution.sln +6 -0
  91. data/spec/support/csc/File1.cs +9 -0
  92. data/spec/support/csc/File2.cs +9 -0
  93. data/spec/support/csc/output/ignorethis.txt +1 -0
  94. data/spec/support/msbuildtestdata.rb +3 -3
  95. data/spec/support/ncoverreporttestdata.rb +2 -2
  96. data/spec/support/spec_helper.rb +2 -1
  97. data/spec/support/yamlconfig/yaml_autoconfig_test.yml +1 -1
  98. data/spec/unzip_spec.rb +15 -0
  99. data/spec/xbuild_spec.rb +15 -0
  100. data/spec/xunit_spec.rb +16 -2
  101. data/spec/yamlconfig_spec.rb +7 -6
  102. data/spec/zip_spec.rb +50 -9
  103. data/watchrtesting.rb +8 -0
  104. metadata +99 -91
  105. data/lib/albacore/expandtemplates.rb +0 -81
  106. data/lib/albacore/plink.rb +0 -49
  107. data/lib/albacore/renamer.rb +0 -17
  108. data/lib/albacore/sftp.rb +0 -42
  109. data/lib/albacore/ssh.rb +0 -44
  110. data/lib/albacore/support/albacore_helper.rb +0 -1
  111. data/lib/albacore/support/globalconfig.rb +0 -6
  112. data/lib/rake/expandtemplatestask.rb +0 -3
  113. data/lib/rake/plinktask.rb +0 -3
  114. data/lib/rake/renametask.rb +0 -3
  115. data/lib/rake/sftptask.rb +0 -3
  116. data/lib/rake/sshtask.rb +0 -3
  117. data/spec/expandtemplates_spec.rb +0 -180
  118. data/spec/expandtemplatestask_spec.rb +0 -46
  119. data/spec/plink_spec.rb +0 -62
  120. data/spec/plinktask_spec.rb +0 -46
  121. data/spec/renametask_spec.rb +0 -32
  122. data/spec/sftp_spec.rb +0 -30
  123. data/spec/sftptask_spec.rb +0 -42
  124. data/spec/ssh_spec.rb +0 -47
  125. data/spec/sshtask_spec.rb +0 -40
  126. data/spec/support/expandtemplates/datafiles/multiplevalues.yml +0 -3
  127. data/spec/support/expandtemplates/datafiles/multitemplate-specificfile.yml +0 -11
  128. data/spec/support/expandtemplates/datafiles/multitemplate.yml +0 -4
  129. data/spec/support/expandtemplates/datafiles/sample.yml +0 -1
  130. data/spec/support/expandtemplates/datafiles/sample_with_include.yml +0 -2
  131. data/spec/support/expandtemplates/datafiles/template_specific_data_file_with_include.yml +0 -5
  132. data/spec/support/expandtemplates/datafiles/template_specific_include.yml +0 -3
  133. data/spec/support/expandtemplates/templates/multipleinstance.config +0 -4
  134. data/spec/support/expandtemplates/templates/multiplevalues.config +0 -1
  135. data/spec/support/expandtemplates/templates/sample.config +0 -1
  136. data/spec/support/expandtemplatestestdata.rb +0 -77
@@ -1,8 +1,8 @@
1
- require 'albacore/support/albacore_helper'
1
+ require 'albacore/albacoremodel'
2
2
 
3
3
  module NCover
4
4
  class SummaryReport
5
- include YAMLConfig
5
+ include AlbacoreModel
6
6
 
7
7
  attr_accessor :output_path
8
8
 
@@ -19,4 +19,4 @@ module NCover
19
19
  :Html
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -1,18 +1,21 @@
1
- require "albacore/support/albacore_helper"
1
+ require 'albacore/albacoremodel'
2
+ require 'albacore/config/ndependconfig'
3
+
2
4
  class NDepend
3
- extend AttrMethods
5
+ include AlbacoreModel
4
6
  include RunCommand
5
- include Logging
6
- include YAMLConfig
7
+ include Configuration::NDepend
8
+
9
+ attr_accessor :project_file
7
10
 
8
- attr_accessor :path_to_command, :project_file
9
11
  def initialize()
10
12
  super()
13
+ update_attributes ndepend.to_hash
11
14
  end
12
15
 
13
16
  def run
14
- return unless check_comand
15
- result = run_command @path_to_command, create_parameters.join(" ")
17
+ return unless check_command
18
+ result = run_command @command, create_parameters.join(" ")
16
19
  failure_message = 'Command Failed. See Build Log For Detail'
17
20
  fail_with_message failure_message if !result
18
21
  end
@@ -23,10 +26,10 @@ class NDepend
23
26
  return params
24
27
  end
25
28
 
26
- def check_comand
29
+ def check_command
27
30
  return true if @project_file
28
31
  fail_with_message 'A ndepend project file is required'
29
32
  return false
30
33
  end
31
34
 
32
- end
35
+ end
@@ -1,22 +1,24 @@
1
- require 'albacore/support/albacore_helper'
1
+ require 'albacore/albacoremodel'
2
+ require 'albacore/config/nunitconfig'
2
3
 
3
4
  class NUnitTestRunner
4
- extend AttrMethods
5
+ include AlbacoreModel
5
6
  include RunCommand
6
- include YAMLConfig
7
+ include Configuration::NUnit
7
8
 
8
9
  attr_array :assemblies, :options
9
10
 
10
- def initialize(path_to_command='')
11
- @path_to_command = path_to_command
11
+ def initialize(command=nil)
12
12
  @options=[]
13
13
  @assemblies=[]
14
14
  super()
15
+ update_attributes nunit.to_hash
16
+ @command = command unless command.nil?
15
17
  end
16
18
 
17
19
  def get_command_line
18
20
  command_params = []
19
- command_params << @path_to_command
21
+ command_params << @command
20
22
  command_params << get_command_parameters
21
23
  commandline = command_params.join(" ")
22
24
  @logger.debug "Build NUnit Test Runner Command Line: " + commandline
@@ -37,4 +39,4 @@ class NUnitTestRunner
37
39
  failure_message = 'NUnit Failed. See Build Log For Detail'
38
40
  fail_with_message failure_message if !result
39
41
  end
40
- end
42
+ end
@@ -0,0 +1,62 @@
1
+ require 'albacore/albacoremodel'
2
+ require 'albacore/config/specflowreportconfig'
3
+
4
+ class SpecFlowReport
5
+ include AlbacoreModel
6
+ include RunCommand
7
+ include Configuration::SpecFlowReport
8
+
9
+ attr_array :projects, :options, :report
10
+
11
+ def initialize(command=nil, report=nil)
12
+ @options=[]
13
+ @projects =[]
14
+ super()
15
+ update_attributes specflowreport.to_hash
16
+ @command = command unless command.nil?
17
+ @report = report unless command.nil?
18
+ end
19
+
20
+ def get_command_line
21
+ command_params = []
22
+ command_params << @command
23
+ command_params << get_command_parameters
24
+ commandline = command_params.join(" ")
25
+ @logger.debug "Build SpecFlow Command Line: " + commandline
26
+ commandline
27
+ end
28
+
29
+ def get_projects
30
+ if @projects.empty? then
31
+ failure_message = "SpecFlow Expects at list one project file"
32
+ @logger.debug failure_message
33
+ fail_with_message failure_message
34
+ else
35
+ @projects.map{|asm| "\"#{asm}\""}.join(' ')
36
+ end
37
+ end
38
+
39
+ def get_options
40
+ if @options.empty? then
41
+ "/xmlTestResult:TestResult.xml /out:specs.html"
42
+ else
43
+ @options.join(" ")
44
+ end
45
+ end
46
+
47
+ def get_command_parameters
48
+ command_params = []
49
+ command_params << @report
50
+ command_params << get_projects
51
+ command_params << get_options
52
+ command_params
53
+ end
54
+
55
+ def execute()
56
+ command_params = get_command_parameters
57
+ result = run_command "specflow.exe", command_params.join(" ")
58
+
59
+ failure_message = 'SpecFlow Failed. See Build Log For Detail. ' + command_params.join(" ")
60
+ fail_with_message failure_message if !result
61
+ end
62
+ end
@@ -1,9 +1,10 @@
1
- require 'albacore/support/albacore_helper'
1
+ require 'albacore/albacoremodel'
2
+ require 'albacore/config/sqlcmdconfig'
2
3
 
3
4
  class SQLCmd
4
- extend AttrMethods
5
+ include AlbacoreModel
5
6
  include RunCommand
6
- include YAMLConfig
7
+ include Configuration::SQLCmd
7
8
 
8
9
  attr_accessor :server, :database, :username, :password
9
10
  attr_array :scripts
@@ -14,6 +15,7 @@ class SQLCmd
14
15
  @scripts=[]
15
16
  @variables={}
16
17
  super()
18
+ update_attributes sqlcmd.to_hash
17
19
  end
18
20
 
19
21
  def run
@@ -34,8 +36,8 @@ class SQLCmd
34
36
  end
35
37
 
36
38
  def check_command
37
- return true if (!@path_to_command.nil?)
38
- fail_with_message 'SQLCmd.path_to_command cannot be nil.'
39
+ return true if (!@command.nil?)
40
+ fail_with_message 'SQLCmd.command cannot be nil.'
39
41
  return false
40
42
  end
41
43
 
@@ -55,4 +57,4 @@ class SQLCmd
55
57
  vars.join(" ")
56
58
  end
57
59
 
58
- end
60
+ end
@@ -1,31 +1,30 @@
1
1
  module AttrMethods
2
-
3
2
  def attr_array(*names)
4
3
  names.each do |n|
5
4
  self.send :define_method, n do |*value|
6
5
  if value.nil? || value.empty?
7
- return instance_variable_get "@#{n}"
6
+ return instance_variable_get("@#{n}")
8
7
  else
9
- instance_variable_set "@#{n}", value
8
+ self.send "#{n}=".to_sym, value.to_ary.flatten
10
9
  end
11
10
  end
12
11
  self.send :define_method, "#{n}=" do |value|
13
- instance_variable_set "@#{n}", value
12
+ instance_variable_set("@#{n}", value)
14
13
  end
15
14
  end
16
15
  end
17
16
 
18
17
  def attr_hash(*names)
19
- names.each do |n|
18
+ names.each do |n|
20
19
  self.send :define_method, n do |*value|
21
20
  if value.nil? || value.empty?
22
- instance_variable_get "@#{n}"
21
+ instance_variable_get("@#{n}")
23
22
  else
24
- instance_variable_set "@#{n}", value[0]
23
+ instance_variable_set("@#{n}", value[0])
25
24
  end
26
25
  end
27
26
  self.send :define_method, "#{n}=" do |value|
28
- instance_variable_set "@#{n}", value
27
+ instance_variable_set("@#{n}", value)
29
28
  end
30
29
  end
31
30
  end
@@ -1,7 +1,6 @@
1
1
  require 'logger'
2
2
 
3
3
  module Logging
4
-
5
4
  attr_accessor :logger, :current_log_device
6
5
 
7
6
  def initialize
@@ -15,6 +14,7 @@ module Logging
15
14
  end
16
15
 
17
16
  def log_level=(level)
17
+ @log_level = level
18
18
  if (level == :verbose)
19
19
  loglevel = Logger::DEBUG
20
20
  else
@@ -22,13 +22,17 @@ module Logging
22
22
  end
23
23
  create_logger(@current_log_device, loglevel)
24
24
  end
25
+
26
+ def log_level
27
+ @log_level
28
+ end
25
29
 
26
30
  def create_logger(device, level)
27
31
  @current_log_device = device
28
32
  @logger = Logger.new(device)
29
33
 
30
- level = Logger::DEBUG if Albacore::log_level == :verbose
34
+ level = Logger::DEBUG if Albacore.configure.log_level == :verbose
31
35
  @logger.level = level
36
+ @log_level = :verbose if level == Logger::DEBUG
32
37
  end
33
-
34
- end
38
+ end
@@ -0,0 +1,13 @@
1
+ module OpenStructToHash
2
+ def to_hash
3
+ # from: http://snippets.dzone.com/posts/show/7312
4
+ h = @table
5
+ # handles nested structures
6
+ h.each do |k,v|
7
+ if v.class == OpenStruct
8
+ h[k] = v._to_hash
9
+ end
10
+ end
11
+ return h
12
+ end
13
+ end
@@ -1,48 +1,48 @@
1
- require 'albacore/support/failure'
2
- require 'albacore/support/attrmethods.rb'
1
+ require 'albacore/support/attrmethods'
3
2
 
4
3
  module RunCommand
5
4
  extend AttrMethods
6
- include Failure
7
5
 
8
- attr_accessor :path_to_command, :require_valid_command, :command_directory
6
+ attr_accessor :command, :working_directory
9
7
  attr_array :parameters
10
8
 
11
9
  def initialize
12
- @require_valid_command = true
13
- @command_directory = Dir.pwd
10
+ @working_directory = Dir.pwd
14
11
  @parameters = []
15
12
  super()
16
13
  end
17
14
 
18
- def run_command(command_name="Command Line", command_parameters=nil)
19
- if @require_valid_command
20
- return false unless valid_command_exists
21
- end
22
-
23
- combine_parameters = Array.new(@parameters)
24
- combine_parameters << command_parameters unless command_parameters.nil?
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)
25
19
 
26
- command = "\"#{@path_to_command}\" #{combine_parameters.join(' ')}"
27
- @logger.debug "Executing #{command_name}: #{command}"
20
+ cmd = get_command(params)
21
+ @logger.debug "Executing #{name}: #{cmd}"
28
22
 
29
- set_working_directory
30
- result = system command
23
+ set_working_directory
24
+ result = system cmd
31
25
  reset_working_directory
32
26
 
33
27
  result
34
28
  end
35
-
36
- def valid_command_exists
37
- return true if File.exist?(@path_to_command || "")
38
- msg = "Command not found: #{@path_to_command}"
39
- @logger.fatal msg
29
+
30
+ def get_command(params)
31
+ cmd = "\"#{@command}\""
32
+ cmd +=" #{params.join(' ')}" if params.length > 0
33
+ cmd
34
+ end
35
+
36
+ def combine_parameters(params1, params2)
37
+ combined = params1.collect
38
+ combined = combined.push(params2) unless params2.nil?
39
+ combined
40
40
  end
41
41
 
42
42
  def set_working_directory
43
43
  @original_directory = Dir.pwd
44
- return if @command_directory == @original_directory
45
- Dir.chdir(@command_directory)
44
+ return if @working_directory == @original_directory
45
+ Dir.chdir(@working_directory)
46
46
  end
47
47
 
48
48
  def reset_working_directory
@@ -0,0 +1,23 @@
1
+ module SupportsLinuxEnvironment
2
+ attr_accessor :is_linux
3
+
4
+ def initialize
5
+ @is_linux = RUBY_PLATFORM.include? 'linux'
6
+ super()
7
+ end
8
+
9
+ def format_reference(reference)
10
+ "\"/reference:#{to_OS_format(reference)}\""
11
+ end
12
+
13
+ def format_path(path)
14
+ "\"#{to_OS_format(path)}\""
15
+ end
16
+
17
+ def to_OS_format(input)
18
+ formatted_input = @is_linux ? input : input.gsub("/", "\\")
19
+ formatted_input
20
+ end
21
+ end
22
+
23
+
@@ -7,20 +7,12 @@ module YAMLConfig
7
7
 
8
8
  def load_config_by_task_name(task_name)
9
9
  task_config = "#{task_name}.yml"
10
- task_config = File.join(Albacore::yaml_config_folder, task_config) unless Albacore::yaml_config_folder.nil?
10
+ task_config = File.join(Albacore.configure.yaml_config_folder, task_config) unless Albacore.configure.yaml_config_folder.nil?
11
11
  configure(task_config) if File.exists?(task_config)
12
12
  end
13
13
 
14
14
  def configure(yml_file)
15
15
  config = YAML::load(File.open(yml_file))
16
- parse_config config
16
+ update_attributes config
17
17
  end
18
-
19
- def parse_config(config)
20
- config.each do |key, value|
21
- setter = "#{key}="
22
- self.class.send(:attr_accessor, key) if !respond_to?(setter)
23
- send setter, value
24
- end
25
- end
26
18
  end
@@ -1,28 +1,30 @@
1
- require 'albacore/support/albacore_helper'
1
+ require 'albacore/albacoremodel'
2
2
  require 'zip/zip'
3
3
  require 'zip/zipfilesystem'
4
+ require 'albacore/config/unzipconfig'
4
5
  include Zip
5
6
 
6
7
  class Unzip
7
- include YAMLConfig
8
- include Failure
8
+ include AlbacoreModel
9
+ include Configuration::Unzip
9
10
 
10
- attr_accessor :unzip_path, :zip_file
11
+ attr_accessor :destination, :file
11
12
 
12
13
  def initialize
13
14
  super()
15
+ update_attributes unzip.to_hash
14
16
  end
15
17
 
16
- def unzip()
17
- fail_with_message 'Zip File cannot be empty' if @zip_file.nil?
18
- return if @zip_file.nil?
18
+ def execute()
19
+ fail_with_message 'Zip File cannot be empty' if @file.nil?
20
+ return if @file.nil?
19
21
 
20
- Zip::ZipFile.open(@zip_file) do |zip_file|
21
- zip_file.each do |file|
22
- out_path = File.join(@unzip_path, file.name)
22
+ Zip::ZipFile.open(@file) do |zip_f|
23
+ zip_f.each do |f|
24
+ out_path = File.join(@destination, f.name)
23
25
  FileUtils.mkdir_p(File.dirname(out_path))
24
- zip_file.extract(file, out_path) unless File.exist?(out_path)
26
+ zip_f.extract(f, out_path) unless File.exist?(out_path)
25
27
  end
26
28
  end
27
29
  end
28
- end
30
+ end