albacore 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +84 -81
- data/VERSION +1 -1
- data/install_dependencies.rb +10 -10
- data/lib/albacore.rb +10 -2
- data/lib/albacore/assemblyinfo.rb +100 -100
- data/lib/albacore/assemblyinfolanguages/csharpengine.rb +14 -0
- data/lib/albacore/assemblyinfolanguages/vbnetengine.rb +14 -0
- data/lib/albacore/docu.rb +39 -0
- data/lib/albacore/exec.rb +23 -0
- data/lib/albacore/expandtemplates.rb +73 -71
- data/lib/albacore/msbuild.rb +56 -61
- data/lib/albacore/mspectestrunner.rb +44 -42
- data/lib/albacore/nant.rb +39 -0
- data/lib/albacore/ncoverconsole.rb +68 -61
- data/lib/albacore/ncoverreport.rb +56 -55
- data/lib/albacore/ncoverreports/assemblyfilter.rb +7 -7
- data/lib/albacore/ncoverreports/branchcoverage.rb +7 -7
- data/lib/albacore/ncoverreports/classfilter.rb +5 -5
- data/lib/albacore/ncoverreports/codecoveragebase.rb +22 -22
- data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +19 -19
- data/lib/albacore/ncoverreports/documentfilter.rb +5 -5
- data/lib/albacore/ncoverreports/fullcoveragereport.rb +17 -17
- data/lib/albacore/ncoverreports/methodcoverage.rb +7 -7
- data/lib/albacore/ncoverreports/methodfilter.rb +5 -5
- data/lib/albacore/ncoverreports/namespacefilter.rb +5 -5
- data/lib/albacore/ncoverreports/reportfilterbase.rb +23 -23
- data/lib/albacore/ncoverreports/summaryreport.rb +18 -18
- data/lib/albacore/ncoverreports/symbolcoverage.rb +6 -7
- data/lib/albacore/ndepend.rb +35 -0
- data/lib/albacore/nunittestrunner.rb +36 -35
- data/lib/albacore/plink.rb +48 -0
- data/lib/albacore/sftp.rb +33 -31
- data/lib/albacore/sqlcmd.rb +54 -51
- data/lib/albacore/ssh.rb +35 -33
- data/lib/albacore/support/albacore_helper.rb +1 -4
- data/lib/albacore/support/attrmethods.rb +25 -0
- data/lib/albacore/support/failure.rb +17 -17
- data/lib/albacore/support/globalconfig.rb +6 -0
- data/lib/albacore/support/logging.rb +30 -28
- data/lib/albacore/support/runcommand.rb +41 -41
- data/lib/albacore/support/yamlconfig.rb +23 -27
- data/lib/albacore/unzip.rb +28 -0
- data/lib/albacore/xbuild.rb +54 -0
- data/lib/albacore/xunittestrunner.rb +40 -43
- data/lib/albacore/zipdirectory.rb +72 -63
- data/lib/rake/assemblyinfotask.rb +12 -11
- data/lib/rake/docutask.rb +17 -0
- data/lib/rake/exectask.rb +18 -0
- data/lib/rake/expandtemplatestask.rb +12 -11
- data/lib/rake/msbuildtask.rb +13 -12
- data/lib/rake/mspectask.rb +12 -11
- data/lib/rake/nanttask.rb +17 -0
- data/lib/rake/ncoverconsoletask.rb +12 -11
- data/lib/rake/ncoverreporttask.rb +12 -11
- data/lib/rake/ndependtask.rb +23 -0
- data/lib/rake/nunittask.rb +12 -11
- data/lib/rake/plinktask.rb +23 -0
- data/lib/rake/renametask.rb +15 -15
- data/lib/rake/sftptask.rb +11 -10
- data/lib/rake/sqlcmdtask.rb +13 -12
- data/lib/rake/sshtask.rb +11 -10
- data/lib/rake/support/albacoretask.rb +16 -15
- data/lib/rake/unziptask.rb +17 -0
- data/lib/rake/xbuildtask.rb +22 -0
- data/lib/rake/xunittask.rb +12 -11
- data/lib/rake/ziptask.rb +12 -11
- data/rakefile.rb +255 -204
- data/spec/assemblyinfo_spec.rb +426 -221
- data/spec/assemblyinfotask_spec.rb +21 -21
- data/spec/docu_spec.rb +70 -0
- data/spec/docutask_spec.rb +39 -0
- data/spec/exec_spec.rb +23 -0
- data/spec/exectask_spec.rb +31 -0
- data/spec/expandtemplates_spec.rb +149 -148
- data/spec/expandtemplatestask_spec.rb +21 -21
- data/spec/msbuild_spec.rb +150 -139
- data/spec/msbuildtask_spec.rb +21 -21
- data/spec/mspectask_spec.rb +21 -21
- data/spec/nant_spec.rb +101 -0
- data/spec/nanttask_spec.rb +31 -0
- data/spec/ncoverconsole_spec.rb +253 -221
- data/spec/ncoverconsoletask_spec.rb +21 -21
- data/spec/ncoverreport_spec.rb +538 -523
- data/spec/ncoverreporttask_spec.rb +21 -21
- data/spec/ndepend_spec.rb +49 -0
- data/spec/{commandtask_spec.rb → ndependtask_spec.rb} +10 -10
- data/spec/nunittask_spec.rb +21 -21
- data/spec/nunittestrunner_spec.rb +6 -6
- data/spec/patches/docu_patch.rb +13 -0
- data/spec/patches/system_patch.rb +18 -18
- data/spec/patches/tasklib_patch.rb +10 -10
- data/spec/plink_spec.rb +61 -0
- data/spec/plinktask_spec.rb +31 -0
- data/spec/renametask_spec.rb +21 -21
- data/spec/sftp_spec.rb +24 -24
- data/spec/sftptask_spec.rb +31 -31
- data/spec/sqlcmd_spec.rb +118 -120
- data/spec/sqlcmdtask_spec.rb +21 -21
- data/spec/ssh_spec.rb +36 -37
- data/spec/sshtask_spec.rb +29 -29
- data/spec/support/TestSolution/NDependProject.xml +315 -0
- data/spec/support/TestSolution/TestSolution.XUnitTests/Class1.cs +12 -12
- data/spec/support/TestSolution/TestSolution.XUnitTests/FailingTestFixture.cs +14 -0
- data/spec/support/TestSolution/TestSolution.XUnitTests/TestSolution.XUnitTests.csproj +1 -0
- data/spec/support/TestSolution/TestSolution.build +25 -0
- data/spec/support/assemblyinfotester.rb +40 -38
- data/spec/support/expandtemplatestestdata.rb +73 -73
- data/spec/support/msbuildtestdata.rb +28 -28
- data/spec/support/nanttestdata.rb +33 -0
- data/spec/support/ncoverconsoletestdata.rb +18 -0
- data/spec/support/ncoverreporttestdata.rb +24 -24
- data/spec/support/spec_helper.rb +2 -1
- data/spec/support/yamlconfig/msbuild.yml +3 -0
- data/spec/support/yamlconfig/yaml_autoconfig_test.yml +1 -0
- data/spec/support/ziptestdata.rb +11 -6
- data/spec/xunit_spec.rb +63 -0
- data/spec/xunittask_spec.rb +19 -19
- data/spec/yamlconfig_spec.rb +38 -52
- data/spec/zip_spec.rb +56 -11
- data/spec/ziptask_spec.rb +22 -22
- metadata +53 -8
- data/lib/albacore/command.rb +0 -23
- data/lib/rake/commandtask.rb +0 -16
- 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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
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
|
data/lib/albacore/msbuild.rb
CHANGED
@@ -1,66 +1,61 @@
|
|
1
1
|
require 'albacore/support/albacore_helper'
|
2
2
|
|
3
3
|
class MSBuild
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|