albacore 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/EULA.txt +1 -1
  2. data/VERSION +1 -1
  3. data/lib/albacore.rb +4 -4
  4. data/lib/albacore/ncoverconsole.rb +4 -4
  5. data/lib/albacore/ncoverreport.rb +3 -3
  6. data/lib/albacore/ndepend.rb +3 -3
  7. data/lib/albacore/nunittestrunner.rb +1 -1
  8. data/lib/albacore/plink.rb +4 -3
  9. data/lib/albacore/renamer.rb +17 -0
  10. data/lib/albacore/sqlcmd.rb +3 -3
  11. data/lib/albacore/support/failure.rb +1 -8
  12. data/lib/rake/assemblyinfotask.rb +2 -16
  13. data/lib/rake/docutask.rb +2 -16
  14. data/lib/rake/exectask.rb +3 -18
  15. data/lib/rake/expandtemplatestask.rb +2 -15
  16. data/lib/rake/msbuildtask.rb +2 -17
  17. data/lib/rake/mspectask.rb +2 -16
  18. data/lib/rake/nanttask.rb +2 -16
  19. data/lib/rake/ncoverconsoletask.rb +3 -17
  20. data/lib/rake/ncoverreporttask.rb +3 -17
  21. data/lib/rake/ndependtask.rb +3 -21
  22. data/lib/rake/nunittask.rb +3 -17
  23. data/lib/rake/plinktask.rb +3 -23
  24. data/lib/rake/renametask.rb +2 -19
  25. data/lib/rake/sftptask.rb +3 -16
  26. data/lib/rake/sqlcmdtask.rb +2 -16
  27. data/lib/rake/sshtask.rb +2 -15
  28. data/lib/rake/support/albacoretask.rb +16 -6
  29. data/lib/rake/support/createtask.rb +20 -0
  30. data/lib/rake/unziptask.rb +2 -16
  31. data/lib/rake/xbuildtask.rb +4 -19
  32. data/lib/rake/xunittask.rb +2 -16
  33. data/lib/rake/ziptask.rb +2 -16
  34. data/rakefile.rb +6 -6
  35. data/spec/assemblyinfo_spec.rb +2 -0
  36. data/spec/assemblyinfotask_spec.rb +13 -12
  37. data/spec/createtask_spec.rb +70 -0
  38. data/spec/docutask_spec.rb +34 -21
  39. data/spec/exec_spec.rb +2 -1
  40. data/spec/exectask_spec.rb +25 -10
  41. data/spec/expandtemplatestask_spec.rb +25 -10
  42. data/spec/msbuild_spec.rb +2 -1
  43. data/spec/msbuildtask_spec.rb +25 -10
  44. data/spec/mspectask_spec.rb +25 -10
  45. data/spec/nant_spec.rb +2 -1
  46. data/spec/nanttask_spec.rb +24 -9
  47. data/spec/ncoverconsole_spec.rb +16 -8
  48. data/spec/ncoverconsoletask_spec.rb +25 -10
  49. data/spec/ncoverreport_spec.rb +27 -13
  50. data/spec/ncoverreporttask_spec.rb +25 -10
  51. data/spec/ndepend_spec.rb +3 -1
  52. data/spec/ndependtask_spec.rb +37 -22
  53. data/spec/nunittask_spec.rb +25 -10
  54. data/spec/nunittestrunner_spec.rb +3 -3
  55. data/spec/patches/fail_patch.rb +9 -0
  56. data/spec/plink_spec.rb +1 -0
  57. data/spec/plinktask_spec.rb +37 -22
  58. data/spec/renametask_spec.rb +13 -11
  59. data/spec/sftptask_spec.rb +11 -10
  60. data/spec/sqlcmd_spec.rb +4 -2
  61. data/spec/sqlcmdtask_spec.rb +11 -10
  62. data/spec/sshtask_spec.rb +11 -10
  63. data/spec/support/spec_helper.rb +2 -1
  64. data/spec/xunit_spec.rb +2 -2
  65. data/spec/xunittask_spec.rb +11 -10
  66. data/spec/ziptask_spec.rb +12 -11
  67. metadata +10 -7
  68. data/spec/patches/tasklib_patch.rb +0 -12
data/EULA.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Derick Bailey. All Rights Reserved.
1
+ Copyright (c) 2010 Derick Bailey. All Rights Reserved.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -7,12 +7,12 @@ require 'logging'
7
7
 
8
8
  runtime_is_ironruby = (!defined?(IRONRUBY_VERSION).nil?)
9
9
 
10
- Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), 'rake/support/*.rb')).each {|f| require f }
11
-
12
- Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), 'rake/*.rb')).reject{ |f|
10
+ Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), 'albacore/*.rb')).reject{ |f|
13
11
  f if runtime_is_ironruby && (f.include?("ssh") || f.include?("sftp"))
14
12
  }.each {|f| require f }
