forked from mxriverlynn/Albacore
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working on new task syntax and options to allow more rake like callin…
…g... Albacore::msbuild :name, [:var] => :dependency do |t,args| ... end
- Loading branch information
Derick Bailey
committed
Dec 3, 2009
1 parent
bd3df23
commit 0b35de9
Showing
3 changed files
with
30 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
require 'rake/tasklib' | ||
|
||
module Albacore | ||
class MSBuildTask < Rake::TaskLib | ||
attr_accessor :name | ||
|
||
def initialize(name=:msbuild, &block) | ||
@name = name | ||
@block = block | ||
define | ||
end | ||
|
||
def self.msbuild(name=:msbuild, *args, &block) | ||
MSBuildTask.new(name, *args, &block) | ||
end | ||
|
||
class MSBuildTask < AlbacoreTask | ||
|
||
def define | ||
task name do | ||
@msbuild = MSBuild.new | ||
@block.call(@msbuild) unless @block.nil? | ||
@msbuild.build | ||
fail if @msbuild.failed | ||
end | ||
def execute(task_args) | ||
@msbuild = MSBuild.new | ||
@block.call(@msbuild, task_args) unless @block.nil? | ||
@msbuild.build | ||
fail if @msbuild.failed | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Albacore | ||
class AlbacoreTask < Rake::TaskLib | ||
attr_accessor :name | ||
|
||
def initialize(name, *args, &block) | ||
@block = block | ||
@args = args.insert(0, name) | ||
define | ||
end | ||
|
||
def define | ||
task *@args do |task, task_args| | ||
execute task_args | ||
end | ||
end | ||
end | ||
end |