albacore 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -4,28 +4,28 @@ require 'rake/ncoverreporttask'
4
4
  require 'tasklib_patch'
5
5
 
6
6
  describe Albacore::NCoverReportTask, "when running" do
7
- before :all do
8
- task = Albacore::NCoverReportTask.new(:ncoverreport) do |t|
9
- @yielded_object = t
10
- end
11
- task.extend(TasklibPatch)
12
- Rake::Task[:ncoverreport].invoke
13
- end
14
-
15
- it "should yield the ncover report api" do
16
- @yielded_object.kind_of?(NCoverReport).should == true
17
- end
7
+ before :all do
8
+ task = Albacore::NCoverReportTask.new(:ncoverreport) do |t|
9
+ @yielded_object = t
10
+ end
11
+ task.extend(TasklibPatch)
12
+ Rake::Task[:ncoverreport].invoke
13
+ end
14
+
15
+ it "should yield the ncover report api" do
16
+ @yielded_object.kind_of?(NCoverReport).should == true
17
+ end
18
18
  end
19
19
 
20
20
  describe Albacore::NCoverReportTask, "when execution fails" do
21
- before :all do
22
- @task = Albacore::NCoverReportTask.new(:failingtask)
23
- @task.extend(TasklibPatch)
24
- @task.fail
25
- Rake::Task["failingtask"].invoke
26
- end
27
-
28
- it "should fail the rake task" do
29
- @task.task_failed.should == true
30
- end
21
+ before :all do
22
+ @task = Albacore::NCoverReportTask.new(:failingtask)
23
+ @task.extend(TasklibPatch)
24
+ @task.fail
25
+ Rake::Task["failingtask"].invoke
26
+ end
27
+
28
+ it "should fail the rake task" do
29
+ @task.task_failed.should == true
30
+ end
31
31
  end
@@ -0,0 +1,49 @@
1
+ require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
+ require 'albacore/ndepend'
3
+ require 'albacore/msbuild'
4
+
5
+ describe "when executing Ndepend console" do
6
+ before :all do
7
+ @msbuild = MSBuild.new
8
+ @msbuild.properties = {:configuration => :Debug}
9
+ @msbuild.targets = [:Clean, :Build]
10
+ @msbuild.solution = "spec/support/TestSolution/TestSolution.sln"
11
+ @msbuild.build
12
+ end
13
+ before :each do
14
+ @ndepend = NDepend.new
15
+ @ndepend.log_device = StringIO.new
16
+ @ndepend.project_file = "spec/support/TestSolution/Ndependproject.xml"
17
+ @ndepend.path_to_command = "spec/support/tools/Ndepend-v2.12/NDepend.Console.exe"
18
+
19
+ @logger = StringIO.new
20
+ @ndepend.log_device = @logger
21
+ @log_data = @logger.string
22
+ @ndepend.log_level = :verbose
23
+
24
+
25
+ end
26
+ it "should execute NdependConsole.exe"do
27
+ @ndepend.run
28
+
29
+ @log_data.should include("NDepend.Console.exe" )
30
+ end
31
+
32
+ it "should include the Ndepend project file" do
33
+ @ndepend.run
34
+ @log_data.should include("NDependProject.xml")
35
+ end
36
+
37
+ it "should fail when the project file is not given" do
38
+ @ndepend.project_file = nil
39
+ @ndepend.run
40
+ @ndepend.failed.should be_true
41
+ end
42
+
43
+ it "should accept other parameters" do
44
+ expected_params = "/ViewReport /Silent /Help"
45
+ @ndepend.parameters << expected_params
46
+ @ndepend.run
47
+ @log_data.should include(expected_params)
48
+ end
49
+ end
@@ -1,31 +1,31 @@
1
1
  require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
- require 'albacore/command'
3
- require 'rake/commandtask'
2
+ require 'albacore/ndepend'
3
+ require 'rake/ndependtask'
4
4
  require 'tasklib_patch'