15
13
 
16
- Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), 'albacore/*.rb')).reject{ |f|
14
+ Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), 'rake/support/*.rb')).each {|f| require f }
15
+
16
+ Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), 'rake/*.rb')).reject{ |f|
17
17
  f if runtime_is_ironruby && (f.include?("ssh") || f.include?("sftp"))
18
18
  }.each {|f| require f }
@@ -27,8 +27,7 @@ class NCoverConsole
27
27
  end
28
28
 
29
29
  def run
30
- check_testrunner
31
- return false if @failed
30
+ return unless check_for_testrunner
32
31
 
33
32
  command_parameters = []
34
33
  command_parameters << "//reg" if @register_dll
@@ -45,11 +44,12 @@ class NCoverConsole
45
44
  fail_with_message failure_msg if !result
46
45
  end
47
46
 
48
- def check_testrunner
49
- return if (!@testrunner.nil?)
47
+ def check_for_testrunner
48
+ return true if (!@testrunner.nil?)
50
49
  msg = 'testrunner cannot be nil.'
51
50
  @logger.info msg
52
51
  fail
52
+ return false
53
53
  end
54
54
 
55
55
  def build_output_options(output)
@@ -17,8 +17,7 @@ class NCoverReport
17
17
  end
18
18
 
19
19
  def run
20
- check_command
21
- return if @failed
20
+ return unless check_command
22
21
 
23
22
  command_parameters = []
24
23
  command_parameters << build_coverage_files unless @coverage_files.empty?
@@ -33,8 +32,9 @@ class NCoverReport
33
32
  end
34
33
 
35
34
  def check_command
36
- return if @path_to_command
35
+ return true if @path_to_command
37
36
  fail_with_message 'NCoverReport.path_to_command cannot be nil.'
37
+ return false
38
38
  end
39
39
 
40
40
  def build_filters
@@ -11,8 +11,7 @@ class NDepend
11
11
  end
12
12
 
13
13
  def run
14
- check_comand
15
- return if @failed
14
+ return unless check_comand
16
15
  result = run_command @path_to_command, create_parameters.join(" ")
17
16
  failure_message = 'Command Failed. See Build Log For Detail'
18
17
  fail_with_message failure_message if !result
@@ -25,8 +24,9 @@ class NDepend
25
24
  end
26
25
 
27
26
  def check_comand
28
- return if @project_file
27
+ return true if @project_file
29
28
  fail_with_message 'A ndepend project file is required'
29
+ return false
30
30
  end
31
31
 
32
32
  end
@@ -26,7 +26,7 @@ class NUnitTestRunner
26
26
  def get_command_parameters
27
27
  command_params = []
28
28
  command_params << @options.join(" ") unless @options.nil?
29
- command_params << @assemblies.join(" ") unless @assemblies.nil?
29
+ command_params << @assemblies.map{|asm| "\"#{asm}\""}.join(' ') unless @assemblies.nil?
30
30
  command_params
31
31
  end
32
32
 
@@ -18,8 +18,8 @@ class PLink
18
18
  end
19
19
 
20
20
  def run()
21
- check_command
22
- return if @failed
21
+ return unless check_command
22
+
23
23
  parameters = create_parameters
24
24
  result = run_command "Plink", parameters.join(" ")
25
25
  failure_message = 'Command Failed. See Build Log For Detail'
@@ -42,7 +42,8 @@ class PLink
42
42
  end
43
43
 
44
44
  def check_command
45
- return if @path_to_command
45
+ return true if @path_to_command
46
46
  fail_with_message 'Plink.path_to_command cannot be nil.'
47
+ return false
47
48
  end
48
49
  end
@@ -0,0 +1,17 @@
1
+ require 'albacore/support/albacore_helper'
2
+
3
+ class Renamer
4
+ include YAMLConfig
5
+ include Failure
6
+
7
+ attr_accessor :actual_name, :target_name
8
+
9
+ def rename
10
+ if (@actual_name.nil? || @target_name.nil?)
11
+ fail "actual_name and target_name cannot be nil"
12
+ else
13
+ File.rename(@actual_name, @target_name)
14
+ end
15
+ end
16
+
17
+ end
@@ -17,8 +17,7 @@ class SQLCmd
17
17
  end
18
18
 
19
19
  def run
20
- check_command
21
- return if @failed
20
+ return unless check_command
22
21
 
23
22
  cmd_params=[]
24
23
  cmd_params << build_parameter("S", @server) unless @server.nil?
@@ -35,8 +34,9 @@ class SQLCmd
35
34
  end
36
35
 
37
36
  def check_command
38
- return if @path_to_command
37
+ return true if (!@path_to_command.nil?)
39
38
  fail_with_message 'SQLCmd.path_to_command cannot be nil.'
