albacore 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/EULA.txt +1 -1
- data/VERSION +1 -1
- data/lib/albacore.rb +4 -4
- data/lib/albacore/ncoverconsole.rb +4 -4
- data/lib/albacore/ncoverreport.rb +3 -3
- data/lib/albacore/ndepend.rb +3 -3
- data/lib/albacore/nunittestrunner.rb +1 -1
- data/lib/albacore/plink.rb +4 -3
- data/lib/albacore/renamer.rb +17 -0
- data/lib/albacore/sqlcmd.rb +3 -3
- data/lib/albacore/support/failure.rb +1 -8
- data/lib/rake/assemblyinfotask.rb +2 -16
- data/lib/rake/docutask.rb +2 -16
- data/lib/rake/exectask.rb +3 -18
- data/lib/rake/expandtemplatestask.rb +2 -15
- data/lib/rake/msbuildtask.rb +2 -17
- data/lib/rake/mspectask.rb +2 -16
- data/lib/rake/nanttask.rb +2 -16
- data/lib/rake/ncoverconsoletask.rb +3 -17
- data/lib/rake/ncoverreporttask.rb +3 -17
- data/lib/rake/ndependtask.rb +3 -21
- data/lib/rake/nunittask.rb +3 -17
- data/lib/rake/plinktask.rb +3 -23
- data/lib/rake/renametask.rb +2 -19
- data/lib/rake/sftptask.rb +3 -16
- data/lib/rake/sqlcmdtask.rb +2 -16
- data/lib/rake/sshtask.rb +2 -15
- data/lib/rake/support/albacoretask.rb +16 -6
- data/lib/rake/support/createtask.rb +20 -0
- data/lib/rake/unziptask.rb +2 -16
- data/lib/rake/xbuildtask.rb +4 -19
- data/lib/rake/xunittask.rb +2 -16
- data/lib/rake/ziptask.rb +2 -16
- data/rakefile.rb +6 -6
- data/spec/assemblyinfo_spec.rb +2 -0
- data/spec/assemblyinfotask_spec.rb +13 -12
- data/spec/createtask_spec.rb +70 -0
- data/spec/docutask_spec.rb +34 -21
- data/spec/exec_spec.rb +2 -1
- data/spec/exectask_spec.rb +25 -10
- data/spec/expandtemplatestask_spec.rb +25 -10
- data/spec/msbuild_spec.rb +2 -1
- data/spec/msbuildtask_spec.rb +25 -10
- data/spec/mspectask_spec.rb +25 -10
- data/spec/nant_spec.rb +2 -1
- data/spec/nanttask_spec.rb +24 -9
- data/spec/ncoverconsole_spec.rb +16 -8
- data/spec/ncoverconsoletask_spec.rb +25 -10
- data/spec/ncoverreport_spec.rb +27 -13
- data/spec/ncoverreporttask_spec.rb +25 -10
- data/spec/ndepend_spec.rb +3 -1
- data/spec/ndependtask_spec.rb +37 -22
- data/spec/nunittask_spec.rb +25 -10
- data/spec/nunittestrunner_spec.rb +3 -3
- data/spec/patches/fail_patch.rb +9 -0
- data/spec/plink_spec.rb +1 -0
- data/spec/plinktask_spec.rb +37 -22
- data/spec/renametask_spec.rb +13 -11
- data/spec/sftptask_spec.rb +11 -10
- data/spec/sqlcmd_spec.rb +4 -2
- data/spec/sqlcmdtask_spec.rb +11 -10
- data/spec/sshtask_spec.rb +11 -10
- data/spec/support/spec_helper.rb +2 -1
- data/spec/xunit_spec.rb +2 -2
- data/spec/xunittask_spec.rb +11 -10
- data/spec/ziptask_spec.rb +12 -11
- metadata +10 -7
- data/spec/patches/tasklib_patch.rb +0 -12
data/lib/rake/renametask.rb
CHANGED
@@ -1,20 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def rename(name=:rename, *args, &block)
|
4
|
-
Albacore::RenameTask.new(name, *args, &block)
|
5
|
-
end
|
6
|
-
|
7
|
-
module Albacore
|
8
|
-
class RenameTask < Albacore::AlbacoreTask
|
9
|
-
attr_accessor :actual_name, :target_name
|
10
|
-
|
11
|
-
def execute(name, task_args)
|
12
|
-
@block.call(self, *task_args) unless @block.nil?
|
13
|
-
if (@actual_name.nil? || @target_name.nil?)
|
14
|
-
fail
|
15
|
-
else
|
16
|
-
File.rename(@actual_name, @target_name)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
1
|
+
create_task :rename, Renamer.new do |ren|
|
2
|
+
ren.rename
|
20
3
|
end
|
data/lib/rake/sftptask.rb
CHANGED
@@ -1,16 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
Albacore::SftpTask.new(name, *args, &block)
|
5
|
-
end
|
6
|
-
|
7
|
-
module Albacore
|
8
|
-
class SftpTask < Albacore::AlbacoreTask
|
9
|
-
def execute(name, task_args)
|
10
|
-
@sftp = Sftp.new
|
11
|
-
@sftp.load_config_by_task_name(name)
|
12
|
-
@block.call(@sftp, *task_args) unless @block.nil?
|
13
|
-
@sftp.upload
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
1
|
+
create_task :sftp, Sftp.new do |cmd|
|
2
|
+
cmd.upload
|
3
|
+
end
|
data/lib/rake/sqlcmdtask.rb
CHANGED
@@ -1,17 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def sqlcmd(name=:sqlcmd, *args, &block)
|
4
|
-
Albacore::SQLCmdTask.new(name, *args, &block)
|
5
|
-
end
|
6
|
-
|
7
|
-
module Albacore
|
8
|
-
class SQLCmdTask < Albacore::AlbacoreTask
|
9
|
-
def execute(name, task_args)
|
10
|
-
@sqlcmd = SQLCmd.new
|
11
|
-
@sqlcmd.load_config_by_task_name(name)
|
12
|
-
@block.call(@sqlcmd, *task_args) unless @block.nil?
|
13
|
-
@sqlcmd.run
|
14
|
-
fail if @sqlcmd.failed
|
15
|
-
end
|
16
|
-
end
|
1
|
+
create_task :sqlcmd, SQLCmd.new do |cmd|
|
2
|
+
cmd.run
|
17
3
|
end
|
data/lib/rake/sshtask.rb
CHANGED
@@ -1,16 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def ssh(name=:ssh, *args, &block)
|
4
|
-
Albacore::SshTask.new(name, *args, &block)
|
5
|
-
end
|
6
|
-
|
7
|
-
module Albacore
|
8
|
-
class SshTask < Albacore::AlbacoreTask
|
9
|
-
def execute(name, task_args)
|
10
|
-
@ssh = Ssh.new
|
11
|
-
@ssh.load_config_by_task_name(name)
|
12
|
-
@block.call(@ssh, *task_args) unless @block.nil?
|
13
|
-
@ssh.execute
|
14
|
-
end
|
15
|
-
end
|
1
|
+
create_task :ssh, Ssh.new do |cmd|
|
2
|
+
cmd.execute
|
16
3
|
end
|
@@ -6,15 +6,25 @@ module Albacore
|
|
6
6
|
|
7
7
|
def initialize(name, *args, &block)
|
8
8
|
@block = block
|
9
|
-
|
10
|
-
|
11
|
-
define
|
9
|
+
args = args.insert(0, name)
|
10
|
+
define name, args
|
12
11
|
end
|
13
12
|
|
14
|
-
def define
|
15
|
-
task
|
16
|
-
|
13
|
+
def define(name, args)
|
14
|
+
task *args do |task, task_args|
|
15
|
+
@task_args = task_args
|
16
|
+
execute name.to_s
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
def call_task_block(obj)
|
21
|
+
if !@block.nil?
|
22
|
+
if @block.arity == 1
|
23
|
+
@block.call(obj)
|
24
|
+
else
|
25
|
+
@block.call(obj, @task_args)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
19
29
|
end
|
20
30
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
def create_task(taskname, task_object, &execute_body)
|
2
|
+
taskclass = :"Albacore_TaskFor_#{taskname}"
|
3
|
+
taskmethod = taskname.to_s.downcase.to_sym
|
4
|
+
|
5
|
+
Object.class_eval(<<-EOF, __FILE__, __LINE__)
|
6
|
+
def #{taskmethod}(name=:#{taskname}, *args, &block)
|
7
|
+
Albacore.const_get("#{taskclass}").new(name, *args, &block)
|
8
|
+
end
|
9
|
+
EOF
|
10
|
+
|
11
|
+
Albacore.class_eval do
|
12
|
+
const_set(taskclass, Class.new(Albacore::AlbacoreTask) do
|
13
|
+
define_method :execute do |name|
|
14
|
+
task_object.load_config_by_task_name(name)
|
15
|
+
call_task_block(task_object)
|
16
|
+
execute_body.call(task_object) unless execute_body.nil?
|
17
|
+
end
|
18
|
+
end)
|
19
|
+
end
|
20
|
+
end
|
data/lib/rake/unziptask.rb
CHANGED
@@ -1,17 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def unzip(name=:unzip, *args, &block)
|
4
|
-
Albacore::UnZipTask.new(name, *args, &block)
|
5
|
-
end
|
6
|
-
|
7
|
-
module Albacore
|
8
|
-
class UnZipTask < Albacore::AlbacoreTask
|
9
|
-
def execute(name, task_args)
|
10
|
-
@zip = Unzip.new
|
11
|
-
@zip.load_config_by_task_name(name)
|
12
|
-
@block.call(@zip, *task_args) unless @block.nil?
|
13
|
-
@zip.unzip
|
14
|
-
fail if @zip.failed
|
15
|
-
end
|
16
|
-
end
|
1
|
+
create_task :unzip, Unzip.new do |zip|
|
2
|
+
zip.unzip
|
17
3
|
end
|
data/lib/rake/xbuildtask.rb
CHANGED
@@ -1,22 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def xbuild(name=:xbuild, *args, &block)
|
4
|
-
Albacore::XBuildTask.new(name, *args, &block)
|
1
|
+
create_task :xbuild, XBuild.new do |xb|
|
2
|
+
xb.build
|
5
3
|
end
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
module Albacore
|
12
|
-
class XBuildTask < Albacore::AlbacoreTask
|
13
|
-
def execute(name, task_args)
|
14
|
-
@xbuild = XBuild.new
|
15
|
-
@xbuild.load_config_by_task_name(name)
|
16
|
-
@block.call(@xbuild, *task_args) unless @block.nil?
|
17
|
-
@xbuild.build
|
18
|
-
fail if @xbuild.failed
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
5
|
+
create_task :mono, XBuild.new do |xb|
|
6
|
+
xb.build
|
22
7
|
end
|
data/lib/rake/xunittask.rb
CHANGED
@@ -1,17 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def xunit(name=:xunit, *args, &block)
|
4
|
-
Albacore::XUnitTask.new(name, *args, &block)
|
5
|
-
end
|
6
|
-
|
7
|
-
module Albacore
|
8
|
-
class XUnitTask < Albacore::AlbacoreTask
|
9
|
-
def execute(name, task_args)
|
10
|
-
@xunit = XUnitTestRunner.new
|
11
|
-
@xunit.load_config_by_task_name(name)
|
12
|
-
@block.call(@xunit, *task_args) unless @block.nil?
|
13
|
-
@xunit.execute
|
14
|
-
fail if @xunit.failed
|
15
|
-
end
|
16
|
-
end
|
1
|
+
create_task :xunit, XUnitTestRunner.new do |x|
|
2
|
+
x.execute
|
17
3
|
end
|
data/lib/rake/ziptask.rb
CHANGED
@@ -1,17 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def zip(name=:zip, *args, &block)
|
4
|
-
Albacore::ZipTask.new(name, *args, &block)
|
5
|
-
end
|
6
|
-
|
7
|
-
module Albacore
|
8
|
-
class ZipTask < Albacore::AlbacoreTask
|
9
|
-
def execute(name, task_args)
|
10
|
-
@zip = ZipDirectory.new
|
11
|
-
@zip.load_config_by_task_name(name)
|
12
|
-
@block.call(@zip, *task_args) unless @block.nil?
|
13
|
-
@zip.package
|
14
|
-
fail if @zip.failed
|
15
|
-
end
|
16
|
-
end
|
1
|
+
create_task :zip, ZipDirectory.new do |z|
|
2
|
+
z.package
|
17
3
|
end
|
data/rakefile.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'lib/albacore'
|
2
|
+
|
1
3
|
task :default => ['albacore:sample']
|
2
4
|
|
3
5
|
namespace :specs do
|
@@ -134,8 +136,6 @@ namespace :specs do
|
|
134
136
|
end
|
135
137
|
|
136
138
|
namespace :albacore do
|
137
|
-
require 'lib/albacore'
|
138
|
-
|
139
139
|
#global configuration options
|
140
140
|
Albacore::yaml_config_folder = "spec/support/yamlconfig"
|
141
141
|
Albacore::log_level = :verbose
|
@@ -151,7 +151,7 @@ namespace :albacore do
|
|
151
151
|
'albacore:xunit']
|
152
152
|
|
153
153
|
desc "Run a sample MSBuild with YAML autoconfig"
|
154
|
-
msbuild
|
154
|
+
msbuild :msbuild
|
155
155
|
|
156
156
|
desc "Run a sample assembly info generator"
|
157
157
|
assemblyinfo do |asm|
|
@@ -258,11 +258,11 @@ namespace :jeweler do
|
|
258
258
|
require 'jeweler'
|
259
259
|
Jeweler::Tasks.new do |gs|
|
260
260
|
gs.name = "albacore"
|
261
|
-
gs.summary = "
|
262
|
-
gs.description = "Easily build your .NET solutions with
|
261
|
+
gs.summary = "Dolphin-Safe Rake Tasks For .NET Systems"
|
262
|
+
gs.description = "Easily build your .NET solutions with Ruby and Rake, using this suite of Rake tasks."
|
263
263
|
gs.email = "derickbailey@gmail.com"
|
264
264
|
gs.homepage = "http://albacorebuild.net"
|
265
|
-
gs.authors = ["Derick Bailey", "Ben Hall"
|
265
|
+
gs.authors = ["Derick Bailey", "Ben Hall"]
|
266
266
|
gs.has_rdoc = false
|
267
267
|
gs.files.exclude("albacore.gemspec", ".gitignore", "spec/support/Tools")
|
268
268
|
|
data/spec/assemblyinfo_spec.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
2
2
|
require 'albacore/assemblyinfo'
|
3
3
|
require 'rake/assemblyinfotask'
|
4
|
-
require '
|
4
|
+
require 'fail_patch'
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe "when running" do
|
7
7
|
before :all do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
Rake::Task["
|
8
|
+
assemblyinfo :assemblyinfo do |asm|
|
9
|
+
asm.extend(FailPatch)
|
10
|
+
@yielded_object = asm
|
11
|
+
end
|
12
|
+
Rake::Task["assemblyinfo"].invoke
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should yield the assembly info api" do
|
@@ -17,15 +17,16 @@ describe Albacore::AssemblyInfoTask, "when running" do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
describe
|
20
|
+
describe "when execution fails" do
|
21
21
|
before :all do
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
assemblyinfo :failingtask do |asm|
|
23
|
+
asm.extend(FailPatch)
|
24
|
+
asm.fail
|
25
|
+
end
|
25
26
|
Rake::Task["failingtask"].invoke
|
26
27
|
end
|
27
28
|
|
28
29
|
it "should fail the rake task" do
|
29
|
-
|
30
|
+
$task_failed.should == true
|
30
31
|
end
|
31
32
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
2
|
+
require 'albacore/support/albacore_helper'
|
3
|
+
require 'fail_patch'
|
4
|
+
|
5
|
+
class SampleObject
|
6
|
+
include Failure
|
7
|
+
include YAMLConfig
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "when defining a task" do
|
11
|
+
before :all do
|
12
|
+
@sample_object = SampleObject.stub_instance()
|
13
|
+
@sample_object.stub_method(:load_config_by_task_name){ |name|
|
14
|
+
@task_name = name
|
15
|
+
}
|
16
|
+
create_task :sampletask, @sample_object do |obj|
|
17
|
+
@task_obj = obj
|
18
|
+
end
|
19
|
+
|
20
|
+
sampletask :sample do |x|
|
21
|
+
x.extend(FailPatch)
|
22
|
+
@config_obj = x
|
23
|
+
end
|
24
|
+
Rake::Task[:sample].invoke
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should yield the object for configuration" do
|
28
|
+
@config_obj.should == @sample_object
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should yield the object for execution" do
|
32
|
+
@task_obj.should == @sample_object
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should call the yaml configuration by task name" do
|
36
|
+
@task_name.should == "sample"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "when execution fails" do
|
41
|
+
before :all do
|
42
|
+
create_task :failing_task, SampleObject.new
|
43
|
+
|
44
|
+
failing_task :sample_fail do |x|
|
45
|
+
x.extend(FailPatch)
|
46
|
+
x.fail
|
47
|
+
end
|
48
|
+
Rake::Task[:sample_fail].invoke
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should fail the rake task" do
|
52
|
+
$task_failed.should == true
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "when task args are used" do
|
57
|
+
before :all do
|
58
|
+
create_task :task_with_args, SampleObject.new
|
59
|
+
|
60
|
+
task_with_args :sampletask_withargs, [:arg1] do |t, args|
|
61
|
+
t.extend(FailPatch)
|
62
|
+
@args = args
|
63
|
+
end
|
64
|
+
Rake::Task[:sampletask_withargs].invoke("test")
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should provide the task args" do
|
68
|
+
@args.arg1.should == "test"
|
69
|
+
end
|
70
|
+
end
|
data/spec/docutask_spec.rb
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
2
2
|
require 'albacore/docu'
|
3
3
|
require 'rake/docutask'
|
4
|
-
require '
|
4
|
+
require 'fail_patch'
|
5
|
+
require 'system_patch'
|
5
6
|
require 'docu_patch'
|
6
7
|
|
7
|
-
describe
|
8
|
+
describe "when running" do
|
8
9
|
before :all do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@yielded_object =
|
13
|
-
|
14
|
-
|
15
|
-
task.extend(TasklibPatch)
|
16
|
-
Rake::Task[:successful_task].invoke
|
10
|
+
docu :docu do |d|
|
11
|
+
d.assemblies 'test.dll'
|
12
|
+
d.command_result = true
|
13
|
+
@yielded_object = d
|
14
|
+
end
|
15
|
+
Rake::Task[:docu].invoke
|
17
16
|
end
|
18
17
|
|
19
18
|
it "should yield the docu api" do
|
@@ -21,19 +20,33 @@ describe Albacore::DocuTask, "when running" do
|
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
24
|
-
describe
|
23
|
+
describe "when execution fails" do
|
25
24
|
before :all do
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
Rake::Task[:failing_task].invoke
|
25
|
+
docu :docu_fail do |d|
|
26
|
+
d.extend(FailPatch)
|
27
|
+
d.assemblies 'test.dll'
|
28
|
+
d.command_result = true
|
29
|
+
d.fail
|
30
|
+
end
|
31
|
+
Rake::Task[:docu_fail].invoke
|
34
32
|
end
|
35
33
|
|
36
34
|
it "should fail the rake task" do
|
37
|
-
|
35
|
+
$task_failed.should be_true
|
38
36
|
end
|
39
|
-
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "when task args are used" do
|
40
|
+
before :all do
|
41
|
+
docu :docutask_withargs, [:arg1] do |d, args|
|
42
|
+
d.assemblies 'test.dll'
|
43
|
+
d.command_result = true
|
44
|
+
@args = args
|
45
|
+
end
|
46
|
+
Rake::Task["docutask_withargs"].invoke("test")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should provide the task args" do
|
50
|
+
@args.arg1.should == "test"
|
51
|
+
end
|
52
|
+
end
|