5
5
 
6
- describe Albacore::CommandTask, "when running" do
6
+ describe Albacore::NDependTask, "when running" do
7
7
  before :all do
8
- task = Albacore::CommandTask.new(:command) do |t|
8
+ task = Albacore::NDependTask.new(:command) do |t|
9
9
  @yielded_object = t
10
10
  end
11
11
  task.extend(TasklibPatch)
12
12
  Rake::Task[:command].invoke
13
13
  end
14
-
14
+
15
15
  it "should yield the command api" do
16
- @yielded_object.kind_of?(Command).should == true
16
+ @yielded_object.kind_of?(NDepend).should == true
17
17
  end
18
18
  end
19
19
 
20
- describe Albacore::CommandTask, "when execution fails" do
20
+ describe Albacore::NDependTask, "when execution fails" do
21
21
  before :all do
22
- @task = Albacore::CommandTask.new(:failingtask)
22
+ @task = Albacore::NDependTask.new(:failingtask)
23
23
  @task.extend(TasklibPatch)
24
24
  @task.fail
25
25
  Rake::Task["failingtask"].invoke
26
26
  end
27
-
27
+
28
28
  it "should fail the rake task" do
29
29
  @task.task_failed.should be_true
30
30
  end
31
- end
31
+ end
@@ -4,28 +4,28 @@ require 'rake/nunittask'
4
4
  require 'tasklib_patch'
5
5
 
6
6
  describe Albacore::NUnitTask, "when running" do
7
- before :all do
8
- task = Albacore::NUnitTask.new(:nunit) do |t|
9
- @yielded_object = t
10
- end
11
- task.extend(TasklibPatch)
12
- Rake::Task[:nunit].invoke
13
- end
14
-
15
- it "should yield the nunit api" do
16
- @yielded_object.kind_of?(NUnitTestRunner).should be_true
17
- end
7
+ before :all do
8
+ task = Albacore::NUnitTask.new(:nunit) do |t|
9
+ @yielded_object = t
10
+ end
11
+ task.extend(TasklibPatch)
12
+ Rake::Task[:nunit].invoke
13
+ end
14
+
15
+ it "should yield the nunit api" do
16
+ @yielded_object.kind_of?(NUnitTestRunner).should be_true
17
+ end
18
18
  end
19
19
 
20
20
  describe Albacore::NUnitTask, "when execution fails" do
21
- before :all do
22
- @task = Albacore::NUnitTask.new(:failingtask)
23
- @task.extend(TasklibPatch)
24
- @task.fail
25
- Rake::Task["failingtask"].invoke
26
- end
27
-
28
- it "should fail the rake task" do
29
- @task.task_failed.should == true
30
- end
21
+ before :all do
22
+ @task = Albacore::NUnitTask.new(:failingtask)
23
+ @task.extend(TasklibPatch)
24
+ @task.fail
25
+ Rake::Task["failingtask"].invoke
26
+ end
27
+
28
+ it "should fail the rake task" do
29
+ @task.task_failed.should == true
30
+ end
31
31
  end
@@ -9,8 +9,8 @@ require 'albacore/nunittestrunner'
9
9
  describe NUnitTestRunner, "the command parameters for an nunit runner" do
10
10
  before :all do
11
11
  nunit = NUnitTestRunner.new(@@nunitpath)
12
- nunit.assemblies << [@@test_assembly, @@failing_test_assembly]
13
- nunit.options << @@output_option
12
+ nunit.assemblies @@test_assembly, @@failing_test_assembly
13
+ nunit.options @@output_option
14
14
 
15
15
  @command_parameters = nunit.get_command_parameters
16
16
  end
@@ -31,8 +31,8 @@ end
31
31
  describe NUnitTestRunner, "the command line string for an nunit runner" do
32
32
  before :all do
33
33
  nunit = NUnitTestRunner.new(@@nunitpath)
