albacore 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/EULA.txt +19 -0
- data/README.markdown +70 -0
- data/VERSION +1 -0
- data/lib/albacore.rb +9 -0
- data/lib/albacore/assemblyinfo.rb +104 -0
- data/lib/albacore/expandtemplates.rb +64 -0
- data/lib/albacore/msbuild.rb +63 -0
- data/lib/albacore/mspectestrunner.rb +33 -0
- data/lib/albacore/ncoverconsole.rb +64 -0
- data/lib/albacore/ncoverreport.rb +61 -0
- data/lib/albacore/ncoverreports/assemblyfilter.rb +10 -0
- data/lib/albacore/ncoverreports/branchcoverage.rb +10 -0
- data/lib/albacore/ncoverreports/classfilter.rb +9 -0
- data/lib/albacore/ncoverreports/codecoveragebase.rb +25 -0
- data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +23 -0
- data/lib/albacore/ncoverreports/documentfilter.rb +9 -0
- data/lib/albacore/ncoverreports/fullcoveragereport.rb +21 -0
- data/lib/albacore/ncoverreports/methodcoverage.rb +10 -0
- data/lib/albacore/ncoverreports/methodfilter.rb +9 -0
- data/lib/albacore/ncoverreports/namespacefilter.rb +9 -0
- data/lib/albacore/ncoverreports/reportfilterbase.rb +26 -0
- data/lib/albacore/ncoverreports/summaryreport.rb +22 -0
- data/lib/albacore/ncoverreports/symbolcoverage.rb +10 -0
- data/lib/albacore/nunittestrunner.rb +38 -0
- data/lib/albacore/sftp.rb +24 -0
- data/lib/albacore/sqlcmd.rb +55 -0
- data/lib/albacore/ssh.rb +25 -0
- data/lib/albacore/support/albacore_helper.rb +4 -0
- data/lib/albacore/support/failure.rb +22 -0
- data/lib/albacore/support/logging.rb +32 -0
- data/lib/albacore/support/runcommand.rb +45 -0
- data/lib/albacore/support/yamlconfig.rb +30 -0
- data/lib/albacore/zipdirectory.rb +55 -0
- data/lib/rake/assemblyinfotask.rb +22 -0
- data/lib/rake/expandtemplatestask.rb +21 -0
- data/lib/rake/msbuildtask.rb +22 -0
- data/lib/rake/ncoverconsoletask.rb +22 -0
- data/lib/rake/ncoverreporttask.rb +22 -0
- data/lib/rake/nunittask.rb +22 -0
- data/lib/rake/renametask.rb +25 -0
- data/lib/rake/sftptask.rb +21 -0
- data/lib/rake/sqlcmdtask.rb +22 -0
- data/lib/rake/sshtask.rb +21 -0
- data/lib/rake/ziptask.rb +21 -0
- data/rakefile.rb +144 -0
- data/spec/assemblyinfo_spec.rb +246 -0
- data/spec/assemblyinfotask_spec.rb +31 -0
- data/spec/expandtemplates_spec.rb +127 -0
- data/spec/expandtemplatestask_spec.rb +31 -0
- data/spec/msbuild_spec.rb +173 -0
- data/spec/msbuildtask_spec.rb +31 -0
- data/spec/ncoverconsole_spec.rb +247 -0
- data/spec/ncoverconsoletask_spec.rb +31 -0
- data/spec/ncoverreport_spec.rb +577 -0
- data/spec/ncoverreporttask_spec.rb +31 -0
- data/spec/nunittask_spec.rb +31 -0
- data/spec/patches/system_patch.rb +16 -0
- data/spec/patches/tasklib_patch.rb +12 -0
- data/spec/renametask_spec.rb +30 -0
- data/spec/sftp_spec.rb +30 -0
- data/spec/sftptask_spec.rb +41 -0
- data/spec/sqlcmd_spec.rb +139 -0
- data/spec/sqlcmdtask_spec.rb +31 -0
- data/spec/ssh_spec.rb +48 -0
- data/spec/sshtask_spec.rb +39 -0
- data/spec/support/AssemblyInfo/assemblyinfo.yml +2 -0
- data/spec/support/CodeCoverage/mspec/assemblies/Machine.Specifications.NUnit.dll +0 -0
- data/spec/support/CodeCoverage/mspec/assemblies/Machine.Specifications.dll +0 -0
- data/spec/support/CodeCoverage/mspec/assemblies/TestSolution.MSpecTests.dll +0 -0
- data/spec/support/CodeCoverage/mspec/assemblies/TestSolution.dll +0 -0
- data/spec/support/CodeCoverage/mspec/assemblies/nunit.framework.dll +0 -0
- data/spec/support/CodeCoverage/nunit/assemblies/TestSolution.Tests.dll +0 -0
- data/spec/support/CodeCoverage/nunit/assemblies/TestSolution.dll +0 -0
- data/spec/support/CodeCoverage/nunit/assemblies/nunit.framework.dll +0 -0
- data/spec/support/CodeCoverage/nunit/failing_assemblies/TestSolution.FailingTests.dll +0 -0
- data/spec/support/CodeCoverage/nunit/failing_assemblies/nunit.framework.dll +0 -0
- data/spec/support/CodeCoverage/report/coverage.xml +4578 -0
- data/spec/support/TestSolution/TestSolution.FailingTests/FailingTestFixture.cs +19 -0
- data/spec/support/TestSolution/TestSolution.FailingTests/Properties/AssemblyInfo.cs +36 -0
- data/spec/support/TestSolution/TestSolution.FailingTests/TestSolution.FailingTests.csproj +63 -0
- data/spec/support/TestSolution/TestSolution.MSpecTests/Properties/AssemblyInfo.cs +36 -0
- data/spec/support/TestSolution/TestSolution.MSpecTests/SomeSpecTest.cs +18 -0
- data/spec/support/TestSolution/TestSolution.MSpecTests/TestSolution.MSpecTests.csproj +77 -0
- data/spec/support/TestSolution/TestSolution.Tests/Properties/AssemblyInfo.cs +36 -0
- data/spec/support/TestSolution/TestSolution.Tests/SomeTestFixture.cs +23 -0
- data/spec/support/TestSolution/TestSolution.Tests/TestSolution.Tests.csproj +69 -0
- data/spec/support/TestSolution/TestSolution.sln +38 -0
- data/spec/support/TestSolution/TestSolution/Class1.cs +17 -0
- data/spec/support/TestSolution/TestSolution/Properties/AssemblyInfo.cs +36 -0
- data/spec/support/TestSolution/TestSolution/TestSolution.csproj +59 -0
- data/spec/support/assemblyinfotester.rb +42 -0
- data/spec/support/expandtemplates/datafiles/multiplevalues.yml +3 -0
- data/spec/support/expandtemplates/datafiles/multitemplate-specificfile.yml +11 -0
- data/spec/support/expandtemplates/datafiles/multitemplate.yml +4 -0
- data/spec/support/expandtemplates/datafiles/sample.yml +1 -0
- data/spec/support/expandtemplates/templates/multipleinstance.config +4 -0
- data/spec/support/expandtemplates/templates/multiplevalues.config +1 -0
- data/spec/support/expandtemplates/templates/sample.config +1 -0
- data/spec/support/expandtemplatestestdata.rb +69 -0
- data/spec/support/msbuildtestdata.rb +32 -0
- data/spec/support/ncoverreporttestdata.rb +26 -0
- data/spec/support/spec_helper.rb +15 -0
- data/spec/support/test.yml +4 -0
- data/spec/support/zip/files/subfolder/sub file.txt +1 -0
- data/spec/support/zip/files/testfile.txt +1 -0
- data/spec/support/ziptestdata.rb +8 -0
- data/spec/yamlconfig_spec.rb +62 -0
- data/spec/zip_spec.rb +18 -0
- data/spec/ziptask_spec.rb +31 -0
- data/yaml_autoconfig_test.yml +1 -0
- metadata +262 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'albacore/support/albacore_helper'
|
2
|
+
|
3
|
+
module NCover
|
4
|
+
class CodeCoverageBase
|
5
|
+
include YAMLConfig
|
6
|
+
|
7
|
+
attr_accessor :coverage_type, :minimum, :item_type
|
8
|
+
|
9
|
+
def initialize(coverage_type, params={})
|
10
|
+
super()
|
11
|
+
@coverage_type = coverage_type
|
12
|
+
@minimum = 0
|
13
|
+
@item_type = :View
|
14
|
+
parse_config(params) unless params.nil?
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_coverage_options
|
18
|
+
options = "#{@coverage_type}"
|
19
|
+
options << ":#{@minimum}" unless @minimum.nil?
|
20
|
+
options << ":#{@item_type}" unless @item_type.nil?
|
21
|
+
options
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'albacore/support/albacore_helper'
|
2
|
+
|
3
|
+
module NCover
|
4
|
+
class CyclomaticComplexity
|
5
|
+
include YAMLConfig
|
6
|
+
|
7
|
+
attr_accessor :maximum, :item_type
|
8
|
+
|
9
|
+
def initialize(params={})
|
10
|
+
super()
|
11
|
+
@maximum = 100
|
12
|
+
@item_type = :View
|
13
|
+
parse_config(params) unless params.nil?
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_coverage_options
|
17
|
+
options = "CyclomaticComplexity"
|
18
|
+
options << ":#{maximum}" unless maximum.nil?
|
19
|
+
options << ":#{item_type}" unless item_type.nil?
|
20
|
+
options
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'albacore/support/albacore_helper'
|
2
|
+
|
3
|
+
module NCover
|
4
|
+
class FullCoverageReport
|
5
|
+
include YAMLConfig
|
6
|
+
|
7
|
+
attr_accessor :output_path
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
super()
|
11
|
+
end
|
12
|
+
|
13
|
+
def report_type
|
14
|
+
:FullCoverageReport
|
15
|
+
end
|
16
|
+
|
17
|
+
def report_format
|
18
|
+
:Html
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'albacore/support/albacore_helper'
|
2
|
+
|
3
|
+
module NCover
|
4
|
+
class ReportFilterBase
|
5
|
+
include YAMLConfig
|
6
|
+
|
7
|
+
attr_accessor :filter, :filter_type, :item_type, :is_regex
|
8
|
+
|
9
|
+
def initialize(item_type, params={})
|
10
|
+
super()
|
11
|
+
@filter = ""
|
12
|
+
@item_type = item_type
|
13
|
+
@is_regex = false
|
14
|
+
@filter_type = :exclude
|
15
|
+
parse_config(params) unless params.nil?
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_filter_options
|
19
|
+
filter = "\"#{@filter}\""
|
20
|
+
filter << ":#{@item_type}"
|
21
|
+
filter << ":#{@is_regex}"
|
22
|
+
filter << ":#{(@filter_type == :include)}"
|
23
|
+
filter
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'albacore/support/albacore_helper'
|
2
|
+
|
3
|
+
module NCover
|
4
|
+
class SummaryReport
|
5
|
+
include YAMLConfig
|
6
|
+
|
7
|
+
attr_accessor :output_path
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
super()
|
11
|
+
@report_format = :Xml
|
12
|
+
end
|
13
|
+
|
14
|
+
def report_type
|
15
|
+
:Summary
|
16
|
+
end
|
17
|
+
|
18
|
+
def report_format
|
19
|
+
:Html
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'albacore/support/albacore_helper'
|
2
|
+
|
3
|
+
class NUnitTestRunner
|
4
|
+
include RunCommand
|
5
|
+
include YAMLConfig
|
6
|
+
|
7
|
+
attr_accessor :assemblies, :options
|
8
|
+
|
9
|
+
def initialize(path_to_command='')
|
10
|
+
super()
|
11
|
+
@path_to_command = path_to_command
|
12
|
+
@options=[]
|
13
|
+
@assemblies=[]
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_command_line
|
17
|
+
command_params = get_command_parameters
|
18
|
+
commandline = command_params.join(" ")
|
19
|
+
@logger.debug "Build NUnit Test Runner Command Line: " + commandline
|
20
|
+
commandline
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_command_parameters
|
24
|
+
command_params = []
|
25
|
+
command_params << @path_to_command
|
26
|
+
command_params << @assemblies.join(" ") unless @assemblies.nil?
|
27
|
+
command_params << @options.join(" ") unless @options.nil?
|
28
|
+
command_params
|
29
|
+
end
|
30
|
+
|
31
|
+
def execute()
|
32
|
+
command_params = get_command_parameters
|
33
|
+
result = run_command "NUnit", command_params
|
34
|
+
|
35
|
+
failure_message = 'NUnit Failed. See Build Log For Detail'
|
36
|
+
fail_with_message failure_message if !result
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'albacore/support/albacore_helper'
|
2
|
+
require 'net/sftp'
|
3
|
+
|
4
|
+
class Sftp
|
5
|
+
include YAMLConfig
|
6
|
+
include Logging
|
7
|
+
|
8
|
+
attr_accessor :server, :username, :password, :upload_files
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
super()
|
12
|
+
@upload_files = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def upload()
|
16
|
+
Net::SFTP.start(@server, @username, :password => @password) do |sftp|
|
17
|
+
@logger.debug "Starting File Upload"
|
18
|
+
@upload_files.each {|local_file, remote_file|
|
19
|
+
@logger.debug "Uploading #{local_file} to #{remote_file}"
|
20
|
+
sftp.upload!(local_file, remote_file)
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'albacore/support/albacore_helper'
|
2
|
+
|
3
|
+
class SQLCmd
|
4
|
+
include RunCommand
|
5
|
+
include YAMLConfig
|
6
|
+
|
7
|
+
attr_accessor :server, :database, :username, :password, :scripts, :variables
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
super()
|
11
|
+
@require_valid_command = false
|
12
|
+
@scripts=[]
|
13
|
+
@variables={}
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
check_command
|
18
|
+
return if @failed
|
19
|
+
|
20
|
+
cmd_params=[]
|
21
|
+
cmd_params << build_parameter("S", @server) unless @server.nil?
|
22
|
+
cmd_params << build_parameter("d", @database) unless @database.nil?
|
23
|
+
cmd_params << build_parameter("U", @username) unless @username.nil?
|
24
|
+
cmd_params << build_parameter("P", @password) unless @password.nil?
|
25
|
+
cmd_params << build_variable_list if @variables.length > 0
|
26
|
+
cmd_params << build_script_list if @scripts.length > 0
|
27
|
+
|
28
|
+
result = run_command "SQLCmd", cmd_params.join(" ")
|
29
|
+
|
30
|
+
failure_msg = 'SQLCmd Failed. See Build Log For Detail.'
|
31
|
+
fail_with_message failure_msg if !result
|
32
|
+
end
|
33
|
+
|
34
|
+
def check_command
|
35
|
+
return if @path_to_command
|
36
|
+
fail_with_message 'SQLCmd.path_to_command cannot be nil.'
|
37
|
+
end
|
38
|
+
|
39
|
+
def build_script_list
|
40
|
+
@scripts.map{|s| "-i \"#{s}\""}.join(" ")
|
41
|
+
end
|
42
|
+
|
43
|
+
def build_parameter(param_name, param_value)
|
44
|
+
"-#{param_name} \"#{param_value}\""
|
45
|
+
end
|
46
|
+
|
47
|
+
def build_variable_list
|
48
|
+
vars = []
|
49
|
+
@variables.each do |k,v|
|
50
|
+
vars << "-v #{k}=#{v}"
|
51
|
+
end
|
52
|
+
vars.join(" ")
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
data/lib/albacore/ssh.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'albacore/support/albacore_helper'
|
2
|
+
require 'net/ssh'
|
3
|
+
|
4
|
+
class Ssh
|
5
|
+
include YAMLConfig
|
6
|
+
include Logging
|
7
|
+
|
8
|
+
attr_accessor :server, :username, :password, :commands
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
super()
|
12
|
+
@commands = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute()
|
16
|
+
Net::SSH.start(@server, @username, :password => @password) do |ssh|
|
17
|
+
@commands.each{|cmd|
|
18
|
+
@logger.info "Executing remote command: #{cmd}"
|
19
|
+
output = ssh.exec!(cmd)
|
20
|
+
@logger.info 'SSH output: '
|
21
|
+
@logger.info output
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'albacore/support/logging'
|
2
|
+
|
3
|
+
module Failure
|
4
|
+
include Logging
|
5
|
+
|
6
|
+
attr_accessor :failed
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
super()
|
10
|
+
@failed = false
|
11
|
+
end
|
12
|
+
|
13
|
+
def fail
|
14
|
+
@failed = true
|
15
|
+
end
|
16
|
+
|
17
|
+
def fail_with_message(msg)
|
18
|
+
@logger.fatal msg
|
19
|
+
fail
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module Logging
|
4
|
+
|
5
|
+
attr_accessor :logger, :current_log_device
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
super()
|
9
|
+
create_logger(STDOUT, Logger::INFO)
|
10
|
+
end
|
11
|
+
|
12
|
+
def log_device=(logdev)
|
13
|
+
level = @logger.level
|
14
|
+
create_logger(logdev, level)
|
15
|
+
end
|
16
|
+
|
17
|
+
def log_level=(level)
|
18
|
+
if (level == :verbose)
|
19
|
+
loglevel = Logger::DEBUG
|
20
|
+
else
|
21
|
+
loglevel = Logger::INFO
|
22
|
+
end
|
23
|
+
create_logger(@current_log_device, loglevel)
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_logger(device, level)
|
27
|
+
@current_log_device = device
|
28
|
+
@logger = Logger.new(device)
|
29
|
+
@logger.level = level
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'albacore/support/failure'
|
2
|
+
|
3
|
+
module RunCommand
|
4
|
+
include Failure
|
5
|
+
|
6
|
+
attr_accessor :path_to_command, :require_valid_command, :command_directory
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
super()
|
10
|
+
@require_valid_command = true
|
11
|
+
@command_directory = Dir.pwd
|
12
|
+
end
|
13
|
+
|
14
|
+
def run_command(command_name="Command Line", command_parameters="")
|
15
|
+
if @require_valid_command
|
16
|
+
return false unless valid_command_exists
|
17
|
+
end
|
18
|
+
|
19
|
+
command = "\"#{@path_to_command}\" #{command_parameters}"
|
20
|
+
@logger.debug "Executing #{command_name}: #{command}"
|
21
|
+
|
22
|
+
set_working_directory
|
23
|
+
result = system command
|
24
|
+
reset_working_directory
|
25
|
+
|
26
|
+
result
|
27
|
+
end
|
28
|
+
|
29
|
+
def valid_command_exists
|
30
|
+
return true if File.exist?(@path_to_command)
|
31
|
+
msg = 'Command not found: ' + @path_to_command
|
32
|
+
@logger.fatal msg
|
33
|
+
end
|
34
|
+
|
35
|
+
def set_working_directory
|
36
|
+
@original_directory = Dir.pwd
|
37
|
+
return if @command_directory == @original_directory
|
38
|
+
Dir.chdir(@command_directory)
|
39
|
+
end
|
40
|
+
|
41
|
+
def reset_working_directory
|
42
|
+
return if Dir.pwd == @original_directory
|
43
|
+
Dir.chdir(@original_directory)
|
44
|
+
end
|
45
|
+
end
|