39
+ return false
40
40
  end
41
41
 
42
42
  def build_script_list
@@ -3,20 +3,13 @@ require 'albacore/support/logging'
3
3
  module Failure
4
4
  include Logging
5
5
 
6
- attr_accessor :failed
7
-
8
6
  def initialize
9
- @failed = false
10
7
  super()
11
8
  end
12
9
 
13
- def fail
14
- @failed = true
15
- end
16
-
17
10
  def fail_with_message(msg)
18
11
  @logger.fatal msg
19
- fail
12
+ fail msg
20
13
  end
21
14
  end
22
15
 
@@ -1,17 +1,3 @@
1
- require 'rake/tasklib'
2
-
3
- def assemblyinfo(name=:assemblyinfo, *args, &block)
4
- Albacore::AssemblyInfoTask.new(name, *args, &block)
5
- end
6
-
7
- module Albacore
8
- class AssemblyInfoTask < Albacore::AlbacoreTask
9
- def execute(name, task_args)
10
- @asm = AssemblyInfo.new
11
- @asm.load_config_by_task_name(name)
12
- @block.call(@asm, *task_args) unless @block.nil?
13
- @asm.write
14
- fail if @asm.failed
15
- end
16
- end
1
+ create_task :assemblyinfo, AssemblyInfo.new do |asm|
2
+ asm.write
17
3
  end
@@ -1,17 +1,3 @@
1
- require 'rake/tasklib'
2
-
3
- def docu(name=:docu, *args, &block)
4
- Albacore::DocuTask.new(name, *args, &block)
1
+ create_task :docu, Docu.new do |doc|
2
+ doc.execute
5
3
  end
6
-
7
- module Albacore
8
- class DocuTask < Albacore::AlbacoreTask
9
- def execute(name, task_args)
10
- @docu = Docu.new
11
- @docu.load_config_by_task_name(name)
12
- @block.call(@docu, *task_args) unless @block.nil?
13
- @docu.execute
14
- fail if @docu.failed
15
- end
16
- end
17
- end
@@ -1,18 +1,3 @@
1
- require 'rake/tasklib'
2
-
3
- def exec(name=:exec, *args, &block)
4
- Albacore::ExecTask.new(name, *args, &block)
5
- end
6
-
7
- module Albacore
8
- class ExecTask < Albacore::AlbacoreTask
9
- def execute(name, task_args)
10
- @exec = Exec.new
11
- @exec.load_config_by_task_name(name)
12
- @block.call(@exec, *task_args) unless @block.nil?
13
- @exec.execute
14
- fail if @exec.failed
15
- end
16
- end
17
-
18
- end
1
+ create_task :exec, Exec.new do |ex|
2
+ ex.execute
3
+ end
@@ -1,16 +1,3 @@
1
- require 'rake/tasklib'
2
-
3
- def expandtemplates(name=:expandtemplates, *args, &block)
4
- Albacore::ExpandTemplatesTask.new(name, *args, &block)
5
- end
6
-
7
- module Albacore
8
- class ExpandTemplatesTask < Albacore::AlbacoreTask
9
- def execute(name, task_args)
10
- @exp = ExpandTemplates.new
11
- @exp.load_config_by_task_name(name)
12
- @block.call(@exp, *task_args) unless @block.nil?
13
- @exp.expand
14
- end
15
- end
1
+ create_task :expandtemplates, ExpandTemplates.new do |exp|
2
+ exp.expand
16
3
  end
@@ -1,18 +1,3 @@
1
- require 'rake/tasklib'
2
-
3
- def msbuild(name=:msbuild, *args, &block)
4
- Albacore::MSBuildTask.new(name, *args, &block)
5
- end
6
-
7
- module Albacore
8
- class MSBuildTask < Albacore::AlbacoreTask
9
- def execute(name, task_args)
10
- @msbuild = MSBuild.new
11
- @msbuild.load_config_by_task_name(name)
12
- @block.call(@msbuild, *task_args) unless @block.nil?
13
- @msbuild.build
14
- fail if @msbuild.failed
15
- end
16
- end
17
-
1
+ create_task :msbuild, MSBuild.new do |msbuild|
2
+ msbuild.build
18
3
  end
@@ -1,17 +1,3 @@
1
- require 'rake/tasklib'
2
-
3
- def mspec(name=:mspec, *args, &block)
4
- Albacore::MSpecTask.new(name, *args, &block)
5
- end
6
-
7
- module Albacore
8
- class MSpecTask < Albacore::AlbacoreTask
9
- def execute(name, task_args)
10
- @mspec = MSpecTestRunner.new
11
- @mspec.load_config_by_task_name(name)
12
- @block.call(@mspec, *task_args) unless @block.nil?
13
- @mspec.execute
14
- fail if @mspec.failed
15
- end
16
- end
1
+ create_task :mspec, MSpecTestRunner.new do |mspec|
2
+ mspec.execute
17
3
  end
