Implement `macro' recipe keyword

This commit is contained in:
Thibault Jouan
2013-12-20 09:51:15 +00:00
parent 43a781dc78
commit e8be44d1f0
7 changed files with 93 additions and 13 deletions

View File

@@ -34,8 +34,14 @@ module Producer
env.target = hostname
end
def task(name, &block)
@tasks << Task.evaluate(name, env, &block)
def task(name, *args, &block)
@tasks << Task.evaluate(name, env, *args, &block)
end
def macro(name, &block)
define_singleton_method(name) do |*args|
task("#{name}", *args, &block)
end
end
end
end