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
data/lib/albacore/ssh.rb
CHANGED
@@ -2,41 +2,43 @@ require 'albacore/support/albacore_helper'
|
|
2
2
|
require 'net/ssh'
|
3
3
|
|
4
4
|
class Ssh
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
attr_accessor :server, :username, :password, :commands, :port, :key, :debug
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@commands = []
|
12
|
-
super()
|
13
|
-
end
|
5
|
+
extend AttrMethods
|
6
|
+
include YAMLConfig
|
7
|
+
include Logging
|
14
8
|
|
15
|
-
|
16
|
-
|
17
|
-
options[:verbose] = :debug if @debug == true
|
18
|
-
options[:password] = @password if @password
|
19
|
-
options[:port] = @port if @port
|
20
|
-
options[:keys] = [@key] if @key
|
21
|
-
options
|
22
|
-
end
|
23
|
-
|
24
|
-
def execute()
|
25
|
-
warn_about_key if @key
|
9
|
+
attr_accessor :server, :username, :password, :port, :key, :debug
|
10
|
+
attr_array :commands
|
26
11
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
@logger.info 'SSH output: '
|
32
|
-
@logger.info output
|
33
|
-
}
|
34
|
-
end
|
35
|
-
end
|
12
|
+
def initialize
|
13
|
+
@commands = []
|
14
|
+
super()
|
15
|
+
end
|
36
16
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
17
|
+
def get_connection_options
|
18
|
+
options = {}
|
19
|
+
options[:verbose] = :debug if @debug == true
|
20
|
+
options[:password] = @password if @password
|
21
|
+
options[:port] = @port if @port
|
22
|
+
options[:keys] = [@key] if @key
|
23
|
+
options
|
24
|
+
end
|
25
|
+
|
26
|
+
def execute()
|
27
|
+
warn_about_key if @key
|
28
|
+
|
29
|
+
Net::SSH.start(@server, @username, get_connection_options) do |ssh|
|
30
|
+
@commands.each{|cmd|
|
31
|
+
@logger.info "Executing remote command: #{cmd}"
|
32
|
+
output = ssh.exec!(cmd)
|
33
|
+
@logger.info 'SSH output: '
|
34
|
+
@logger.info output
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def warn_about_key()
|
40
|
+
info.debug 'When using a key, you need an SSH-Agent running to manage the keys.'
|
41
|
+
info.debug 'On Windows, a recommended agent is called Pageant, downloadable from the Putty site.'
|
42
|
+
end
|
41
43
|
|
42
44
|
end
|
@@ -1,4 +1 @@
|
|
1
|
-
|
2
|
-
require File.join(File.dirname(__FILE__), 'failure')
|
3
|
-
require File.join(File.dirname(__FILE__), 'runcommand')
|
4
|
-
require File.join(File.dirname(__FILE__), 'yamlconfig')
|
1
|
+
Dir.glob(File.join(File.dirname(__FILE__), '*.rb')).reject{|f| f == __FILE__}.each {|f| require f }
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module AttrMethods
|
2
|
+
|
3
|
+
def attr_array(*names)
|
4
|
+
names.each do |n|
|
5
|
+
self.send :define_method, n do |*value|
|
6
|
+
instance_variable_set "@#{n}", value
|
7
|
+
end
|
8
|
+
self.send :define_method, "#{n}=" do |value|
|
9
|
+
instance_variable_set "@#{n}", value
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def attr_hash(*names)
|
15
|
+
names.each do |n|
|
16
|
+
self.send :define_method, n do |value|
|
17
|
+
instance_variable_set "@#{n}", value
|
18
|
+
end
|
19
|
+
self.send :define_method, "#{n}=" do |value|
|
20
|
+
instance_variable_set "@#{n}", value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -1,22 +1,22 @@
|
|
1
1
|
require 'albacore/support/logging'
|
2
2
|
|
3
3
|
module Failure
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
4
|
+
include Logging
|
5
|
+
|
6
|
+
attr_accessor :failed
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@failed = false
|
10
|
+
super()
|
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
21
|
end
|
22
22
|
|
@@ -1,32 +1,34 @@
|
|
1
1
|
require 'logger'
|
2
2
|
|
3
3
|
module Logging
|
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
|
-
|
4
|
+
|
5
|
+
attr_accessor :logger, :current_log_device
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
create_logger(STDOUT, Logger::INFO)
|
9
|
+
super()
|
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
|
+
|
30
|
+
level = Logger::DEBUG if Albacore::log_level == :verbose
|
31
|
+
@logger.level = level
|
32
|
+
end
|
33
|
+
|
32
34
|
end
|
@@ -1,45 +1,45 @@
|
|
1
1
|
require 'albacore/support/failure'
|
2
2
|
|
3
3
|
module RunCommand
|
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
|
-
|
4
|
+
include Failure
|
5
|
+
|
6
|
+
attr_accessor :path_to_command, :require_valid_command, :command_directory
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@require_valid_command = true
|
10
|
+
@command_directory = Dir.pwd
|
11
|
+
super()
|
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
45
|
end
|
@@ -1,30 +1,26 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
|
-
module YAMLConfig
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
self.class.send(:attr_accessor, key) if !respond_to?(setter)
|
27
|
-
send setter, value
|
28
|
-
end
|
29
|
-
end
|
3
|
+
module YAMLConfig
|
4
|
+
def initialize
|
5
|
+
super()
|
6
|
+
end
|
7
|
+
|
8
|
+
def load_config_by_task_name(task_name)
|
9
|
+
task_config = "#{task_name}.yml"
|
10
|
+
task_config = File.join(Albacore::yaml_config_folder, task_config) unless Albacore::yaml_config_folder.nil?
|
11
|
+
configure(task_config) if File.exists?(task_config)
|
12
|
+
end
|
13
|
+
|
14
|
+
def configure(yml_file)
|
15
|
+
config = YAML::load(File.open(yml_file))
|
16
|
+
parse_config config
|
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
|
30
26
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'albacore/support/albacore_helper'
|
2
|
+
require 'zip/zip'
|
3
|
+
require 'zip/zipfilesystem'
|
4
|
+
include Zip
|
5
|
+
|
6
|
+
class Unzip
|
7
|
+
include YAMLConfig
|
8
|
+
include Failure
|
9
|
+
|
10
|
+
attr_accessor :unzip_path, :zip_file
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
super()
|
14
|
+
end
|
15
|
+
|
16
|
+
def unzip()
|
17
|
+
fail_with_message 'Zip File cannot be empty' if @zip_file.nil?
|
18
|
+
return if @zip_file.nil?
|
19
|
+
|
20
|
+
Zip::ZipFile.open(@zip_file) do |zip_file|
|
21
|
+
zip_file.each do |file|
|
22
|
+
out_path = File.join(@unzip_path, file.name)
|
23
|
+
FileUtils.mkdir_p(File.dirname(out_path))
|
24
|
+
zip_file.extract(file, out_path) unless File.exist?(out_path)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'albacore/support/albacore_helper'
|
2
|
+
|
3
|
+
class XBuild
|
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 = 'xbuild'
|
15
|
+
super()
|
16
|
+
end
|
17
|
+
|
18
|
+
def build
|
19
|
+
build_solution(@solution)
|
20
|
+
end
|
21
|
+
|
22
|
+
def build_solution(solution)
|
23
|
+
check_solution solution
|
24
|
+
|
25
|
+
command_parameters = []
|
26
|
+
command_parameters << "\"#{solution}\""
|
27
|
+
command_parameters << "\"/verbosity:#{@verbosity}\"" if @verbosity != nil
|
28
|
+
command_parameters << build_properties if @properties != nil
|
29
|
+
command_parameters << "\"/target:#{build_targets}\"" if @targets != nil
|
30
|
+
|
31
|
+
result = run_command "xBuild", command_parameters.join(" ")
|
32
|
+
|
33
|
+
failure_message = 'xBuild Failed. See Build Log For Detail'
|
34
|
+
fail_with_message failure_message if !result
|
35
|
+
end
|
36
|
+
|
37
|
+
def check_solution(file)
|
38
|
+
return if file
|
39
|
+
msg = 'solution cannot be nil'
|
40
|
+
fail_with_message msg
|
41
|
+
end
|
42
|
+
|
43
|
+
def build_targets
|
44
|
+
@targets.join ";"
|
45
|
+
end
|
46
|
+
|
47
|
+
def build_properties
|
48
|
+
option_text = []
|
49
|
+
@properties.each do |key, value|
|
50
|
+
option_text << "/p:#{key}\=\"#{value}\""
|
51
|
+
end
|
52
|
+
option_text.join(" ")
|
53
|
+
end
|
54
|
+
end
|