Implement task evaluation feature
This commit is contained in:
@@ -13,11 +13,15 @@ module Producer
|
||||
|
||||
def evaluate
|
||||
dsl = DSL.new(@code)
|
||||
dsl.tasks.each.map(&:evaluate)
|
||||
end
|
||||
|
||||
|
||||
class DSL
|
||||
attr_reader :tasks
|
||||
|
||||
def initialize(code = nil, &block)
|
||||
@tasks = []
|
||||
if code
|
||||
instance_eval code
|
||||
else
|
||||
@@ -31,6 +35,10 @@ module Producer
|
||||
def source(filepath)
|
||||
instance_eval File.read("./#{filepath}.rb")
|
||||
end
|
||||
|
||||
def task(name, &block)
|
||||
@tasks << Task.new(name, &block)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user