Skip to content

Commit

Permalink
working on new task syntax and options to allow more rake like callin…
Browse files Browse the repository at this point in the history
…g... Albacore::msbuild :name, [:var] => :dependency do |t,args| ... end
  • Loading branch information
Derick Bailey committed Dec 3, 2009
1 parent bd3df23 commit 0b35de9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
1 change: 1 addition & 0 deletions lib/albacore.rb
Expand Up @@ -5,5 +5,6 @@

require 'logging'

Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), 'rake/support/*.rb')).each {|f| require f }
Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), 'rake/*.rb')).each {|f| require f }
Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), 'albacore/*.rb')).each {|f| require f }
27 changes: 12 additions & 15 deletions lib/rake/msbuildtask.rb
@@ -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
17 changes: 17 additions & 0 deletions lib/rake/support/albacoretask.rb
@@ -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

0 comments on commit 0b35de9

Please sign in to comment.