34
- nunit.assemblies << @@test_assembly
35
- nunit.options << @@output_option
34
+ nunit.assemblies @@test_assembly
35
+ nunit.options @@output_option
36
36
 
37
37
  @command_line = nunit.get_command_line
38
38
  @command_parameters = nunit.get_command_parameters.join(" ")
@@ -51,8 +51,8 @@ end
51
51
  describe NUnitTestRunner, "when configured correctly" do
52
52
  before :all do
53
53
  nunit = NUnitTestRunner.new(@@nunitpath)
54
- nunit.assemblies << @@test_assembly
55
- nunit.options << '/noshadow'
54
+ nunit.assemblies @@test_assembly
55
+ nunit.options '/noshadow'
56
56
 
57
57
  nunit.execute
58
58
  @failed = nunit.failed
@@ -0,0 +1,13 @@
1
+ class Docu
2
+ attr_accessor :command_result, :command_parameters, :failed, :failure_message
3
+
4
+ def run_command(command_name="Command Line", command_parameters="")
5
+ @command_parameters = command_parameters
6
+ @command_result || false
7
+ end
8
+
9
+ def fail_with_message(msg)
10
+ @failed = true
11
+ @failure_message = msg
12
+ end
13
+ end
@@ -1,20 +1,20 @@
1
1
  module SystemPatch
2
- attr_accessor :disable_system, :force_system_failure
3
-
4
- def initialize
5
- @disable_system = false
6
- @force_command_failure = false
7
- end
8
-
9
- def system_command
10
- @system_command
11
- end
12
-
13
- def system(cmd)
14
- @system_command = cmd
15
- result = true
16
- result = super(cmd) if !disable_system
17
- return false if @force_system_failure
18
- return result
19
- end
2
+ attr_accessor :disable_system, :force_system_failure
3
+
4
+ def initialize
5
+ @disable_system = false
6
+ @force_command_failure = false
7
+ end
8
+
9
+ def system_command
10
+ @system_command
11
+ end
12
+
13
+ def system(cmd)
14
+ @system_command = cmd
15
+ result = true
16
+ result = super(cmd) if !disable_system
17
+ return false if @force_system_failure
18
+ return result
19
+ end
20
20
  end
@@ -1,12 +1,12 @@
1
1
  module TasklibPatch
2
- attr_accessor :task_failed
3
-
4
- def initialize
5
- super()
6
- @task_failed = false
7
- end
8
-
9
- def fail
10
- @task_failed = true
11
- end
2
+ attr_accessor :task_failed
3
+
4
+ def initialize
5
+ super()
6
+ @task_failed = false
7
+ end
8
+
9
+ def fail
10
+ @task_failed = true
11
+ end
12
12
  end
