Add env recipe keyword feature

This commit is contained in:
Thibault Jouan
2013-08-03 23:06:34 +00:00
parent d677c3aa97
commit a6e27edfd2
3 changed files with 28 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ module Producer
end
def evaluate(env)
@env = env
if @code
instance_eval @code, env.current_recipe.filepath
else
@@ -25,10 +26,18 @@ module Producer
private
def env
@env
end
def source(filepath)
instance_eval File.read("./#{filepath}.rb"), "#{filepath}.rb"
end
def target(hostname)
env.target = hostname
end
def task(name, &block)
@tasks << Task.new(name, &block)
end