@@ -1,17 +1,3 @@
1
- require 'rake/tasklib'
2
-
3
- def nant(name=:nant, *args, &block)
4
- Albacore::NAntTask.new(name, *args, &block)
5
- end
6
-
7
- module Albacore
8
- class NAntTask < Albacore::AlbacoreTask
9
- def execute(name, task_args)
10
- nant = NAnt.new
11
- nant.load_config_by_task_name(name)
12
- @block.call(nant, *task_args) unless @block.nil?
13
- nant.run
14
- fail if nant.failed
15
- end
16
- end
1
+ create_task :nant, NAnt.new do |nant|
2
+ nant.run
17
3
  end
@@ -1,17 +1,3 @@
1
- require 'rake/tasklib'
2
-
3
- def ncoverconsole(name=:ncoverconsole, *args, &block)
4
- Albacore::NCoverConsoleTask.new(name, *args, &block)
5
- end
6
-
7
- module Albacore
8
- class NCoverConsoleTask < Albacore::AlbacoreTask
9
- def execute(name, task_args)
10
- @ncover = NCoverConsole.new
11
- @ncover.load_config_by_task_name(name)
12
- @block.call(@ncover, *task_args) unless @block.nil?
13
- @ncover.run
14
- fail if @ncover.failed
15
- end
16
- end
17
- end
1
+ create_task :ncoverconsole, NCoverConsole.new do |ncover|
2
+ ncover.run
3
+ end
@@ -1,17 +1,3 @@
1
- require 'rake/tasklib'
2
-
3
- def ncoverreport(name=:ncoverreport, *args, &block)
4
- Albacore::NCoverReportTask.new(name, *args, &block)
5
- end
6
-
7
- module Albacore
8
- class NCoverReportTask < Albacore::AlbacoreTask
9
- def execute(name, task_args)
10
- @ncoverreport = NCoverReport.new
11
- @ncoverreport.load_config_by_task_name(name)
12
- @block.call(@ncoverreport, *task_args) unless @block.nil?
13
- @ncoverreport.run
14
- fail if @ncoverreport.failed
15
- end
16
- end
17
- end
1
+ create_task :ncoverreport, NCoverReport.new do |ncoverreport|
2
+ ncoverreport.run
3
+ end
@@ -1,21 +1,3 @@
1
- require 'rake/tasklib'
2
- require 'albacore'
3
-
4
- def ndepend(name=:command, *args, &block)
5
- Albacore::NDepend.new(name, *args, &block)
6
- end
7
-
8
- module Albacore
9
- class NDependTask < Albacore::AlbacoreTask
10
- def execute(name, task_args)
11
- cmd = NDepend.new()
12
- cmd.load_config_by_task_name(name)
13
- @block.call(cmd, *task_args) unless @block.nil?
14
- cmd.run
15
- fail if cmd.failed
16
- end
17
- end
18
- end
19
-
20
-
21
-
1
+ create_task :ndepend, NDepend.new do |cmd|
2
+ cmd.run
3
+ end
@@ -1,17 +1,3 @@
1
- require 'rake/tasklib'
2
-
3
- def nunit(name=:nunit, *args, &block)
4
- Albacore::NUnitTask.new(name, *args, &block)
5
- end
6
-
7
- module Albacore
8
- class NUnitTask < Albacore::AlbacoreTask
9
- def execute(name, task_args)
10
- @nunit = NUnitTestRunner.new
11
- @nunit.load_config_by_task_name(name)
12
- @block.call(@nunit, *task_args) unless @block.nil?
13
- @nunit.execute
14
- fail if @nunit.failed
15
- end
16
- end
17
- end
1
+ create_task :nunit, NUnitTestRunner.new do |n|
2
+ n.execute
3
+ end
@@ -1,23 +1,3 @@
1
- require 'rake/tasklib'
2
- require 'albacore'
3
-
4
- def plink(name=:command, *args, &block)
5
- Albacore::PLinkTask.new(name, *args, &block)
6
- end
7
-
8
- module Albacore
9
- class PLinkTask < Albacore::AlbacoreTask
10
- attr_accessor :remote_parameters, :remote_path_to_command
11
-
12
- def execute(name, task_args)
13
- cmd = PLink.new()
14
- cmd.load_config_by_task_name(name)
15
- @block.call(cmd, *task_args) unless @block.nil?
16
- cmd.run
17
- fail if cmd.failed
18
- end
19
- end
20
- end
21
-
22
-
23
-
1
+ create_task :plink, PLink.new() do |cmd|
2
+ cmd.run
3
+ end