@@ -0,0 +1,61 @@
1
+ require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
+ require 'albacore/plink'
3
+
4
+ describe PLink, 'when executing a command over plink' do
5
+ before :each do
6
+ @cmd = PLink.new
7
+ @cmd.extend(SystemPatch)
8
+ @cmd.path_to_command ="C:\\plink.exe"
9
+ @cmd.host = "testhost"
10
+
11
+ end
12
+
13
+ it "should attempt to execute plink.exe" do
14
+ @cmd.run
15
+ @cmd.system_command.should include("plink.exe")
16
+ end
17
+
18
+ it "should attempt to connect to the test host on the default port (22)" do
19
+ @cmd.run
20
+ @cmd.system_command.should include("@testhost")
21
+ @cmd.system_command.should include("-P 22")
22
+ end
23
+
24
+ it "should connect to the test host on a non default port 2200" do
25
+ @cmd.port = 2200
26
+ @cmd.run
27
+ @cmd.system_command.should include("-P 2200")
28
+ end
29
+
30
+ it "should connect to the host with a username" do
31
+ expected_user = "dummyuser"
32
+ @cmd.user = expected_user
33
+ @cmd.run
34
+ @cmd.system_command.should include("#{expected_user}@")
35
+ end
36
+
37
+ it "should run remote commands in batch mode" do
38
+ @cmd.run
39
+ @cmd.system_command.should include("-batch")
40
+ end
41
+
42
+ it "should run commands in verbose mode" do
43
+ @cmd.verbose = true
44
+ @cmd.run
45
+ @cmd.system_command.should include("-v")
46
+ end
47
+
48
+ it "should include the remote command" do
49
+ expected_remote_exe = "C:\ThisIsTheRemoteExe.exe"
50
+ @cmd.commands expected_remote_exe
51
+ @cmd.run
52
+ @cmd.system_command.should include(expected_remote_exe)
53
+ end
54
+
55
+ it "should include the remote command with parameters" do
56
+ expected_remote_exe = "C:\\ThisIsTheRemoteExe.exe --help -o -p"
57
+ @cmd.commands expected_remote_exe
58
+ @cmd.run
59
+ @cmd.system_command.should include(expected_remote_exe)
60
+ end
61
+ end
@@ -0,0 +1,31 @@
1
+ require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
+ require 'albacore/plink'
3
+ require 'rake/plinktask'
4
+ require 'tasklib_patch'
5
+
6
+ describe Albacore::PLinkTask, "when running" do
7
+ before :all do
8
+ task = Albacore::PLinkTask.new(:plink) do |t|
9
+ @yielded_object = t
10
+ end
11
+ task.extend(TasklibPatch)
12
+ Rake::Task[:plink].invoke
13
+ end
14
+
15
+ it "should yield the command api" do
16
+ @yielded_object.kind_of?(PLink).should == true
17
+ end
18
+ end
19
+
20
+ describe Albacore::PLinkTask, "when execution fails" do
21
+ before :all do
22
+ @task = Albacore::PLinkTask.new(:plink_failingtask)
23
+ @task.extend(TasklibPatch)
24
+ @task.fail
25
+ Rake::Task[:plink_failingtask].invoke
26
+ end
27
+
28
+ it "should fail the rake task" do
29
+ @task.task_failed.should be_true
30
+ end
31
+ end
@@ -3,28 +3,28 @@ require 'rake/renametask'
3
3
  require 'tasklib_patch'
4
4
 
5
5
  describe Albacore::RenameTask, "when running" do
6
- before :all do
7
- task = Albacore::RenameTask.new(:rename) do |t|
8
- @yielded_object = t
9
- end
10
- task.extend(TasklibPatch)
11
- Rake::Task[:rename].invoke
12
- end
13
-
14
- it "should yield the rename api" do
15
- @yielded_object.kind_of?(Albacore::RenameTask).should be_true
16
- end
6
+ before :all do
7
+ task = Albacore::RenameTask.new(:rename) do |t|
8
+ @yielded_object = t
9
+ end
10
+ task.extend(TasklibPatch)
11
+ Rake::Task[:rename].invoke
12
+ end
13
+
14
+ it "should yield the rename api" do
15
+ @yielded_object.kind_of?(Albacore::RenameTask).should be_true
16
+ end
17
17
  end
18
18
 
19
19
  describe Albacore::RenameTask, "when execution fails" do
20
- before :all do
21
- @task = Albacore::RenameTask.new(:failingtask)
22
- @task.extend(TasklibPatch)
23
- @task.fail
24
- Rake::Task["failingtask"].invoke
25
- end
26
-
27
- it "should fail the rake task" do
28
- @task.task_failed.should == true
29
- end
20
+ before :all do
21
+ @task = Albacore::RenameTask.new(:failingtask)
22
+ @task.extend(TasklibPatch)
23
+ @task.fail
24
+ Rake::Task["failingtask"].invoke
25
+ end
26
+
27
+ it "should fail the rake task" do
28
+ @task.task_failed.should == true
29
+ end
30
30
  end